Skip to main content

Create Plugin

We can quickly create a new plugin via cli.

npx ministar createPlugin

mini-star will ask some questions through an interactive terminal program to finally create a plugin.

Plugins will be automatically placed in the plugins/ directory of the root directory.

Now, let's try to create a plugin called test:

At this time, the <root>/plugins directory should be as follows:

โ””โ”€โ”€ test
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ src
โ”‚ย ย  โ””โ”€โ”€ index.ts
โ””โ”€โ”€ tsconfig.json

One of the simplest plugins is complete, start your plugin journey with index.ts as the entrance

Compile the plugin#

In order for the plugin to be loaded correctly, don't forget to use ministar to compile the plug-in code after each modification. By default, it will be packaged and output to the dist/plugins directory of the current directory.

You can also modify the output by modifying outDir in the configuration file.

npx ministar buildPlugin test
# or
npx ministar buildPlugin all