A plugin for Magnolia CLI to create a new light module
-
Run the following command in the project's root directory:
npm run mgnl -- add-plugin @magnolia/cli-create-light-module-plugin
The command will install the plugin, and automatically register the plugin in
mgnl.config.js
file:import CreateLightModulePlugin from "@magnolia/cli-create-light-module-plugin"; export default { plugins: [ new CreateLightModulePlugin() ] };
-
To confirm that the plugin has been successfully installed, run:
npm run mgnl -- create-light-module --help
- Run the following command in the project's root directory:
npm install @magnolia/cli-create-light-module-plugin
- Manually add CreateLightModulePlugin to mgnl.config.js file:
import CreateLightModulePlugin from "@magnolia/cli-create-light-module-plugin"; export default { plugins: [ new CreateLightModulePlugin() ] };
- To confirm that the plugin has been successfully installed, run:
npm run mgnl -- create-light-module --help
Short | Long | Description |
---|---|---|
-d [directories...] |
--directories [directories...] |
create specific directories within the light-module; example usage: "-d A D" will generate "apps" and "decorations" folders; available mappings: "A: apps, B: blocks, C: contentTypes, D: decorations, DIA: dialogs, I: i18n, INC: includes, M: messageViews, R: restEndpoints, T: templates, THM: themes, V: virtualUriMappings, W: webresources" |
-md <version> |
--module-descriptor <version> |
specify the module version of the light module; defaults to 1.0.0 |
-lmp [path] |
--light-modules-path [path] |
set the directory path for the new light module; defaults to the directory specified in mgnl.config.js file |
-pd <path> |
--prototype-dir <path> |
use the specified path to the custom prototype templates directory as the prototype source for light module creation |
-p [name] |
--prototype [name] |
select a prototype for light-module creation |
-v |
--version |
output the version number |
-h |
--help |
display help for command |
npm run mgnl -- create-light-module "my-lm"
This commands creates a new light-module folder called "my-lm" based on "_default" prototype. If no lightModulesPath
property exists in mgnl.config.js
, the plugin will prompt you to choose one.
npm run mgnl -- create-light-module "my-lm" --directories A D
This commands creates a new light-module folder called "my-lm" with "apps" and "decorations" folders. If no lightModulesPath
property exists in mgnl.config.js
, the plugin will prompt you to choose one.
npm run mgnl -- create-light-module "my-lm" --directories A D --light-modules-path "./magnolia/light-modules"
This commands creates a new light-module folder called "my-lm" with "apps" and "decorations" folders. Instead of using lightModulesPath
property from mgnl.config.js
the "my-lm" is created in "./magnolia/light-modules" and lightModulesPath
property in mgnl.config.js
is changed.
For detailed documentation of the plugin, please refer to Plugin Documentation
This plugin is created to work with Magnolia CMS. For more information, please refer to Magnolia CMS Documentation