diff --git a/packages/core/src/sfdxwrappers/PackageVersionListImpl.ts b/packages/core/src/sfdxwrappers/PackageVersionListImpl.ts index 546110dd1..1b4f4082c 100644 --- a/packages/core/src/sfdxwrappers/PackageVersionListImpl.ts +++ b/packages/core/src/sfdxwrappers/PackageVersionListImpl.ts @@ -1,46 +1,24 @@ -import child_process = require("child_process"); -import SFPLogger from "../utils/SFPLogger"; -import { onExit } from "../utils/OnExit"; +import { SFDXCommand } from "../SFDXCommand"; -export default class PackageVersionListImpl { - public constructor(private project_directory:string,private devhub_alias: string) {} +export default class PackageVersionListImpl extends SFDXCommand +{ - public async exec(): Promise { - - let command = this.buildExecCommand(); - SFPLogger.log("Executing command",command); - let child = child_process.exec( - command, - { cwd: this.project_directory, encoding: "utf8" } - ); - - child.stderr.on("data", data => { - SFPLogger.log(data); - }); - - let output=""; - child.stdout.on("data", data => { - output+=data; - }); - - await onExit(child); + public constructor( + devhub: string + ) { + super(devhub, null); + } - let result = JSON.parse(output); - if(result.status==0) - { + public async exec(quiet?: boolean): Promise { + let result =JSON.parse( await super.exec(quiet)); return result.result; - } - else - { - throw new Error("Unable to fetch Package Info"); - } - - } - private buildExecCommand(): string { - let command = `npx sfdx force:package:list -v ${this.devhub_alias} --json`; - - return command; + getCommandName(): string { + return "PackageVersionList" } + getGeneratedSFDXCommandWithParams(): string { + return `sfdx force:package:list --json -v ${this.target_org} `; + } + } diff --git a/packages/core/src/sfpcommands/package/CreateUnlockedPackageImpl.ts b/packages/core/src/sfpcommands/package/CreateUnlockedPackageImpl.ts index 503b14df2..bf4649c43 100644 --- a/packages/core/src/sfpcommands/package/CreateUnlockedPackageImpl.ts +++ b/packages/core/src/sfpcommands/package/CreateUnlockedPackageImpl.ts @@ -312,7 +312,6 @@ export default class CreateUnlockedPackageImpl { private async getPackageTypeInfos() { if (CreateUnlockedPackageImpl.packageTypeInfos == null) { CreateUnlockedPackageImpl.packageTypeInfos = await new PackageVersionListImpl( - this.project_directory, this.devhub_alias ).exec(); }