From 15685e540f801d377a3b0f0718b650e455f6958e Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Wed, 4 Sep 2024 09:10:46 -0600 Subject: [PATCH] fix: bump mso --- package.json | 2 +- src/commands/project/delete/source.ts | 2 +- src/commands/project/deploy/start.ts | 2 +- src/commands/project/retrieve/start.ts | 8 +++--- src/utils/deployStages.ts | 36 ++++++++++++++++---------- yarn.lock | 18 ++++++------- 6 files changed, 39 insertions(+), 29 deletions(-) diff --git a/package.json b/package.json index 4c776a53e..79aef4b49 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.3.0", + "@oclif/multi-stage-output": "^0.4.1-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 20a8b063f..966a19d4c 100644 --- a/src/commands/project/delete/source.ts +++ b/src/commands/project/delete/source.ts @@ -267,7 +267,7 @@ export class Source extends SfCommand { this.deployResult = await deploy.pollStatus({ timeout: this.flags.wait }); if (!deploy.id) { const err = new SfError('The deploy id is not available.'); - stages.stop(err); + stages.error(); throw err; } await DeployCache.update(deploy.id, { status: this.deployResult.response.status }); diff --git a/src/commands/project/deploy/start.ts b/src/commands/project/deploy/start.ts index fefc9deab..6001ef21a 100644 --- a/src/commands/project/deploy/start.ts +++ b/src/commands/project/deploy/start.ts @@ -279,7 +279,7 @@ export default class DeployMetadata extends SfCommand { if (error instanceof SourceConflictError && error.data) { if (!this.jsonEnabled()) { this.stages?.update({ status: 'Failed' }); - this.stages?.stop(error); + this.stages?.error(); writeConflictTable(error.data); // set the message and add plugin-specific actions return super.catch({ diff --git a/src/commands/project/retrieve/start.ts b/src/commands/project/retrieve/start.ts index 47018a1d4..1efca178a 100644 --- a/src/commands/project/retrieve/start.ts +++ b/src/commands/project/retrieve/start.ts @@ -235,14 +235,14 @@ export default class RetrieveMetadata extends SfCommand { }); retrieve.onCancel((data) => { this.ms.updateData({ status: mdTransferMessages.getMessage(data?.status ?? 'Canceled') }); - this.ms.stop(new Error('Retrieve canceled')); + this.ms.error(); }); retrieve.onError((error: Error) => { if (error.message.includes('client has timed out')) { this.ms.updateData({ status: 'Client Timeout' }); } - this.ms.stop(error); + this.ms.error(); throw error; }); @@ -301,7 +301,7 @@ export default class RetrieveMetadata extends SfCommand { protected catch(error: Error | SfError): Promise { if (!this.jsonEnabled() && error instanceof SourceConflictError && error.data) { this.ms.updateData({ status: 'Failed' }); - this.ms.stop(error); + this.ms.error(); writeConflictTable(error.data); // set the message and add plugin-specific actions return super.catch({ @@ -310,7 +310,7 @@ export default class RetrieveMetadata extends SfCommand { actions: messages.getMessages('error.Conflicts.Actions'), }); } else { - this.ms.stop(error); + this.ms.error(); } return super.catch(error); diff --git a/src/utils/deployStages.ts b/src/utils/deployStages.ts index b51ff4aca..b5a70aeda 100644 --- a/src/utils/deployStages.ts +++ b/src/utils/deployStages.ts @@ -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', @@ -105,7 +105,10 @@ export class DeployStages { label: 'Members', get: (data): string | undefined => data?.sourceMemberPolling?.original - ? formatProgress(data.sourceMemberPolling.remaining, data.sourceMemberPolling.original) + ? formatProgress( + data.sourceMemberPolling.original - data.sourceMemberPolling.remaining, + data.sourceMemberPolling.original + ) : undefined, stage: 'Updating Source Tracking', type: 'dynamic-key-value', @@ -120,12 +123,12 @@ export class DeployStages { ): void { const lifecycle = Lifecycle.getInstance(); if (initialData) this.ms.updateData(initialData); - this.ms.goto('Preparing', { username, id: deploy.id }); + this.ms.skipTo('Preparing', { username, id: deploy.id }); // for sourceMember polling events lifecycle.on('sourceMemberPollingEvent', (event: SourceMemberPollingEvent) => { if (event.original > 0) { - return Promise.resolve(this.ms.goto('Updating Source Tracking', { sourceMemberPolling: event })); + return Promise.resolve(this.ms.skipTo('Updating Source Tracking', { sourceMemberPolling: event })); } return Promise.resolve(); @@ -137,23 +140,26 @@ export class DeployStages { data.numberTestsTotal > 0 && data.numberComponentsDeployed > 0 ) { - this.ms.goto('Running Tests', { mdapiDeploy: data, status: mdTransferMessages.getMessage(data?.status) }); + this.ms.skipTo('Running Tests', { mdapiDeploy: data, status: mdTransferMessages.getMessage(data?.status) }); } else if (data.status === RequestStatus.Pending) { - this.ms.goto('Waiting for the org to respond', { + this.ms.skipTo('Waiting for the org to respond', { mdapiDeploy: data, status: mdTransferMessages.getMessage(data?.status), }); } else { - this.ms.goto('Deploying Metadata', { mdapiDeploy: data, status: mdTransferMessages.getMessage(data?.status) }); + this.ms.skipTo('Deploying Metadata', { + mdapiDeploy: data, + status: mdTransferMessages.getMessage(data?.status), + }); } }); deploy.onFinish((data) => { this.ms.updateData({ mdapiDeploy: data.response, status: mdTransferMessages.getMessage(data.response.status) }); if (data.response.status === RequestStatus.Failed) { - this.ms.stop(new Error('Failed to deploy metadata')); + this.ms.error(); } else { - this.ms.goto('Done'); + this.ms.skipTo('Done'); this.ms.stop(); } }); @@ -161,7 +167,7 @@ export class DeployStages { deploy.onCancel((data) => { this.ms.updateData({ mdapiDeploy: data, status: mdTransferMessages.getMessage(data?.status ?? 'Canceled') }); - this.ms.stop(new Error('Deploy canceled')); + this.ms.error(); }); deploy.onError((error: Error) => { @@ -169,7 +175,7 @@ export class DeployStages { this.ms.updateData({ status: 'Client Timeout' }); } - this.ms.stop(error); + this.ms.error(); throw error; }); } @@ -178,8 +184,12 @@ export class DeployStages { this.ms.updateData(data); } - public stop(error?: Error): void { - this.ms.stop(error); + public stop(): void { + this.ms.stop(); + } + + public error(): void { + this.ms.error(); } public done(data?: Partial): void { diff --git a/yarn.lock b/yarn.lock index bc4ec6bbf..5d4b3aa2b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1528,13 +1528,13 @@ wordwrap "^1.0.0" wrap-ansi "^7.0.0" -"@oclif/multi-stage-output@^0.3.0": - version "0.3.0" - resolved "https://registry.yarnpkg.com/@oclif/multi-stage-output/-/multi-stage-output-0.3.0.tgz#2d74763bd2215c61ec1cd53faf3138328d50122d" - integrity sha512-7pMD3CoXfS9/hEWzZ1b8GZb3leSNWENsMJS7uYTX0XqTXlrzh+eYvFHYcJh9bEkIw67LKjFfGGIwXbotdhtZKg== +"@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== dependencies: "@oclif/core" "^4" - "@types/react" "^18.3.3" + "@types/react" "^18.3.5" change-case "^5.4.4" cli-spinners "^2" figures "^6.1.0" @@ -2581,10 +2581,10 @@ resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.12.tgz#12bb1e2be27293c1406acb6af1c3f3a1481d98c6" integrity sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q== -"@types/react@^18.3.3": - version "18.3.3" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.3.tgz#9679020895318b0915d7a3ab004d92d33375c45f" - integrity sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw== +"@types/react@^18.3.5": + version "18.3.5" + resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.5.tgz#5f524c2ad2089c0ff372bbdabc77ca2c4dbadf8f" + integrity sha512-WeqMfGJLGuLCqHGYRGHxnKrXcTitc6L/nBUWfWPcTarG3t9PsquqUMuVeXZeca+mglY4Vo5GZjCi0A3Or2lnxA== dependencies: "@types/prop-types" "*" csstype "^3.0.2"