import child_process = require ( "child_process" ) ; import SFPLogger from "../logger/SFPLogger" ; import { onExit } from "../utils/OnExit" ; export default class PromoteUnlockedPackageImpl { public constructor ( private project_directory , private package_version_id , private devhub_alias ) { } public async exec ( ) { let command = this . buildExecCommand ( ) ; SFPLogger . log ( `Executing command: ${ command }` ) ; let child = child_process . exec ( command , { cwd : this . project_directory , encoding : "utf8" } ) ; child . stdout . on ( "data" , data => { SFPLogger . log ( data . toString ( ) ) ; } ) ; child . stderr . on ( "data" , data => { SFPLogger . log ( data . toString ( ) ) ; } ) ; await onExit ( child ) ; } private buildExecCommand ( ) { let command = `sfdx force:package:version:promote -v ${ this . devhub_alias }` ; command += ` -p ${ this . package_version_id }` ; command += ` -n` ; return command ; } }