Testing new plugins
This page describes how you can test newly created Magnolia CLI plugins. After you’ve created a new CLI plugin, you can connect it with the CLI.
Building and packing
-
Build the plugin. In the folder with your new plugin, run this npm command:
npm run build -
Pack the package.
npm packYou should see the following message:
... <plugin_name>-<plugin_version>.tgz
Add it to a project
Using the plugin
-
Check whether the plugin is loaded.
npm run mgnl -h -
Run the new plugin.
npm run mgnl <plugin_name> -- -plugin-option option-value (1)Windows users using PowerShell must enclose the two consecutive hyphens (
--) in quotes:npm run mgnl "--" ...1 For example, npm run mgnl cli-foo-plugin -s -- -n "John".The following should be displayed:
Plugin started options { name: 'John' } Hello John