Skip to content

Commit 75fd0c3

Browse files
committed
feat: use on deploy resume
1 parent c9fc501 commit 75fd0c3

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

src/commands/project/deploy/resume.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77

8-
import ansis from 'ansis';
98
import { EnvironmentVariable, Messages, Org, SfError } from '@salesforce/core';
109
import { SfCommand, toHelpSection, Flags } from '@salesforce/sf-plugins-core';
1110
import { DeployResult, MetadataApiDeploy } from '@salesforce/source-deploy-retrieve';
1211
import { Duration } from '@salesforce/kit';
12+
import { DeployStages } from '../../../utils/deployStages.js';
1313
import { DeployResultFormatter } from '../../../formatters/deployResultFormatter.js';
14-
import { DeployProgress } from '../../../utils/progressBar.js';
1514
import { API, DeployResultJson } from '../../../utils/types.js';
1615
import { buildComponentSet, determineExitCode, executeDeploy, isNotResumable } from '../../../utils/deploy.js';
1716
import { DeployCache } from '../../../utils/deployCache.js';
@@ -124,8 +123,12 @@ export default class DeployMetadataResume extends SfCommand<DeployResultJson> {
124123
jobId
125124
);
126125

127-
this.log(`Deploy ID: ${ansis.bold(jobId)}`);
128-
new DeployProgress(deploy, this.jsonEnabled()).start();
126+
const stages = new DeployStages({
127+
title: 'Resuming Deploy',
128+
jsonEnabled: this.jsonEnabled(),
129+
});
130+
131+
stages.start({ deploy, username: deployOpts['target-org'] });
129132
result = await deploy.pollStatus(500, wait.seconds);
130133

131134
if (!deploy.id) {

src/commands/project/deploy/start.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { DeployVersionData, MetadataApiDeployStatus } from '@salesforce/source-d
1111
import { Duration } from '@salesforce/kit';
1212
import { SfCommand, toHelpSection, Flags } from '@salesforce/sf-plugins-core';
1313
import { SourceConflictError, SourceMemberPollingEvent } from '@salesforce/source-tracking';
14-
import { DeployStages } from '../../../utils/multiStageOutput.js';
14+
import { DeployStages } from '../../../utils/deployStages.js';
1515
import { AsyncDeployResultFormatter } from '../../../formatters/asyncDeployResultFormatter.js';
1616
import { DeployResultFormatter } from '../../../formatters/deployResultFormatter.js';
1717
import { DeployResultJson, TestLevel } from '../../../utils/types.js';
@@ -250,7 +250,7 @@ export default class DeployMetadata extends SfCommand<DeployResultJson> {
250250
throw new SfError('The deploy id is not available.');
251251
}
252252

253-
this.stages.start(username, deploy);
253+
this.stages.start({ username, deploy });
254254

255255
if (flags.async) {
256256
this.stages.done({ status: 'Queued', username });
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type Data = {
2323
status: string;
2424
apiMessage: string;
2525
username: string;
26+
id: string;
2627
};
2728

2829
function round(value: number, precision: number): number {
@@ -64,7 +65,7 @@ export class DeployStages {
6465
},
6566
{
6667
label: 'Deploy ID',
67-
get: (data): string | undefined => data?.mdapiDeploy?.id,
68+
get: (data): string | undefined => data?.id,
6869
type: 'static-key-value',
6970
},
7071
{
@@ -110,10 +111,10 @@ export class DeployStages {
110111
});
111112
}
112113

113-
public start(username: string | undefined, deploy: MetadataApiDeploy): void {
114+
public start({ username, deploy }: { username?: string | undefined; deploy: MetadataApiDeploy }): void {
114115
const lifecycle = Lifecycle.getInstance();
115116

116-
this.ms.goto('Preparing', { username });
117+
this.ms.goto('Preparing', { username, id: deploy.id });
117118

118119
// for sourceMember polling events
119120
lifecycle.on<SourceMemberPollingEvent>('sourceMemberPollingEvent', (event: SourceMemberPollingEvent) =>

0 commit comments

Comments
 (0)