forked from SalesforceCommerceCloud/b2c-crm-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_sfOrgDeploy.js
More file actions
30 lines (24 loc) · 1.02 KB
/
_sfOrgDeploy.js
File metadata and controls
30 lines (24 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'use strict';
// Initialize required modules
const sfdx = require('sfdx-node/parallel');
/**
* @function _sfScratchOrgDeploy
* @description Attempts to deploy b2c-crm-sync code a SFDX scratch org
*
* @param {Object} environmentDef Represents the already-validated environment details to use when performing the actions
* @param {String} [deployPath] Represents the path where the specified meta-data will be deployed to a scratchOrg
* @returns {Promise} Returns a promise with the scratchOrg deployment results
*/
module.exports = (environmentDef, deployPath) => {
// noinspection SpellCheckingInspection
const deployArguments = {
_rejectOnError: true,
sourcepath: deployPath
};
// Set the username to deploy to if it's defined
if (Object.prototype.hasOwnProperty.call(environmentDef, 'sfScratchOrgUsername')) {
deployArguments.targetusername = environmentDef.sfScratchOrgUsername;
}
// Attempt to deploy to the scratchOrg
return sfdx.force.source.deploy(deployArguments);
};