I generated a multi-command CLI using npx oclif multi mynewcli
. I'm trying to install the default plugin created using npx oclif plugin mynewplugin
as referenced here. I don't know see any documentation on how to actually do that though. Is there documentation I'm missing? How does the CLI know where to look for included plugins?
Install Local Plugin
583 views Asked by Mojo982 At
2
There are 2 answers
0
On
In the link you supplied, it says where it knows where to look:
Plugins can have commands or hooks just like a CLI. To add a plugin such as the not-found plugin plugin, first add it to your CLI with yarn add @oclif/plugin-not-found, then add the following to your package.json:
{ "name": "mycli", "version": "0.0.0", // ... "oclif": { "plugins": [ "@oclif/plugin-help", "@oclif/plugin-not-found" ] } }
After you have executed the two commands
npx oclif multi mynewcli
andnpx oclif plugin mynewplugin
is some directory for example in this case theprojects
directory, your directories will be structured like thiscd
into themynewcli
project andinstall the plugins installer with
npm i @oclif/plugin-plugins --save
add this plugin into
package.json
inoclif.plugins
arrayrun
./bin/run plugins:link ../mynewplugin
to link the plugin into your main projectrun
./bin/run plugins
you will see yourmynewplugin
was added into your project