Created
November 3, 2019 10:53
-
-
Save vyuvalv/b7377a3ef416d3f81bd24e340fb99887 to your computer and use it in GitHub Desktop.
Build and Run SFDX Commands with Yo parameters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// command builder | |
let sfdxCommand = ' sfdx force:org:create'; | |
sfdxCommand += ' -d ' + this.props.numberOfDays; // --durationdays | |
sfdxCommand += ' -a ' + this.props.scratchOrgName; // --setalias | |
// will receieve this.options as input parameters from constructor | |
sfdxCommand += ' -f ' + this.options.projectFolder + '/config/scratch-org-def.json'; // --definitionfile | |
sfdxCommand += ' -v ' + this.options.devhubOrg; // -v | --targetdevhubusername | |
// will only assign as default if user wish to | |
if(this.props.isDefault) | |
sfdxCommand += ' --setdefaultusername'; // -s | --setdefaultusername | |
// running the SFDX command and checking if was executed successfully | |
this.log(" Run command : "+ chalk.magenta(sfdxCommand) ); | |
if(shell.exec(sfdxCommand).code === 0) { | |
this.log('😺 ' + chalk.green('created successfully scratch org ' + this.props.scratchOrgName + '\n') ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment