Looking for documentation about Magnolia CLI?
Magnolia CLI is an an npm package providing a command line interface (CLI) tool to set up and facilitate light development with Magnolia. You can use Magnolia CLI to quickly create a light module skeleton: the folders and files that form a Magnolia light module.
We currently have two versions of the CLI that are maintained. The main difference is how prototypes are handled. If you are a new user, use v3.0. If you are an existing user and want to continue with the same prototype structure as before, use v2.2.0.
This page provides instructions on how to install Magnolia CLI and tracks the changes in Magnolia CLI releases.
...
Magnolia
...
Table of Contents |
---|
maxLevel | 4 |
---|
minLevel | 2 |
---|
exclude | (What.*)|(Vide.*)|(Uninstall.*) |
---|
|
Release history
...
3.0.0
Hide block |
---|
Released on DD Month YYYY. |
What has changed?
- Node v
- Prototypes
- add expandable with different structures here?
...
2.2.0
Released on 18 January 2018.
What has changed?
...
.
...
When creating a light module with the mgnl create-light-module
command, if you specify a path to a light modules folder that does not match the light modules root folder at the nearest Tomcat installation, you get an error. The error warns you that Magnolia cannot observe your module in the location specified. You can use the -f
option if you want to force the path to an unobserved folder.
...
Go to the latest version of Magnolia documentation for information about Magnolia CLI, including how to install, set up and use its commands.
Expand |
---|
title | Click here to see the list of issues resolved in version 2.2.0 |
---|
|
Jira |
---|
server | Magnolia - Issue tracker |
---|
columns | key,summary,type,created,status |
---|
maximumIssues | 20 |
---|
jqlQuery | project=NPMCLI AND fixVersion=2.2.0 |
---|
serverId | 500b06a6-e204-3125-b989-2d75b973d05f |
---|
|
|
...
2.1.0
Released on 17 March 2017.
What has changed?
- Two new commands have been added:
search
- helps find light modules on npm. NPMCLI-99install
- installs a light module from the registry into your light modules folder. NPMCLI-98
- In the prototype dialog template, the image
alt
attribute uses the caption
property. NPMCLI-31 - The placeholder
__lightDevModuleFolder__
for the name of the corresponding light module can be used in all prototypes files for page and component templates (in mgnl-cli-prototypes/page/*
and mgnl-cli-prototypes/component
). NPMCLI-84 - The
tab-completion install
command, if completed successfully, will also display the files (together with their paths) to which the autocompletion script has been appended. NPMCLI-107 - All CLI i18n messages are served from a single location (
lib/locales/
). The messages in English are located in the en
subfolder. NPMCLI-91 - This release also fixes a few bugfixes. A complete list of the issues which have been resolved in version 2.1.0 is available via the following link:
Expand |
---|
title | Click here to see the list of issues resolved in version 2.1.0 |
---|
|
Jira |
---|
server | Magnolia - Issue tracker |
---|
columns | key,summary,type,created,status |
---|
maximumIssues | 20 |
---|
jqlQuery | project=NPMCLI AND fixVersion=2.1.0 |
---|
serverId | 500b06a6-e204-3125-b989-2d75b973d05f |
---|
|
|
...
2.0.0
Released on 27 February 2017.
What has changed?
This version contains many improvements and bugfixes. Here is an incomplete list of the new or changed features:
- New command
start
for easy start, stop and logging of Magnolia. NPMCLI-58 - Improved autocompletion: (NPMCLI-69)
- Can be enabled and disabled with the new command
mgnl tab-completion
. - Is now available not only for bash, but also for C-shell and Windows PowerShell.
- Knows more things to autocomplete.
- If you were using autocompletion in a Magnolia CLI version below 2.0, you may want to uninstall autocomplete version 1.
- User experience enhanced by:
- Improved error and crash handling.
- Instructions on how to continue when a command is successfully executed.
setup
command renamed to customize-local-config
command. NPMCLI-101 add-availability
command defaults to main area when no area is specified. NPMCLI-48create-light-module
command generates README files. NPMCLI-62- Node v 6.0+ is required to run the CLI.
Expand |
---|
title | Click here for a complete list of the issues which have been resolved in version 2.0 |
---|
|
Jira |
---|
server | Magnolia - Issue tracker |
---|
columns | key,summary,type,created,status |
---|
maximumIssues | 20 |
---|
jqlQuery | project=NPMCLI AND fixVersion=2.0 |
---|
serverId | 500b06a6-e204-3125-b989-2d75b973d05f |
---|
|
|
Video: Magnolia CLI Tool makes web developers' lives easier
Youtube |
---|
width | 370 |
---|
videoId | qdDb-oYt18k |
---|
height | 210 |
---|
|
Please note that this video is based on Magnolia CLI 2.0.0 and Magnolia CORE 5.5.1 Community Edition. The latest release of Magnolia CORE is
Artifact resource link |
---|
groupId | info.magnolia.bundle |
---|
artifactId | magnolia-community-demo-bundle |
---|
label | $version |
---|
renderType | display_only |
---|
resourceType | ZIP |
---|
|
.Pre-2.0.0 versions
All pre-2.0.0 versions of Magnolia CLI, installable using the npm install
command, are considered beta and no official documentation is available for them.
Installing
Prerequisite: Node.js
The Magnolia CLI tool runs on Node.js. Make sure you have Node.js version 6.10+ installed (node.js may be easily installed via package managers).
To check the version of your node installation run the following command in a shell:
Node.js provides two branches:
- LTS - recommended for long term support
- Current - providing the latest features
If your node version is below 6.10, install the latest version of the LTS branch (see node.js/download).
...
Installing Magnolia CLI
Bestpractice |
---|
Install Magnolia CLI globally. - The configuration is stored globally.
- The commands are available in the shell on all directories.
- The global configuration can be overridden on a project level using the
customize-local-config command.
|
The instructions that follow are based on the global npm package installation.
Which versions are available?
To display a list of released versions of Magnolia CLI, enter the following command in a shell:
Code Block |
---|
npm view @magnolia/cli versions |
Besides a version list, the following command will show additional information about the Magnolia CLI package:
Code Block |
---|
npm info @magnolia/cli |
Installing the latest version
To install the latest version (globally), run the following command in a shell:
Code Block |
---|
npm install @magnolia/cli -g |
Depending on your permissions and the Node.js installation location, you may have to execute the above command with root permissions. On Linux or OS-X to run this command as root use:
Code Block |
---|
sudo npm install @magnolia/cli -g |
Installing a specific version
To install a specific version (globally), for example 2.1.0, run the following command in a shell:
Code Block |
---|
npm install @magnolia/cli@2.1.0 -g |
Depending on your permissions and the Node.js installation location, you may have to execute the above command with root permissions. On Linux or OS-X to run this command as root use:
Code Block |
---|
sudo npm install @magnolia/cli@2.1.0 -g |
If the installation is successful, the output in the shell should be similar to this:
Expand |
---|
title | Expand to see the output of an npm installation (v2.1.0 on Ubuntu MATE 16.04.1, nodejs v6.10.0) |
---|
|
Code Pro |
---|
/usr/local/bin/mgnl -> /usr/local/lib/node_modules/@magnolia/cli/bin/mgnl.js
> spawn-sync@1.0.15 postinstall /usr/local/lib/node_modules/@magnolia/cli/node_modules/spawn-sync
> node postinstall
/usr/local/lib
└─┬ @magnolia/cli@2.1.0
├─┬ @magnolia/magnolia-build@0.5.3
│ ├── fs-extra@0.26.7
│ └─┬ path@0.12.7
│ ├── process@0.11.9
│ └─┬ util@0.10.3
│ └── inherits@2.0.1
├── adm-zip@0.4.7
├─┬ async@2.1.5
│ └── lodash@4.17.4
├── bluebird@3.5.0
├─┬ chalk@1.1.3
│ ├── ansi-styles@2.2.1
│ ├── escape-string-regexp@1.0.5
│ ├─┬ has-ansi@2.0.0
│ │ └── ansi-regex@2.1.1
│ ├── strip-ansi@3.0.1
│ └── supports-color@2.0.0
├── command-exists@1.2.2
├─┬ commander@2.9.0
│ └── graceful-readlink@1.0.1
├── diff@3.2.0
├─┬ findup-sync@0.4.3
│ ├─┬ detect-file@0.1.0
│ │ └── fs-exists-sync@0.1.0
│ ├─┬ is-glob@2.0.1
│ │ └── is-extglob@1.0.0
│ ├─┬ micromatch@2.3.11
│ │ ├─┬ arr-diff@2.0.0
│ │ │ └── arr-flatten@1.0.1
│ │ ├── array-unique@0.2.1
│ │ ├─┬ braces@1.8.5
│ │ │ ├─┬ expand-range@1.8.2
│ │ │ │ └─┬ fill-range@2.2.3
│ │ │ │ ├── is-number@2.1.0
│ │ │ │ ├── isobject@2.1.0
│ │ │ │ ├── randomatic@1.1.6
│ │ │ │ └── repeat-string@1.6.1
│ │ │ ├── preserve@0.2.0
│ │ │ └── repeat-element@1.1.2
│ │ ├─┬ expand-brackets@0.1.5
│ │ │ └── is-posix-bracket@0.1.1
│ │ ├── extglob@0.3.2
│ │ ├── filename-regex@2.0.0
│ │ ├─┬ kind-of@3.1.0
│ │ │ └── is-buffer@1.1.5
│ │ ├── normalize-path@2.0.1
│ │ ├─┬ object.omit@2.0.1
│ │ │ ├─┬ for-own@0.1.5
│ │ │ │ └── for-in@1.0.2
│ │ │ └── is-extendable@0.1.1
│ │ ├─┬ parse-glob@3.0.4
│ │ │ ├─┬ glob-base@0.3.0
│ │ │ │ └── glob-parent@2.0.0
│ │ │ └── is-dotfile@1.0.2
│ │ └─┬ regex-cache@0.4.3
│ │ ├── is-equal-shallow@0.1.3
│ │ └── is-primitive@2.0.0
│ └─┬ resolve-dir@0.1.1
│ ├── expand-tilde@1.2.2
│ └─┬ global-modules@0.2.3
│ ├─┬ global-prefix@0.1.5
│ │ ├─┬ homedir-polyfill@1.0.1
│ │ │ └── parse-passwd@1.0.0
│ │ ├── ini@1.3.4
│ │ └─┬ which@1.2.12
│ │ └── isexe@1.1.2
│ └── is-windows@0.2.0
├─┬ fs-extra@0.30.0
│ ├── graceful-fs@4.1.11
│ ├── jsonfile@2.4.0
│ ├── klaw@1.3.1
│ ├── path-is-absolute@1.0.1
│ └─┬ rimraf@2.6.1
│ └─┬ glob@7.1.1
│ ├── fs.realpath@1.0.0
│ ├── inflight@1.0.6
│ └─┬ minimatch@3.0.3
│ └─┬ brace-expansion@1.1.6
│ ├── balanced-match@0.4.2
│ └── concat-map@0.0.1
├── http@0.0.0
├── i18next@7.1.2
├─┬ i18next-sync-fs-backend@0.1.0
│ └── json5@0.4.0
├─┬ inquirer@1.2.3
│ ├── ansi-escapes@1.4.0
│ ├─┬ cli-cursor@1.0.2
│ │ └─┬ restore-cursor@1.0.1
│ │ ├── exit-hook@1.1.1
│ │ └── onetime@1.1.0
│ ├── cli-width@2.1.0
│ ├─┬ external-editor@1.1.1
│ │ ├─┬ spawn-sync@1.0.15
│ │ │ └── os-shim@0.1.3
│ │ └── tmp@0.0.29
│ ├─┬ figures@1.7.0
│ │ └── object-assign@4.1.1
│ ├── mute-stream@0.0.6
│ ├─┬ pinkie-promise@2.0.1
│ │ └── pinkie@2.0.4
│ ├─┬ run-async@2.3.0
│ │ └── is-promise@2.1.0
│ ├── rx@4.1.0
│ ├─┬ string-width@1.0.2
│ │ ├── code-point-at@1.1.0
│ │ └─┬ is-fullwidth-code-point@1.0.0
│ │ └── number-is-nan@1.0.1
│ └── through@2.3.8
├─┬ json2yaml@1.1.0
│ └── remedial@1.0.7
├─┬ npm-registry-client@7.5.0
│ ├─┬ concat-stream@1.6.0
│ │ ├─┬ readable-stream@2.2.6
│ │ │ ├── buffer-shims@1.0.0
│ │ │ ├── core-util-is@1.0.2
│ │ │ ├── isarray@1.0.0
│ │ │ ├── process-nextick-args@1.0.7
│ │ │ ├── string_decoder@0.10.31
│ │ │ └── util-deprecate@1.0.2
│ │ └── typedarray@0.0.6
│ ├─┬ normalize-package-data@2.3.6
│ │ ├── hosted-git-info@2.4.1
│ │ ├─┬ is-builtin-module@1.0.0
│ │ │ └── builtin-modules@1.1.1
│ │ └─┬ validate-npm-package-license@3.0.1
│ │ ├─┬ spdx-correct@1.0.2
│ │ │ └── spdx-license-ids@1.2.2
│ │ └── spdx-expression-parse@1.0.4
│ ├── npm-package-arg@4.2.1
│ ├─┬ once@1.4.0
│ │ └── wrappy@1.0.2
│ ├── retry@0.10.1
│ └── slide@1.1.6
├─┬ npmlog@4.0.2
│ ├─┬ are-we-there-yet@1.1.2
│ │ └── delegates@1.0.0
│ ├── console-control-strings@1.1.0
│ ├─┬ gauge@2.7.3
│ │ ├── aproba@1.1.1
│ │ ├── has-unicode@2.0.1
│ │ ├── signal-exit@3.0.2
│ │ └── wide-align@1.1.0
│ └── set-blocking@2.0.0
├─┬ osenv@0.1.4
│ ├── os-homedir@1.0.2
│ └── os-tmpdir@1.0.2
├── progress@1.1.8
├─┬ request@2.81.0
│ ├── aws-sign2@0.6.0
│ ├── aws4@1.6.0
│ ├── caseless@0.12.0
│ ├─┬ combined-stream@1.0.5
│ │ └── delayed-stream@1.0.0
│ ├── extend@3.0.0
│ ├── forever-agent@0.6.1
│ ├─┬ form-data@2.1.2
│ │ └── asynckit@0.4.0
│ ├─┬ har-validator@4.2.1
│ │ ├─┬ ajv@4.11.5
│ │ │ ├── co@4.6.0
│ │ │ └─┬ json-stable-stringify@1.0.1
│ │ │ └── jsonify@0.0.0
│ │ └── har-schema@1.0.5
│ ├─┬ hawk@3.1.3
│ │ ├── boom@2.10.1
│ │ ├── cryptiles@2.0.5
│ │ ├── hoek@2.16.3
│ │ └── sntp@1.0.9
│ ├─┬ http-signature@1.1.1
│ │ ├── assert-plus@0.2.0
│ │ ├─┬ jsprim@1.4.0
│ │ │ ├── assert-plus@1.0.0
│ │ │ ├── extsprintf@1.0.2
│ │ │ ├── json-schema@0.2.3
│ │ │ └── verror@1.3.6
│ │ └─┬ sshpk@1.11.0
│ │ ├── asn1@0.2.3
│ │ ├── assert-plus@1.0.0
│ │ ├── bcrypt-pbkdf@1.0.1
│ │ ├─┬ dashdash@1.14.1
│ │ │ └── assert-plus@1.0.0
│ │ ├── ecc-jsbn@0.1.1
│ │ ├─┬ getpass@0.1.6
│ │ │ └── assert-plus@1.0.0
│ │ ├── jodid25519@1.0.2
│ │ ├── jsbn@0.1.1
│ │ └── tweetnacl@0.14.5
│ ├── is-typedarray@1.0.0
│ ├── isstream@0.1.2
│ ├── json-stringify-safe@5.0.1
│ ├─┬ mime-types@2.1.14
│ │ └── mime-db@1.26.0
│ ├── oauth-sign@0.8.2
│ ├── performance-now@0.2.0
│ ├── qs@6.4.0
│ ├── safe-buffer@5.0.1
│ ├── stringstream@0.0.5
│ ├─┬ tough-cookie@2.3.2
│ │ └── punycode@1.4.1
│ ├── tunnel-agent@0.6.0
│ └── uuid@3.0.1
├── semver@5.3.0
├─┬ tar@2.2.1
│ ├── block-stream@0.0.9
│ ├─┬ fstream@1.0.11
│ │ └─┬ mkdirp@0.5.1
│ │ └── minimist@0.0.8
│ └── inherits@2.0.3
└── yaml-js@0.1.4 |
|
Updating Magnolia CLI
If you have already installed the CLI and want to update to the latest version, use:
Code Block |
---|
npm update @magnolia/cli -g |
Testing the installation
To test the installation, run the following command in the shell:
Expand |
---|
title | Expand to show the output of mgnl help (v2.1.0) |
---|
|
Code Block |
---|
Usage: mgnl <command> [options]
Commands:
jumpstart download and setup a Magnolia CMS instance for development.
start start up a Magnolia CMS instance. To stop it, enter CTRL+C
add-availability add component availability.
build scan a node_modules folder for npm packages with the keyword "magnolia-light-module" (in package.json) and extract them to a directory of choice.
create-component create a component and optionally add availability for it.
create-light-module create a light module.
create-page create a page template.
customize-local-config extract "mgnl-cli-prototypes" folder and "mgnl-cli.json" file to customize CLI configuration.
install install a light module from npm to the local Magnolia instance.
search search a light module.
tab-completion install tab autocomplete feature for Bash, zsh or PowerShell
help [cmd] display help for [cmd]
A tool to setup and facilitate light development with Magnolia CMS
Options:
-h, --help output usage information
-V, --version output the version number
|
|
...
Shell autocompletion
The Magnolia CLI package provides autocompletion for bash, C-shell and Windows PowerShell.
To install/enable autocompletion, use:
Code Block |
---|
mgnl tab-completion install |
To uninstall it, use:
Code Block |
---|
mgnl tab-completion uninstall |
A successful installation of autocompletion will display a list of files to which the tab-completion script has been appended.
To test the autocompletion installation type mgnl
and then successively hit the Tab key to scroll through the available commands.
Note |
---|
On Windows autocompletion is only available in PowerShell. If it does not work as expected after installation you may have to change your execution policy. To do this, in PowerShell run as Administrator: Code Block |
---|
Set-ExecutionPolicy RemoteSigned |
|
...
Uninstalling old autocompletion source
If you have already used autocompletion with Magnolia CLI version below 2.0, you may want to uninstall the "old" autocompletion manually. To do so, remove the following line in your bash settings (in ~/.profile or ~/.bashrc):
Code Pro |
---|
source /usr/local/lib/node_modules/@magnolia/cli/extra/mgnl-autocompletion.sh |
See also
...