1.0.0 • Published 9 months ago

@magnolia/cli-create-app-plugin v1.0.0

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
-
Last release
9 months ago

CreateAppPlugin

A plugin for Magnolia CLI to create an app in a light module

Installation

Using add-plugin

  1. Run the following command in the project's root directory:

    npm run mgnl -- add-plugin @magnolia/cli-create-app-plugin

    The command will install the plugin, and automatically register the plugin in mgnl.config.js file:

    import CreateAppPlugin from "@magnolia/cli-create-app-plugin";
    
    export default {
      plugins: [
        new CreateAppPlugin()
      ]
    };
  2. To confirm that the plugin has been successfully installed, run:

    npm run mgnl -- create-app --help

Manually

  1. Run the following command in the project's root directory:
    npm install @magnolia/cli-create-app-plugin
  2. Manually add CreateAppPlugin to mgnl.config.js file:

    import CreateAppPlugin from "@magnolia/cli-create-app-plugin";
    
    export default {
      plugins: [
        new CreateAppPlugin()
      ]
    };
  3. To confirm that the plugin has been successfully installed, run:

    npm run mgnl -- create-app --help

Usage

Options

ShortLongDescription
-ct <name>--content-type <name>configure the content type by creating a new type or choosing an existing one (recommended singular)
-lm [name]--light-module [name]set the light module for the app; 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 app creation
-p [name]--prototype [name]select a prototype for app creation
-v--versionoutput the version number
-h--helpdisplay help for command

Examples

Create app

npm run mgnl -- create-app "myFooApp"

This command will prompt you to select a content-type for the app and then generate the necessary files based on the "_default" prototype. If neither the lightModulesPath nor the lightModule property exists in mgnl.config.js, the plugin will prompt you to choose each.

Create app and content-type

npm run mgnl -- create-app "myFooApp" --content-type "myFooContentType"

This commands creates a new app called "myFooApp" and a new conent-type called "myFooContentType" based on "_default" prototype. If neither the lightModulesPath nor the lightModule property exists in mgnl.config.js, the plugin will prompt you to choose each.

Plugin Documentation

For detailed documentation of the plugin, please refer to Plugin Documentation

Magnolia CMS

This plugin is created to work with Magnolia CMS. For more information, please refer to Magnolia CMS Documentation