Skip to content

Commit e9ca2fe

Browse files
committed
fix: fixed handling of wait in the formatter
1 parent 7eed027 commit e9ca2fe

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/commands/project/deploy/report.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export default class DeployMetadataReport extends SfCommand<DeployResultJson> {
7474
const jobId = cache.resolveLatest(flags['use-most-recent'], flags['job-id'], false);
7575

7676
const deployOpts = cache.get(jobId) ?? {};
77-
const waitDuration = flags['wait'];
77+
const wait = flags['wait'];
7878
const org = flags['target-org'] ?? (await Org.create({ aliasOrUsername: deployOpts['target-org'] }));
7979

8080
// if we're using mdapi we won't have a component set
@@ -85,12 +85,12 @@ export default class DeployMetadataReport extends SfCommand<DeployResultJson> {
8585
try {
8686
this.project = await SfProject.resolve();
8787
const sourcepath = this.project.getUniquePackageDirectories().map((pDir) => pDir.fullPath);
88-
componentSet = await buildComponentSet({ 'source-dir': sourcepath, wait: waitDuration });
88+
componentSet = await buildComponentSet({ 'source-dir': sourcepath, wait });
8989
} catch (err) {
9090
// ignore the error. this was just to get improved command output.
9191
}
9292
} else {
93-
componentSet = await buildComponentSet({ ...deployOpts, wait: waitDuration });
93+
componentSet = await buildComponentSet({ ...deployOpts, wait });
9494
}
9595
}
9696
const mdapiDeploy = new MetadataApiDeploy({
@@ -117,11 +117,11 @@ export default class DeployMetadataReport extends SfCommand<DeployResultJson> {
117117
};
118118

119119
let result: DeployResult;
120-
if (waitDuration) {
120+
if (wait) {
121121
// poll for deploy results
122122
try {
123123
new DeployProgress(mdapiDeploy, this.jsonEnabled()).start();
124-
result = await mdapiDeploy.pollStatus(500, waitDuration.seconds);
124+
result = await mdapiDeploy.pollStatus(500, wait.seconds);
125125
} catch (error) {
126126
if (error instanceof Error && error.message.includes('The client has timed out')) {
127127
this.debug('[project deploy report] polling timed out. Requesting status...');

src/formatters/deployReportResultFormatter.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import { ux } from '@oclif/core';
88
import { RequestStatus } from '@salesforce/source-deploy-retrieve';
99
import { StandardColors } from '@salesforce/sf-plugins-core';
10+
import { Duration } from '@salesforce/kit';
1011
import { tableHeader } from '../utils/output';
1112
import { DeployResultFormatter } from './deployResultFormatter';
1213

@@ -38,8 +39,9 @@ export class DeployReportResultFormatter extends DeployResultFormatter {
3839
if (key === 'target-org') {
3940
return result.concat({ key: 'target-org', value: this.flags['target-org']?.getUsername() });
4041
}
41-
if (key === 'wait') {
42-
return result.concat({ key: 'wait', value: `${this.flags['wait']?.quantity} minutes` });
42+
if (key === 'wait' && this.flags['wait']) {
43+
const wait = this.flags['wait'] instanceof Duration ? this.flags['wait'].quantity : this.flags['wait'];
44+
return result.concat({ key: 'wait', value: `${wait} minutes` });
4345
}
4446
return result.concat({ key, value });
4547
}, []);

src/formatters/deployResultFormatter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class DeployResultFormatter extends TestResultsFormatter implements Forma
4545
junit: boolean;
4646
'results-dir': string;
4747
'target-org': Org;
48-
wait: Duration;
48+
wait: Duration | number;
4949
}>
5050
) {
5151
super(result, flags);

0 commit comments

Comments
 (0)