Skip to content

Commit

Permalink
fix: bump mso
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Sep 4, 2024
1 parent 15685e5 commit 4090b48
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 28 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions src/commands/project/delete/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,8 @@ export class Source extends SfCommand<DeleteSourceJson> {
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 });

Expand Down
42 changes: 21 additions & 21 deletions src/utils/deployStages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ function formatProgress(current: number, total: number): string {
}

export class DeployStages {
private ms: MultiStageOutput<Data>;
private mso: MultiStageOutput<Data>;

public constructor({ title, jsonEnabled }: Options) {
this.ms = new MultiStageOutput<Data>({
this.mso = new MultiStageOutput<Data>({
title,
stages: [
'Preparing',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -122,13 +122,13 @@ export class DeployStages {
initialData?: Partial<Data>
): 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>('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();
Expand All @@ -140,59 +140,59 @@ 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),
});
}
});

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<Data>): 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<Data>): void {
this.ms.goto('Done', data);
this.mso.goto('Done', data);
}
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 4090b48

Please sign in to comment.