Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Install third-party NPM Packages

Describes how to install third-party NPM packages in Spire.

Configured Commerce lets partners and clients install third-party NPM packages within Spire.

  1. Go to src/FrontEnd/modules/blueprints/{BlueprintThatNeedsCustomPackage}.
  2. Use npm install --save {PackageName} to install all the package(s) needed for development. This adds or updates a file at src/FrontEnd/modules/blueprints/{BlueprintThatNeedsCustomPackage}/package.json.

    🚧

    Important

    The installation of third-party NPM packages only works under the blueprint folder. Installing the packages under src/FrontEnd (which is the root folder of Spire) may cause build failure.

  3. Push the changes to sandbox branch. 
    • Optimizely uses the Workspaces feature of NPM to link the blueprint packages and the Spire package. More details can be found here: https://docs.npmjs.com/cli/v7/using-npm/workspaces.
    • Each Workspace is one blueprint folder under src/FrontEnd/modules/blueprints. A Powershell script runs during build time to generate workspaces in the package.json of the Spire root automatically.

📘

Note

The desired license must fall into the below list of allowed types to prevent the build from failing.

The following list contains the allowed license types of 3rd party NPM packages:

  • MIT
  • Apache-2.0
  • BSD-3-Clause
  • BSD-2-Clause
  • BSD-like
  • (OFL-1.1 AND MIT)
  • (MIT OR Apache-2.0)
  • (MIT AND BSD-3-Clause)

📘

Note

A license may be under the allowed types but still fail the build due to its format. If this happens, please submit a support ticket for Optimizely to review and add the license to the list of allowed types.