You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 54 Next »

Magnolia CLI is 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.

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.

Release history

3.0.0

Released on DD Month YYYY.

What has changed?

  • Node v
  • New prototype structure with expanded list of prototype options. For a full description see the Prototypes in CLI v3 subpage.

    Key Summary T Created Status
    Loading...
    Refresh

      

2.2.0

Released on 18 January 2018.

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 the Magnolia Nexus repository.
  • 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: magnolia.resources.dir=${magnolia.home}/../../../light-modules
  • 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.

  • To help us help you in case you run into an issue, the mgnl -h command now also prints out your node.js version, OS and Magnolia CLI version.
  • The mgnl create-component command now generates a component dialog definition yaml file containing label options (instead of the previously used name) for i18n compliance. 

Key Summary T Created Status
Loading...
Refresh

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:

Key Summary T Created Status
Loading...
Refresh

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.
    • (warning) 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-48
  • create-light-module command generates README files. NPMCLI-62
  • Node v 6.0+ is required to run the CLI.

Key Summary T Created Status
Loading...
Refresh

Video: Magnolia CLI Tool makes web developers' lives easier

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

Error rendering macro 'artifact-resource-macro'

com.sun.jersey.api.client.ClientHandlerException: java.net.NoRouteToHostException: No route to host (Host unreachable)

.

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 -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).

Installing Magnolia CLI

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 view @magnolia/cli versions

Besides a version list, the following command will show additional information about the Magnolia CLI package:

npm view @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 

Updating Magnolia CLI

If you have already installed the CLI and want to update to the latest version, use:

npm update @magnolia/cli -g

Testing the installation

To test the installation, run the following command in the shell:

mgnl help 

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

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):

source /usr/local/lib/node_modules/@magnolia/cli/extra/mgnl-autocompletion.sh

See also

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels