Skip to content

Commit

Permalink
feat: add concise flag to deploy preview
Browse files Browse the repository at this point in the history
  • Loading branch information
k-capehart committed Jan 9, 2024
1 parent 531f5c4 commit 6729b4d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion command-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"command": "project:deploy:preview",
"flagAliases": [],
"flagChars": ["c", "d", "m", "o", "x"],
"flags": ["ignore-conflicts", "json", "manifest", "metadata", "source-dir", "target-org"],
"flags": ["ignore-conflicts", "json", "manifest", "metadata", "source-dir", "target-org", "concise"],
"plugin": "@salesforce/plugin-deploy-retrieve"
},
{
Expand Down
2 changes: 1 addition & 1 deletion messages/deploy.metadata.preview.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ This flag applies only to orgs that allow source tracking. It has no effect on o

# flags.concise.summary

Omit ignored files.
Show only the changes that will be deployed; omits files that are forceignored.

# flags.api-version.summary

Expand Down
6 changes: 5 additions & 1 deletion src/commands/project/deploy/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export default class DeployMetadataPreview extends SfCommand<PreviewResult> {
summary: messages.getMessage('flags.target-org.summary'),
required: true,
}),
concise: Flags.boolean({
summary: messages.getMessage('flags.concise.summary'),
default: false,
}),
};

public async run(): Promise<PreviewResult> {
Expand Down Expand Up @@ -88,7 +92,7 @@ export default class DeployMetadataPreview extends SfCommand<PreviewResult> {
});

if (!this.jsonEnabled()) {
printTables(output, 'deploy');
printTables(output, 'deploy', flags.concise);
}
return output;
}
Expand Down
13 changes: 12 additions & 1 deletion test/nuts/tracking/forceIgnore.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,24 @@ describe('forceignore changes', () => {
expect(pullOutput?.files.length).to.equal(0);
});

it('will not display ignored files with --concise', () => {
it('will not display retrieved ignored files with --concise', () => {
// gets file into source tracking
const output = execCmd<PreviewResult>('project:retrieve:preview --concise', {
ensureExitCode: 0,
}).shellOutput.stdout;
expect(output).to.not.include("These files won't retrieve because they're ignored by your .forceignore file.");
expect(output).to.not.include('ApexClass CreatedClass');
});

it('will not display deployed ignored files with --concise', async () => {
const newForceIgnore = originalForceIgnore + '\n' + `${classdir}/IgnoreTest.cls*`;
await fs.promises.writeFile(path.join(session.project.dir, '.forceignore'), newForceIgnore);

const output = execCmd<DeployResultJson>('deploy:metadata --json', {
ensureExitCode: 0,
}).jsonOutput?.result;
expect(output).to.not.include("These files won't deploy because they're ignored by your .forceignore file.");
expect(output?.status).to.equal('Nothing to deploy');
});
});
});

0 comments on commit 6729b4d

Please sign in to comment.