Skip to content

Commit f992f4c

Browse files
authored
Merge pull request #550 from salesforcecli/sm/no-wildcards-in-preview
Sm/no-wildcards-in-preview
2 parents 6d7c243 + 6660e28 commit f992f4c

File tree

6 files changed

+40
-22
lines changed

6 files changed

+40
-22
lines changed

src/commands/project/deploy/resume.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ export default class DeployMetadataResume extends SfCommand<DeployResultJson> {
8181
const [{ flags }, cache] = await Promise.all([this.parse(DeployMetadataResume), DeployCache.create()]);
8282
const jobId = cache.resolveLatest(flags['use-most-recent'], flags['job-id']);
8383

84-
const deployOpts = cache.get(jobId);
84+
// if it was async before, then it should not be async now.
85+
const deployOpts = { ...cache.get(jobId), async: false };
8586

8687
if (isNotResumable(deployOpts.status)) {
8788
throw messages.createError('error.DeployNotResumable', [jobId, deployOpts.status]);

src/commands/project/deploy/validate.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,15 @@ export default class DeployMetadataValidate extends SfCommand<DeployResultJson>
135135

136136
this.log(getVersionMessage('Validating Deployment', componentSet, api));
137137
this.log(`Deploy ID: ${bold(deploy.id)}`);
138-
new DeployProgress(deploy, this.jsonEnabled()).start();
139138

140139
if (flags.async) {
141140
const asyncFormatter = new AsyncDeployResultFormatter(deploy.id);
142141
if (!this.jsonEnabled()) asyncFormatter.display();
143142
return asyncFormatter.getJson();
144143
}
145144

145+
new DeployProgress(deploy, this.jsonEnabled()).start();
146+
146147
const result = await deploy.pollStatus(500, flags.wait?.seconds);
147148
process.exitCode = determineExitCode(result);
148149
const formatter = new DeployResultFormatter(result, flags);

src/formatters/deployResultFormatter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export class DeployResultFormatter implements Formatter<DeployResultJson> {
219219
type: { header: 'Type' },
220220
filePath: { header: 'Path' },
221221
};
222-
const title = 'Deployed Source';
222+
const title = this.result.response.checkOnly ? 'Validated Source' : 'Deployed Source';
223223
const options = { title: tableHeader(title) };
224224
ux.log();
225225

src/utils/previewOutput.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ export const compileResults = ({
143143
};
144144

145145
const actionableFiles = componentSet
146+
.filter((f) => f.fullName !== '*')
146147
.toArray()
147148
.map((c) => sourceBackedComponents.get(makeKey(c)) ?? c)
148149
.map((cmp): PreviewFile => {

src/utils/progressBar.ts

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import { envVars as env, EnvironmentVariable } from '@salesforce/core';
9-
import { MetadataApiDeploy } from '@salesforce/source-deploy-retrieve';
9+
import { MetadataApiDeploy, MetadataApiDeployStatus } from '@salesforce/source-deploy-retrieve';
1010
import { Messages } from '@salesforce/core';
1111
import { Progress } from '@salesforce/sf-plugins-core';
1212

@@ -28,25 +28,14 @@ export class DeployProgress extends Progress {
2828

2929
public start(): void {
3030
super.start(0, { status: 'Waiting' }, DeployProgress.OPTIONS);
31-
this.deploy.onUpdate((data) => {
32-
// the numCompTot. isn't computed right away, wait to start until we know how many we have
33-
if (data.numberComponentsTotal) {
34-
this.setTotal(data.numberComponentsTotal + data.numberTestsTotal);
35-
this.update(data.numberComponentsDeployed + data.numberTestsCompleted, {
36-
status: mdTrasferMessages.getMessage(data.status),
37-
});
38-
} else {
39-
this.update(0, { status: mdTrasferMessages.getMessage(data.status) ?? 'Waiting' });
40-
}
41-
42-
// the numTestsTot. isn't computed until validated as tests by the server, update the PB once we know
43-
if (data.numberTestsTotal && data.numberComponentsTotal) {
44-
this.setTotal(data.numberComponentsTotal + data.numberTestsTotal);
45-
}
46-
});
4731

48-
// any thing else should stop the progress bar
49-
this.deploy.onFinish((data) => this.finish({ status: mdTrasferMessages.getMessage(data.response.status) }));
32+
this.deploy.onUpdate((data) => this.updateProgress(data));
33+
34+
// any thing else should make one final update, then stop the progress bar
35+
this.deploy.onFinish((data) => {
36+
this.updateProgress(data.response);
37+
this.finish({ status: mdTrasferMessages.getMessage(data.response.status) });
38+
});
5039

5140
this.deploy.onCancel(() => this.stop());
5241

@@ -55,4 +44,21 @@ export class DeployProgress extends Progress {
5544
throw error;
5645
});
5746
}
47+
48+
private updateProgress(data: MetadataApiDeployStatus): void {
49+
// the numCompTot. isn't computed right away, wait to start until we know how many we have
50+
if (data.numberComponentsTotal) {
51+
this.setTotal(data.numberComponentsTotal + data.numberTestsTotal);
52+
this.update(data.numberComponentsDeployed + data.numberTestsCompleted, {
53+
status: mdTrasferMessages.getMessage(data.status),
54+
});
55+
} else {
56+
this.update(0, { status: mdTrasferMessages.getMessage(data.status) ?? 'Waiting' });
57+
}
58+
59+
// the numTestsTot. isn't computed until validated as tests by the server, update the PB once we know
60+
if (data.numberTestsTotal && data.numberComponentsTotal) {
61+
this.setTotal(data.numberComponentsTotal + data.numberTestsTotal);
62+
}
63+
}
5864
}

test/nuts/tracking/basics.nut.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ describe('end-to-end-test for tracking with an org (single packageDir)', () => {
6464
expect(response.toDeploy.every((row) => row.type && row.fullName)).to.equal(true);
6565
expect(response.conflicts).to.be.an.instanceof(Array).with.length(0);
6666
});
67+
it('includes no wildcard entries', () => {
68+
const response = execCmd<PreviewResult>('deploy metadata preview --metadata ApexClass --json', {
69+
ensureExitCode: 0,
70+
}).jsonOutput?.result;
71+
assert(response);
72+
assert(Array.isArray(response.toDeploy));
73+
// the fields should be populated
74+
expect(response.toDeploy.every((row) => row.fullName !== '*')).to.equal(true);
75+
});
6776
it('pushes the initial metadata to the org', () => {
6877
const resp = execCmd<DeployResultJson>('deploy metadata --json');
6978
expect(resp.jsonOutput?.status, JSON.stringify(resp)).to.equal(0);

0 commit comments

Comments
 (0)