forked from SalesforceCommerceCloud/b2c-crm-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_sfScratchOrgPush.js
More file actions
26 lines (22 loc) · 889 Bytes
/
_sfScratchOrgPush.js
File metadata and controls
26 lines (22 loc) · 889 Bytes
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
'use strict';
// Initialize required modules
const sfdx = require('sfdx-node/parallel');
/**
* @function _sfScratchOrgPush
* @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
* @returns {Promise} Returns the result of the deployment attempt
*/
module.exports = environmentDef => {
const deployArguments = {
forceoverwrite: environmentDef.sfScratchOrgForceOverwrite,
_rejectOnError: true
};
// 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.push(deployArguments);
};