/salesforce-deploy

Utility to deploy cartridges on a Salesforce Commerce Cloud instance

Primary LanguageJavaScriptMIT LicenseMIT

Salesforce Deploy

cartridges deploy made easy

build status npm version dependencies devDependencies vulnerabilities coverage javascript style guide conventional commits

Utility to deploy cartridges on a Salesforce Commerce Cloud instance.

Installation

npm install salesforce-deploy

Usage

import deploy from 'salesforce-deploy'

deploy({
  hostname: "<sfcc-instance-hostname>",
  username: "<business-manager-username>",
  password: "<business-manager-password>",
  cartridges: [
    { source: "<cartridges-path>" },    
    { source: "<cartridges-path>", exclude: "<glob-pattern>" }
  ],
  codeVersion: "<code-version>",
  force: false
})

Parameters

Parameter Type Mandatory Default Description
hostname String yes Hostname of the SFCC instance
username String yes Business Manager username
password String yes Business Manager password
cartridges String, Array yes Local source paths where the script will look for cartridges to deploy
codeVersion String yes Name of the code version to deploy
force Boolean no false Flag to remove existing code version before deploy

Returns

A Promise fulfilled with true if deploy process succeded, otherwise false.

Example - Deploy cartridges from a single folder

import deploy from 'salesforce-deploy'

let deployed

try {
  deployed = await deploy({
    hostname: "dev01-realm-customer.demandware.net",
    username: "bm_user",
    password: "bm_pass",
    cartridges: "./cartridges/project_1",
    codeVersion: "v1.0.0-rc.0"
  })
} catch (e) {
  deployed = false
}

console.log(deployed) // true for sure!

Example - Deploy cartridges from multi folder

import deploy from 'salesforce-deploy'

let deployed

try {
  deployed = await deploy({
    hostname: "dev01-realm-customer.demandware.net",
    username: "bm_user",
    password: "bm_pass",
    cartridges: [
      { source: "./cartridges/project_1" },    
      { source: "./cartridges/project_2", exclude: "**/{cart,checkout/**" } // `exclude` property value must be a glob pattern
    ],
    codeVersion: "v1.0.0-rc.0"
  })
} catch (e) {
  deployed = false
}

console.log(deployed) // true for sure!

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT. Copyright (C) 2018, 2019 Francesco Pasqua.