diff --git a/package.json b/package.json index 79aef4b4..56081088 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "bugs": "https://github.com/forcedotcom/cli/issues", "dependencies": { "@oclif/core": "^4.0.17", - "@oclif/multi-stage-output": "^0.4.1-dev.0", + "@oclif/multi-stage-output": "^0.4.3-dev.0", "@salesforce/apex-node": "^8.1.3", "@salesforce/core": "^8.4.0", "@salesforce/kit": "^3.2.1", diff --git a/src/commands/project/delete/source.ts b/src/commands/project/delete/source.ts index 966a19d4..103cc03d 100644 --- a/src/commands/project/delete/source.ts +++ b/src/commands/project/delete/source.ts @@ -266,9 +266,8 @@ export class Source extends SfCommand { stages.start({ deploy, username: this.org.getUsername() }); this.deployResult = await deploy.pollStatus({ timeout: this.flags.wait }); if (!deploy.id) { - const err = new SfError('The deploy id is not available.'); stages.error(); - throw err; + throw new SfError('The deploy id is not available.'); } await DeployCache.update(deploy.id, { status: this.deployResult.response.status }); diff --git a/src/utils/deployStages.ts b/src/utils/deployStages.ts index b5a70aed..04760959 100644 --- a/src/utils/deployStages.ts +++ b/src/utils/deployStages.ts @@ -40,10 +40,10 @@ function formatProgress(current: number, total: number): string { } export class DeployStages { - private ms: MultiStageOutput; + private mso: MultiStageOutput; public constructor({ title, jsonEnabled }: Options) { - this.ms = new MultiStageOutput({ + this.mso = new MultiStageOutput({ title, stages: [ 'Preparing', @@ -71,7 +71,7 @@ export class DeployStages { label: 'Deploy ID', get: (data): string | undefined => data?.id, type: 'static-key-value', - // neverCollapse: true, + neverCollapse: true, }, { label: 'Target Org', @@ -122,13 +122,13 @@ export class DeployStages { initialData?: Partial ): void { const lifecycle = Lifecycle.getInstance(); - if (initialData) this.ms.updateData(initialData); - this.ms.skipTo('Preparing', { username, id: deploy.id }); + if (initialData) this.mso.updateData(initialData); + this.mso.skipTo('Preparing', { username, id: deploy.id }); // for sourceMember polling events lifecycle.on('sourceMemberPollingEvent', (event: SourceMemberPollingEvent) => { if (event.original > 0) { - return Promise.resolve(this.ms.skipTo('Updating Source Tracking', { sourceMemberPolling: event })); + return Promise.resolve(this.mso.skipTo('Updating Source Tracking', { sourceMemberPolling: event })); } return Promise.resolve(); @@ -140,14 +140,14 @@ export class DeployStages { data.numberTestsTotal > 0 && data.numberComponentsDeployed > 0 ) { - this.ms.skipTo('Running Tests', { mdapiDeploy: data, status: mdTransferMessages.getMessage(data?.status) }); + this.mso.skipTo('Running Tests', { mdapiDeploy: data, status: mdTransferMessages.getMessage(data?.status) }); } else if (data.status === RequestStatus.Pending) { - this.ms.skipTo('Waiting for the org to respond', { + this.mso.skipTo('Waiting for the org to respond', { mdapiDeploy: data, status: mdTransferMessages.getMessage(data?.status), }); } else { - this.ms.skipTo('Deploying Metadata', { + this.mso.skipTo('Deploying Metadata', { mdapiDeploy: data, status: mdTransferMessages.getMessage(data?.status), }); @@ -155,44 +155,44 @@ export class DeployStages { }); deploy.onFinish((data) => { - this.ms.updateData({ mdapiDeploy: data.response, status: mdTransferMessages.getMessage(data.response.status) }); + this.mso.updateData({ mdapiDeploy: data.response, status: mdTransferMessages.getMessage(data.response.status) }); if (data.response.status === RequestStatus.Failed) { - this.ms.error(); + this.mso.error(); } else { - this.ms.skipTo('Done'); - this.ms.stop(); + this.mso.skipTo('Done'); + this.mso.stop(); } }); deploy.onCancel((data) => { - this.ms.updateData({ mdapiDeploy: data, status: mdTransferMessages.getMessage(data?.status ?? 'Canceled') }); + this.mso.updateData({ mdapiDeploy: data, status: mdTransferMessages.getMessage(data?.status ?? 'Canceled') }); - this.ms.error(); + this.mso.error(); }); deploy.onError((error: Error) => { if (error.message.includes('client has timed out')) { - this.ms.updateData({ status: 'Client Timeout' }); + this.mso.updateData({ status: 'Client Timeout' }); } - this.ms.error(); + this.mso.error(); throw error; }); } public update(data: Partial): void { - this.ms.updateData(data); + this.mso.updateData(data); } public stop(): void { - this.ms.stop(); + this.mso.stop(); } public error(): void { - this.ms.error(); + this.mso.error(); } public done(data?: Partial): void { - this.ms.goto('Done', data); + this.mso.goto('Done', data); } } diff --git a/yarn.lock b/yarn.lock index 5d4b3aa2..9aaffa3c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1528,10 +1528,10 @@ wordwrap "^1.0.0" wrap-ansi "^7.0.0" -"@oclif/multi-stage-output@^0.4.1-dev.0": - version "0.4.2" - resolved "https://registry.yarnpkg.com/@oclif/multi-stage-output/-/multi-stage-output-0.4.2.tgz#2a2b9e46b828ed72775cc7616db97e48aacfab7c" - integrity sha512-wS+58pirRbXc34xTJjXsX/MjQHWa/P2B/tYe/5USfpW8Yj2l07rcFVeJwbh/NnuYb8JkGvqGYi/fP+0I4FKwow== +"@oclif/multi-stage-output@^0.4.3-dev.0": + version "0.4.3-dev.0" + resolved "https://registry.yarnpkg.com/@oclif/multi-stage-output/-/multi-stage-output-0.4.3-dev.0.tgz#787719a9cc4afa07348f422786fffaec555a3620" + integrity sha512-lHMR5baHpQcv2bCCvx5rczWFUpSqlVs4W7vUcZFTVUcKf1Ig6h6ekcWVtNilsWdl3NS4Pt7dMHLDHV0ah9aMlw== dependencies: "@oclif/core" "^4" "@types/react" "^18.3.5"