Installing a Caplin Trader package

Note: this documentation is for a beta release of Caplin Trader 5. Features may change before the final release.

This page provides instructions on how to include a Caplin Trader 5 Node.js package in your application.



The Caplin Trader packages must be present in your development workspace's caplin-packages directory. See Creating a new workspace.

Installing a Caplin Trader package

Caplin packages are not available in the npm registry and are instead stored in the caplin-packages directory of your workspace. To install a Caplin Package, a relative file path to the package is passed to the npm install command.

For example, to install the Caplin Trader package br-presenter, follow the steps below:

  1. Run the command below from the root directory of your Caplin Trader application:

    npm install --save ../../packages-caplin/br-presenter

    This command installs the br-presenter package and its dependencies to the node_modules directory. The --save option adds br-presenter as a project dependency in your application's package.json file. From npm v5, the --save option is the default behaviour and is not required.

  2. [npm v3, v4] Edit the package.json file in your Caplin Trader application and change the location of the br-presenter package from an absolute path to a relative path:

    "dependencies": {
        "br-presenter": "file:../../packages-caplin/br-presenter"

    From npm v5, a relative path is added to the packages.json file by default and this step is not required.

  3. From the root directory of your application, run the command below to obtain an up-to-date list of alias definition modules in your application:

    find . -name 'aliasProviders.js'

    For an application containing just the Caplin Trader br-presenter package, the output from the above command would typically be:

    Tip: on Microsoft Windows, the find command is distributed with Cygwin and the Bash shell of Git for Windows.
  4. If the output from step 3 indicates that you have alias definitions in your application, edit your application's src/config/aliases.js file and export all aliasProvider modules merged together as a single object. This step is required for Webpack to correctly resolve Caplin Trader service aliases.

    Continuing this example, the edited aliases.js file below merges the br-presenter/aliasProviders module with a single export object:

    // require aliasProvider here, add to the Object.assign list.
    const brPresenterAliasProviders = require('br-presenter/aliasProviders');
    module.exports = Object.assign({}, brPresenterAliasProviders);

    If there is more than one package in your application with an aliasProvider, then add each aliasProvider as an extra source object in the call to Object.assign(target, ...sources). For example, if the application in this example also has the Caplin ct-sljsadapter package installed, then the application's aliases.js file would look like the file below:

    // require aliasProvider here, add to the Object.assign list.
    const brPresenterAliasProviders = require('br-presenter/aliasProviders');
    const ctSljsAdapterAliasProviders = require('ct-sljsadapter/aliasProviders');
    module.exports = Object.assign({}, brPresenterAliasProviders, ctSljsAdapterAliasProviders);