This plugin creates a new light module in the form of a set of empty light module folders and the following two files:
- README.md, in the root folder of the module.
- <moduleName>-messages_en.properties, in the i18n folder this command creates.
Install plugin via npm:
npm i @magnolia/cli-create-light-module
Add CreateLightModulePlugin to mgnl.config.js file:
import CreateLightModulePlugin from "@magnolia/cli-create-light-module";
export default {
commands: [
new CreateLightModulePlugin()
]
};
The name of the light module can be provided as a parameter when calling the command. The light module is created in the current directory or in the directory specified with the optional -p parameter.
npm run mgnl create-light-module -- [<moduleName>] [options]
You can customize the create-light-module plugin's actions using these command-line options:
-
-p, --path <path>
, the path of the parent directory for the new light module. If omitted, the new light module is created within the current folder. -
-P, --prototype <prototype>
, the name of the prototype variant to create the light module. See prototype variants for the pre-configured variants available. -
-d, --directories [directories...]
, list of the directories that you want to be created.
To use -d, --directories [directories...]
option, refer to the following shortcuts:
- A corresponds to "apps",
- B to "blocks",
- C to "contentTypes",
- D to "decorations",
- DIA to "dialogs",
- I to "i18n",
- INC to "includes",
- M to "messageViews",
- R to "restEndpoints",
- T to "templates",
- THM to "themes",
- V to "virtualUriMappings",
- W to "webresources".
-
Create new light module in current directory
npm run mgnl create-light-module -- my-module
-
Create new light module in ../../light-modules directory
npm run mgnl create-light-module -- my-module -p ../../light-modules
-
Create new light module with apps, decorations and i18n sub-folders using
-d
optionnpm run mgnl create-light-module -- my-module -d A D i18n
my-module/ ├── apps ├── decorations ├── i18n │ └── my-module-messages_en.properties ├── README.md