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
Copy -
Pack the package.
npm pack
Copy You should see the following message:
... <plugin_name>-<plugin_version>.tgz
Copy
Add it to a project
Using the plugin
-
Check whether the plugin is loaded.
npm run mgnl -h
Copy -
Run the new plugin.
npm run mgnl <plugin_name> -- -plugin-option option-value (1)
Copy Windows users using PowerShell must enclose the two consecutive hyphens (
--
) in quotes:npm run mgnl "--" ...
Copy 1 For example, npm run mgnl cli-foo-plugin -s -- -n "John"
.The following should be displayed:
Plugin started options { name: 'John' } Hello John
Copy