Magnolia CLI is an npm package providing a command line interface (CLI) tool to set up and facilitate light development with Magnolia. The commands of the Magnolia CLI package facilitate the creation of a light module skeleton: the folders and files that form a typical Magnolia light module. For information about how to use Magnolia CLI commands, please refer to the following subpages depending on the version you intend to use:
The present page only tracks the history of Magnolia CLI version releases and provides steps to install it.
Release history
2.2.0
Released on DD Month YYYY.
What has changed?
Node v 6.10+ is required to run the CLI.
A new option -c (--cloud) has been added to the jumpstart command. mgnl jumpstart -c downloads and sets up a Magnolia Cloud bundle. It requires enterprise credentials to access Magnolia Nexus.
If no -p option is set when executing the jumpstart command, the magnolia.resources.dir property in the magnolia.properties file is set to a relative path by default: info magnolia.resources.dir=${magnolia.home}/../../../light-modules
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-99
install - 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:
To check the version of your node installation run the following command in a shell:
node -v
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).
Magnolia CLI installation
Best practice
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:
npm info @magnolia/cli
Installing the latest version
To install the latest version (globally), run the following command in a shell:
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:
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:
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:
sudo npm install @magnolia/cli@2.1.0 -g
If the installation is successful, the output in the shell should be similar to this:
If you have already installed the CLI and want to update to the latest version, use:
npm update @magnolia/cli -g
Test the installation
To test the installation, run the following command in the shell:
mgnl help
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:
mgnl tab-completion install
To uninstall it, use:
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.
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:
Set-ExecutionPolicy RemoteSigned
Uninstallation of 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):