Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add concise flag to deploy preview #873

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
});
});
});
Loading