[NPMCLI-92] add-availability can be confusing Created: 31/Jan/17  Updated: 01/Feb/17

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

Type: Improvement Priority: Neutral
Reporter: Robert Kowalski Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

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:

 Description   

I am building my component right now. At some point I wanted to make it available to a page.

We spent a good amount of time figuring out how it should work.

My setup:

(13:54:07) [robert@tequila-new] ~/magnolia/light-modules $ tree
.
├── mgnl-bobby
│   ├── LICENSE
│   ├── README.md
│   ├── decorations
│   ├── dialogs
│   │   ├── components
│   │   │   └── react-playground.yaml
│   │   └── pages
│   ├── i18n
│   │   └── react-playground-messages_en.properties
│   ├── package.json
│   ├── templates
│   │   ├── components
│   │   │   ├── react-playground.ftl
│   │   │   └── react-playground.yaml
│   │   └── pages
│   ├── test
│   └── webresources
│       ├── css
│       └── js
└── parking-lot
    ├── README.md
    ├── decorations
    ├── dialogs
    │   ├── components
    │   └── pages
    │       └── rocko.yaml
    ├── i18n
    │   └── parking-lot-messages_en.properties
    ├── templates
    │   ├── components
    │   └── pages
    │       ├── rocko.ftl
    │       └── rocko.yaml
    └── webresources
        ├── css
        ├── js
        └── prototype.html

25 directories, 13 files

The issue I ran into was:

Usage: mgnl add-availability <[module-id:]path-to-component>  <path-to-page[@area]> [options]
$ mgnl add-availability mgnl-bobby parking-lot
INFO: No target area specified, will default to 'main'
ERR! ERROR: Sorry, path '/Users/robert/magnolia/light-modules' does not seem to point at a valid existing light module folder.
Path option should point at a valid light module (e.g. one created with mgnl create-light-module). Please, ensure your light module complies with the expected structure.
See https://documentation.magnolia-cms.com/display/DOCS/Magnolia+CLI#MagnoliaCLI-Lightmoduleminimalfolderstructure

$ mgnl add-availability mgnl-bobby parking-lot -p parking-lot/
INFO: No target area specified, will default to 'main'
ERR! parking-lot/templates/pages/parking-lot.yaml page definition doesn't exist

The right command was in the end:

mgnl add-availability mgnl-bobby:react-playground rocko -p ./parking-lot/

Let's make it easier for users, e.g. by providing a nice example or even a list of available pages.



 Comments   
Comment by Tomáš Gregovský [ 31/Jan/17 ]

just side note: add-availability command was originally created to help to set availability to component from another light module, eg.

mgnl add-availability mtk:components/link pages/home
(pages/home is page in my project, but mtk I don't have in file system), feel free to contact me if you have any questions behind this. thanks

Comment by Tomáš Gregovský [ 01/Feb/17 ]

and for your example it should be:

mgnl add-availability components/react-playground pages/rocko

but if both page and component is in your module and you are just creating them it's easy to specify availability while you do mgnl create-component

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