Magnolia 5.6 reached end of life on June 25, 2020. This branch is no longer supported, see End-of-life policy.
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.
Tip |
---|
If you want to jump straight in, try out our Magnolia CLI walkthrough that provides step-by-step instructions to get everything set up and create a working light module. |
Table of Contents | ||||||
---|---|---|---|---|---|---|
|
...
Hide block |
---|
Released on DD Month YYYY. |
...
Expand | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
|
...
Released on 18 January 2018.
...
...
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 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
|
...
Released on 17 March 2017.
alt
attribute uses the caption
property. NPMCLI-31__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-84tab-completion install
command, if completed successfully, will also display the files (together with their paths) to which the autocompletion script has been appended. NPMCLI-107lib/locales/
). The messages in English are located in the en
subfolder. NPMCLI-91Expand | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
|
...
Released on 27 February 2017.
This version contains many improvements and bugfixes. Here is an incomplete list of the new or changed features:
start
for easy start, stop and logging of Magnolia. NPMCLI-58mgnl tab-completion
.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-62Expand | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
|
Youtube | ||||||
---|---|---|---|---|---|---|
|
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 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
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.
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:
Code Pro |
---|
node -v |
Node.js provides two branches:
If your node version is below 6.10, install the latest version of the LTS branch (see node.js/download).
...
Bestpractice |
---|
Install Magnolia CLI globally.
|
The instructions that follow are based on the global npm package installation.
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 view @magnolia/cli |
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 |
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 you have already installed the CLI and want to update to the latest version, use:
Code Block |
---|
npm update @magnolia/cli -g |
To test the installation, run the following command in the shell:
Code Block | ||
---|---|---|
| ||
mgnl help |
...
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:
|
...
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 |
...