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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 3.0.0
    • 3.0.0
    • None
    • Yes
    • Kromeriz 134
    • 2

      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
      

        Acceptance criteria

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

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD