Adding modules

Introduction

WebMail Pro 8 allows for installing additional modules from AfterLogic or third-party repositories.

In Aurora platform, composer is used as package manager. When you're adding a module to your installation, it will be downloaded and installed by this package manager. And since the approach of adding modules is identical to adding packages in composer, you might be aware of it already - if not, you'll find the detailed info below.

Prerequisites

To perform installing additional modules you will need:

Download composer.phar from https://getcomposer.org/composer.phar

Install all npm modules via

npm install

and install gulp-cli module globally

npm install --global gulp-cli

Installing a module

1. You need to specify a new dependency for your installation. Build configuration is specified in 2 files, composer.json and modules.json.

To declare dependency, supply module name and version in require section of modules.json file using the following format:

"afterlogic/some-module-name-here": "0.4.0"

When modifying the file, be sure to maintain valid JSON format.

2. Then, make sure composer is aware where manifest of the module can be found. This is where repositories section of modules.json file is affected.

a) if module is created by AfterLogic, it's already included into AfterLogic modules registry:

{"type": "composer", "url":"https://afterlogic.com/composer/"}

and altering repositories section is not required.

b) if it's a third-party module and it's added to registry of composer, i.e. found at packagist.org, altering repositories section is not required.

c) if it's a third-party module found in public git repository, it needs to be added to repositories section:

{"type": "git", "url":"https://github.com/afterlogic/some-module-name-here"}

Install the module by running the following command:

php composer.phar update

NB: It is strongly advised to run composer as non-root user. Otherwise, third-party scripts will be run with root permissions and composer issues a warning that it's not safe. We recommend running the script as the same user web server runs under.

Build static files:

1) Skins - required if module contains styles directory:

gulp styles --themes Default,Funny

2) JavaScript - required if module contains js directory:

gulp js:min

Note that it's perfectly safe to rebuild all the static files, regardless of the specific module content and purpose. For example, if backend module doesn't contain any JavaScript code, you can still run the commands that rebuild JavaScript, that won't do any harm.