From 6729b4db6f43a9a2940577baa4687b87c8c659db Mon Sep 17 00:00:00 2001 From: "Kyle Capehart (Huntersville)" Date: Tue, 9 Jan 2024 09:55:06 -0500 Subject: [PATCH 1/2] feat: add concise flag to deploy preview --- command-snapshot.json | 2 +- messages/deploy.metadata.preview.md | 2 +- src/commands/project/deploy/preview.ts | 6 +++++- test/nuts/tracking/forceIgnore.nut.ts | 13 ++++++++++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/command-snapshot.json b/command-snapshot.json index fe02daf2..6a05a526 100644 --- a/command-snapshot.json +++ b/command-snapshot.json @@ -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" }, { diff --git a/messages/deploy.metadata.preview.md b/messages/deploy.metadata.preview.md index f9164008..5dfa3c49 100644 --- a/messages/deploy.metadata.preview.md +++ b/messages/deploy.metadata.preview.md @@ -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 diff --git a/src/commands/project/deploy/preview.ts b/src/commands/project/deploy/preview.ts index d39afcec..14048e4d 100644 --- a/src/commands/project/deploy/preview.ts +++ b/src/commands/project/deploy/preview.ts @@ -58,6 +58,10 @@ export default class DeployMetadataPreview extends SfCommand { summary: messages.getMessage('flags.target-org.summary'), required: true, }), + concise: Flags.boolean({ + summary: messages.getMessage('flags.concise.summary'), + default: false, + }), }; public async run(): Promise { @@ -88,7 +92,7 @@ export default class DeployMetadataPreview extends SfCommand { }); if (!this.jsonEnabled()) { - printTables(output, 'deploy'); + printTables(output, 'deploy', flags.concise); } return output; } diff --git a/test/nuts/tracking/forceIgnore.nut.ts b/test/nuts/tracking/forceIgnore.nut.ts index 35e2de16..8c739ebd 100644 --- a/test/nuts/tracking/forceIgnore.nut.ts +++ b/test/nuts/tracking/forceIgnore.nut.ts @@ -193,7 +193,7 @@ 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('project:retrieve:preview --concise', { ensureExitCode: 0, @@ -201,5 +201,16 @@ describe('forceignore changes', () => { 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('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'); + }); }); }); From 20cee7b63921da59a9f3c5d359bd2060ce2b3f82 Mon Sep 17 00:00:00 2001 From: Steve Hetzel Date: Tue, 16 Jan 2024 14:32:56 -0700 Subject: [PATCH 2/2] fix: correct test to match fix --- test/nuts/tracking/forceIgnore.nut.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/nuts/tracking/forceIgnore.nut.ts b/test/nuts/tracking/forceIgnore.nut.ts index 8c739ebd..5a47d049 100644 --- a/test/nuts/tracking/forceIgnore.nut.ts +++ b/test/nuts/tracking/forceIgnore.nut.ts @@ -206,11 +206,13 @@ describe('forceignore changes', () => { const newForceIgnore = originalForceIgnore + '\n' + `${classdir}/IgnoreTest.cls*`; await fs.promises.writeFile(path.join(session.project.dir, '.forceignore'), newForceIgnore); - const output = execCmd('deploy:metadata --json', { + const output = execCmd(`project:deploy:preview -d ${classdir} --concise`, { ensureExitCode: 0, - }).jsonOutput?.result; + }).shellOutput.stdout; + expect(output).to.include('Will Deploy [1] files.'); + expect(output).to.include('ApexClass UnIgnoreTest'); 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'); + expect(output).to.not.include('ApexClass IgnoreTest'); }); }); });