import child_process = require ( "child_process" ) ; import { onExit } from "../utils/OnExit" ; import { isNullOrUndefined } from "util" ; import SFPLogger from "../logger/SFPLogger" ; export default class ValidateDXUnlockedPackageImpl { public constructor ( private validate_package , private bypass , private project_directory ) { } public async exec ( command ) { let child = child_process . exec ( command , { encoding : "utf8" , cwd : this . project_directory } ) ; child . stdout . on ( "data" , data => { SFPLogger . log ( data . toString ( ) ) ; } ) ; child . stderr . on ( "data" , data => { SFPLogger . log ( data . toString ( ) ) ; } ) ; await onExit ( child ) ; } public async buildExecCommand ( ) { let command ; command = `sfdx sfpowerkit:package:valid` ; if ( ! isNullOrUndefined ( this . validate_package ) ) command += ` -n  ${ this . validate_package }` ; if ( ! isNullOrUndefined ( this . bypass ) ) command += ` -b  ${ this . bypass }` ; return command ; } }