Uploaded image for project: 'Magnolia CLI npm module '
  1. Magnolia CLI npm module
  2. NPMCLI-161

"_default" prototypes should not be available via "default"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Neutral
    • Resolution: Fixed
    • Affects Version/s: 3.0.0
    • Fix Version/s: 3.0.0
    • Labels:
      None
    • Documentation update required:
      Yes
    • Epic Link:
    • Sprint:
      Kromeriz 134
    • Story Points:
      2

      Description

      The cli treats the "_default" prototypes in a special way, which could lead to confusion or errors.

      It lists the "_default" prototype directory as "default":

      Available prototypes are: [default, empty, with-js-model].
      

      It allows the usage without the underscore:

      > mgnl create-page a3 -P default
      

      This is inconsistant to how the other prototuype directories are treated, for no real big benefit.
      A dev could run into trouble if they made another prototuype directory called "default", they could run it, or might get confused.

      TO change:
      List the _default prototype directory just like the other ones:

      Available prototypes are: [ _default, empty, with-js-model].
      

      Do not support this usage (user must provide "_default":

      > mgnl create-page a3 -P default
      

      *Original description: *
      In the stock installation of CLI v3 (3.0.0-SNAPSHOT of 7 February 2018) the

      mgnl help create-page
      

      (for example) says that:

      Available prototypes are: [default, empty, with-js-model].
      

      I would expect that the very last mgnl command of the five shown below (together with the output), will produce an error (as does the mgnl create-page a3 -P _empty command) and not build the structure from the _default prototype:

      > mgnl create-page a1                                             
      info Using configuration at /home/martin/dev/cli3/npm-cli/lib/config/mgnl-cli.json
      info Using prototypes at /home/martin/dev/cli3/npm-cli/lib/config/mgnl-cli-prototypes
      info No path option provided, page template will be created in the current folder.
      info Created /home/martin/dev/all-light-modules/clitkt/dialogs/pages/a1.yaml
      info Created /home/martin/dev/all-light-modules/clitkt/templates/pages/a1.ftl
      info Created /home/martin/dev/all-light-modules/clitkt/templates/pages/a1.yaml
      info Page template created
      
      
      > mgnl create-page a2 -P empty
      info Using configuration at /home/martin/dev/cli3/npm-cli/lib/config/mgnl-cli.json
      info Using prototypes at /home/martin/dev/cli3/npm-cli/lib/config/mgnl-cli-prototypes
      info No path option provided, page template will be created in the current folder.
      info Created /home/martin/dev/all-light-modules/clitkt/templates/pages/a2.ftl
      info Created /home/martin/dev/all-light-modules/clitkt/templates/pages/a2.yaml
      info Page template created
      
      
      > mgnl create-page a3 -P _empty
      info Using configuration at /home/martin/dev/cli3/npm-cli/lib/config/mgnl-cli.json
      info Using prototypes at /home/martin/dev/cli3/npm-cli/lib/config/mgnl-cli-prototypes
      info No path option provided, page template will be created in the current folder.
      ERR! /home/martin/dev/cli3/npm-cli/lib/config/mgnl-cli-prototypes/page/_empty doesn't exist. Please ensure that your mgnl-cli-prototypes folder contains prototype with name _empty.
      
      
      > mgnl create-page a4 -P default
      info Using configuration at /home/martin/dev/cli3/npm-cli/lib/config/mgnl-cli.json
      info Using prototypes at /home/martin/dev/cli3/npm-cli/lib/config/mgnl-cli-prototypes
      info No path option provided, page template will be created in the current folder.
      info Created /home/martin/dev/all-light-modules/clitkt/templates/pages/a4.ftl
      info Created /home/martin/dev/all-light-modules/clitkt/dialogs/pages/a4.yaml
      info Created /home/martin/dev/all-light-modules/clitkt/templates/pages/a4.yaml
      info Page template created
      
      > mgnl create-page a5 -P _default
      info Using configuration at /home/martin/dev/cli3/npm-cli/lib/config/mgnl-cli.json
      info Using prototypes at /home/martin/dev/cli3/npm-cli/lib/config/mgnl-cli-prototypes
      info No path option provided, page template will be created in the current folder.
      info Created /home/martin/dev/all-light-modules/clitkt/templates/pages/a5.ftl
      info Created /home/martin/dev/all-light-modules/clitkt/templates/pages/a5.yaml
      info Created /home/martin/dev/all-light-modules/clitkt/dialogs/pages/a5.yaml
      info Page template created
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ajuran AntonĂ­n Juran
                Reporter:
                mdrapela Martin DrĂ¡pela
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Date of First Response: