1.0.0-preview.1 • Published 1 month ago

@magnolia/cli-create-light-module v1.0.0-preview.1

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
-
Last release
1 month ago

Create light module

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.

Installation

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()
  ]
};

Usage

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]

Command-line 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.

Available directories shortcuts

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".

Example

1) Create new light module in current directory

```bash
npm run mgnl create-light-module -- my-module
```

2) Create new light module in ../../light-modules directory

```bash
npm run mgnl create-light-module -- my-module -p ../../light-modules
```

3) Create new light module with apps, decorations and i18n sub-folders using -d option

```bash
npm run mgnl create-light-module -- my-module -d A D i18n
```

```
my-module/
├── apps
├── decorations
├── i18n
│ └── my-module-messages_en.properties
├── README.md
```