[NPMCLI-40] Get rid of module specifier for the 2nd argument of add-availability (and -a option for create-component) Created: 25/Jul/16  Updated: 04/Apr/17  Resolved: 21/Mar/17

Status: Closed
Project: Magnolia CLI
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Christoph Meier Assignee: Robert Kowalski
Resolution: Obsolete Votes: 1
Labels: quickwin
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
is related to NPMCLI-36 Improve descriptions for create-compo... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:
Sprint: Basel 88
Story Points: 0.5

 Description   

mgnl-add-availability has the following synopsis:

mgnl-add-availability <[refId/]componentName> <[moduleName:relPath/]page@area> [options]
  • The component to add can be from the current module or from any module, npm-cli will not check whether the specified component exists.
  • The page to add the component to must exist in the pages dir. of the current folder or in a pages dir of the directory specified by the -p option.

This said, the 2nd argument how it is explained in the synopis can be simplified. And indeed:
mgnl add-availability components/c1 pages/p1@main
results in the same as
mgnl add-availability components/c1 mymodule:pages/p1@main
Since the npm-cli already works correct for both cases, we prbly. just have to adapt the Usage text.

The same is true for the -a option when calling create-component:
both
mgnl create-component c3 -a pages/p1@main
and
mgnl create-component c3 -a my-module:pages/p1@main
does the same.



 Comments   
Comment by Christoph Meier [ 25/Jul/16 ]

Maybe tgregovsky and or fgrilli can "review" this request for simplification - just to make sure i haven't missed a point which makes the module specifier indispensable.

Comment by Christopher Zimmermann [ 25/Jul/16 ]

I like this suggestion. I came to the same conclusion independently. It makes understanding the commands easier because there is only one way to refence the page. (Also the module specifier does not work correctly under some circumstances.)

I am updating the linked ticket to reflect this improvement.
https://jira.magnolia-cms.com/browse/NPMCLI-36

Comment by Christoph Meier [ 25/Jul/16 ]

I propose the following (new) Synopis aka Usage:

<[<module-id:>]relPath/component>  <relPath/page@area>  [options]

... or something similar.
afaik, the brackets ( [ and ]) are used for optional things.
When it comes to wildcards or variables, i'm unsure about what is common

Comment by Chetan [ 11/Aug/16 ]

Hi I am getting error in using Magnolia CLI tool:

My NPM version is:
nacon@nacon-004:~$ npm -v
3.10.5

My Node.js version is:
nacon@nacon-004:~$ node -v
v0.10.37

nacon@nacon-004:~$ mgnl create-light-module my-module -p light-modules/
INFO: Using configuration at /usr/lib/node_modules/@magnolia/cli/lib/config/mgnl-cli.json
INFO: Using prototypes at /usr/lib/node_modules/@magnolia/cli/lib/config/mgnl-cli-prototypes
INFO: Resource folder '/home/nacon/light-modules/my-module' created.
INFO: Resource folder '/home/nacon/light-modules/my-module/dialogs/components' created.
INFO: Resource folder '/home/nacon/light-modules/my-module/dialogs/pages' created.
INFO: Resource folder '/home/nacon/light-modules/my-module/templates/components' created.
INFO: Resource folder '/home/nacon/light-modules/my-module/templates/pages' created.
INFO: Resource folder '/home/nacon/light-modules/my-module/webresources/css' created.
INFO: Resource folder '/home/nacon/light-modules/my-module/webresources/js' created.
INFO: Resource folder '/home/nacon/light-modules/my-module/decorations' created.
INFO: Resource folder '/home/nacon/light-modules/my-module/i18n' created.
DONE: Module my-module created at /home/nacon/light-modules
nacon@nacon-004:~$ cd light-modules/my-module/
nacon@nacon-004:~/light-modules/my-module$ mgnl create-page my-page
INFO: Using configuration at /usr/lib/node_modules/@magnolia/cli/lib/config/mgnl-cli.json
INFO: Using prototypes at /usr/lib/node_modules/@magnolia/cli/lib/config/mgnl-cli-prototypes
INFO: No path option provided, page template will be created in the current folder.
TypeError: Object /home/nacon/light-modules/my-module has no method 'endsWith'
nacon@nacon-004:~/light-modules/my-module$

Comment by Christoph Meier [ 12/Aug/16 ]

chetan1590
Be aware that we recommend node version 4.4.x (4.4.7atm) 6.3.x (6.3.1 atm).
(See https://documentation.magnolia-cms.com/display/DOCS/Magnolia+npm-cli#Magnolianpm-cli-Prerequisite:Node.js)

Besides that, your issue doesn't seem to be related with this ticket here where you have just commented.
Make sure you have an appropriate node version and try again.
If you still have an issue, feel free to file a new ticket or comment on an existing ticket which describes the same issue as you have.

Comment by Robert Kowalski [ 21/Mar/17 ]

I think this was fixed in NPMCLI-12 already, with commit

https://git.magnolia-cms.com/projects/BUILD/repos/npm-cli/commits/0025910e2b371be2023a1996ee0afd297c9a3b8f

Generated at Mon Feb 12 04:45:56 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.