From 4eaf68fc5872706f1f448b419db099d19d487555 Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Mon, 18 Mar 2024 15:41:29 -0600 Subject: [PATCH 1/4] feat: add --target-org to deploy cancel --- command-snapshot.json | 6 +++--- src/commands/project/deploy/cancel.ts | 12 +++++++++++- test/commands/deploy/metadata/cancel.nut.ts | 8 +++++--- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/command-snapshot.json b/command-snapshot.json index 6a05a526..c74d50a3 100644 --- a/command-snapshot.json +++ b/command-snapshot.json @@ -70,8 +70,8 @@ "alias": ["deploy:metadata:cancel"], "command": "project:deploy:cancel", "flagAliases": [], - "flagChars": ["i", "r", "w"], - "flags": ["async", "job-id", "json", "use-most-recent", "wait"], + "flagChars": ["i", "o", "r", "w"], + "flags": ["async", "job-id", "json", "target-org", "use-most-recent", "wait"], "plugin": "@salesforce/plugin-deploy-retrieve" }, { @@ -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", "concise"], + "flags": ["concise", "ignore-conflicts", "json", "manifest", "metadata", "source-dir", "target-org"], "plugin": "@salesforce/plugin-deploy-retrieve" }, { diff --git a/src/commands/project/deploy/cancel.ts b/src/commands/project/deploy/cancel.ts index 0dfc39af..6c56eac8 100644 --- a/src/commands/project/deploy/cancel.ts +++ b/src/commands/project/deploy/cancel.ts @@ -17,6 +17,7 @@ import { DeployResultJson } from '../../../utils/types.js'; Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); const messages = Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'deploy.metadata.cancel'); +const deployMessages = Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'deploy.metadata'); export default class DeployMetadataCancel extends SfCommand { public static readonly description = messages.getMessage('description'); @@ -26,6 +27,11 @@ export default class DeployMetadataCancel extends SfCommand { public static readonly deprecateAliases = true; public static readonly flags = { + 'target-org': Flags.optionalOrg({ + char: 'o', + description: deployMessages.getMessage('flags.target-org.description'), + summary: deployMessages.getMessage('flags.target-org.summary'), + }), async: Flags.boolean({ summary: messages.getMessage('flags.async.summary'), description: messages.getMessage('flags.async.description'), @@ -63,7 +69,11 @@ export default class DeployMetadataCancel extends SfCommand { const jobId = cache.resolveLatest(flags['use-most-recent'], flags['job-id']); // cancel don't care about your tracking conflicts - const deployOpts = { ...cache.maybeGet(jobId), 'ignore-conflicts': true }; + const deployOpts = { + 'target-org': flags['target-org']?.getUsername(), + ...cache.maybeGet(jobId), + 'ignore-conflicts': true, + }; // we may already know the job finished if ( deployOpts.status && diff --git a/test/commands/deploy/metadata/cancel.nut.ts b/test/commands/deploy/metadata/cancel.nut.ts index f875d007..2e8ecda0 100644 --- a/test/commands/deploy/metadata/cancel.nut.ts +++ b/test/commands/deploy/metadata/cancel.nut.ts @@ -19,7 +19,7 @@ function readDeployCache(sessionDir: string): Record { return JSON.parse(contents) as Record; } -describe('deploy metadata cancel NUTs', () => { +describe.only('deploy metadata cancel NUTs', () => { let session: TestSession; before(async () => { @@ -65,7 +65,7 @@ describe('deploy metadata cancel NUTs', () => { } }); - it.skip('should cancel most recently started deployment without specifying the flag', () => { + it('should cancel most recently started deployment without specifying the flag', () => { const first = execCmd( 'deploy:metadata --source-dir force-app --async --ignore-conflicts --json', { @@ -105,7 +105,9 @@ describe('deploy metadata cancel NUTs', () => { const cacheBefore = readDeployCache(session.dir); expect(cacheBefore).to.have.property(first.id); - const cancel = execCmd(`deploy:metadata:cancel --job-id ${first.id} --json`); + const cancel = execCmd( + `deploy:metadata:cancel --job-id ${first.id} --target-org ${session.orgs.get('default')?.username}--json` + ); assert(cancel.jsonOutput); if (cancel.jsonOutput.status === 0) { From 596c23d7743c0b75679e4a840f8978fbf996a3bc Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Mon, 18 Mar 2024 16:29:55 -0600 Subject: [PATCH 2/4] test: remove .only --- test/commands/deploy/metadata/cancel.nut.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/commands/deploy/metadata/cancel.nut.ts b/test/commands/deploy/metadata/cancel.nut.ts index 2e8ecda0..e2aa3146 100644 --- a/test/commands/deploy/metadata/cancel.nut.ts +++ b/test/commands/deploy/metadata/cancel.nut.ts @@ -19,7 +19,7 @@ function readDeployCache(sessionDir: string): Record { return JSON.parse(contents) as Record; } -describe.only('deploy metadata cancel NUTs', () => { +describe('deploy metadata cancel NUTs', () => { let session: TestSession; before(async () => { @@ -65,7 +65,7 @@ describe.only('deploy metadata cancel NUTs', () => { } }); - it('should cancel most recently started deployment without specifying the flag', () => { + it.skip('should cancel most recently started deployment without specifying the flag', () => { const first = execCmd( 'deploy:metadata --source-dir force-app --async --ignore-conflicts --json', { From 5a0b536f3f88bc1bdd572d3585c1669e07468a02 Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Mon, 18 Mar 2024 17:13:44 -0600 Subject: [PATCH 3/4] chore: whitespace --- test/commands/deploy/metadata/cancel.nut.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/commands/deploy/metadata/cancel.nut.ts b/test/commands/deploy/metadata/cancel.nut.ts index e2aa3146..3f7b497f 100644 --- a/test/commands/deploy/metadata/cancel.nut.ts +++ b/test/commands/deploy/metadata/cancel.nut.ts @@ -106,7 +106,7 @@ describe('deploy metadata cancel NUTs', () => { expect(cacheBefore).to.have.property(first.id); const cancel = execCmd( - `deploy:metadata:cancel --job-id ${first.id} --target-org ${session.orgs.get('default')?.username}--json` + `deploy:metadata:cancel --job-id ${first.id} --target-org ${session.orgs.get('default')?.username} --json` ); assert(cancel.jsonOutput); From e6910d1c79ad4d94bdb69736052e34c34dcb6d04 Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Mon, 25 Mar 2024 10:50:48 -0600 Subject: [PATCH 4/4] chore: build plugin before generating snapshot --- command-snapshot.json | 56 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/command-snapshot.json b/command-snapshot.json index c74d50a3..a10e03cc 100644 --- a/command-snapshot.json +++ b/command-snapshot.json @@ -4,7 +4,17 @@ "command": "project:convert:mdapi", "flagAliases": ["apiversion", "metadatapath", "outputdir", "rootdir"], "flagChars": ["d", "m", "p", "r", "x"], - "flags": ["api-version", "json", "loglevel", "manifest", "metadata", "metadata-dir", "output-dir", "root-dir"], + "flags": [ + "api-version", + "flags-dir", + "json", + "loglevel", + "manifest", + "metadata", + "metadata-dir", + "output-dir", + "root-dir" + ], "plugin": "@salesforce/plugin-deploy-retrieve" }, { @@ -14,6 +24,7 @@ "flagChars": ["d", "m", "n", "p", "r", "x"], "flags": [ "api-version", + "flags-dir", "json", "loglevel", "manifest", @@ -43,6 +54,7 @@ "flags": [ "api-version", "check-only", + "flags-dir", "force-overwrite", "json", "loglevel", @@ -63,7 +75,7 @@ "command": "project:delete:tracking", "flagAliases": ["apiversion", "noprompt", "targetusername", "u"], "flagChars": ["o", "p"], - "flags": ["api-version", "json", "loglevel", "no-prompt", "target-org"], + "flags": ["api-version", "flags-dir", "json", "loglevel", "no-prompt", "target-org"], "plugin": "@salesforce/plugin-deploy-retrieve" }, { @@ -71,7 +83,7 @@ "command": "project:deploy:cancel", "flagAliases": [], "flagChars": ["i", "o", "r", "w"], - "flags": ["async", "job-id", "json", "target-org", "use-most-recent", "wait"], + "flags": ["async", "flags-dir", "job-id", "json", "target-org", "use-most-recent", "wait"], "plugin": "@salesforce/plugin-deploy-retrieve" }, { @@ -79,7 +91,7 @@ "command": "project:deploy:preview", "flagAliases": [], "flagChars": ["c", "d", "m", "o", "x"], - "flags": ["concise", "ignore-conflicts", "json", "manifest", "metadata", "source-dir", "target-org"], + "flags": ["concise", "flags-dir", "ignore-conflicts", "json", "manifest", "metadata", "source-dir", "target-org"], "plugin": "@salesforce/plugin-deploy-retrieve" }, { @@ -87,7 +99,18 @@ "command": "project:deploy:quick", "flagAliases": [], "flagChars": ["a", "i", "o", "r", "w"], - "flags": ["api-version", "async", "concise", "job-id", "json", "target-org", "use-most-recent", "verbose", "wait"], + "flags": [ + "api-version", + "async", + "concise", + "flags-dir", + "job-id", + "json", + "target-org", + "use-most-recent", + "verbose", + "wait" + ], "plugin": "@salesforce/plugin-deploy-retrieve" }, { @@ -95,7 +118,17 @@ "command": "project:deploy:report", "flagAliases": [], "flagChars": ["i", "o", "r", "w"], - "flags": ["coverage-formatters", "job-id", "json", "junit", "results-dir", "target-org", "use-most-recent", "wait"], + "flags": [ + "coverage-formatters", + "flags-dir", + "job-id", + "json", + "junit", + "results-dir", + "target-org", + "use-most-recent", + "wait" + ], "plugin": "@salesforce/plugin-deploy-retrieve" }, { @@ -106,6 +139,7 @@ "flags": [ "concise", "coverage-formatters", + "flags-dir", "job-id", "json", "junit", @@ -127,6 +161,7 @@ "concise", "coverage-formatters", "dry-run", + "flags-dir", "ignore-conflicts", "ignore-errors", "ignore-warnings", @@ -159,6 +194,7 @@ "async", "concise", "coverage-formatters", + "flags-dir", "ignore-warnings", "json", "junit", @@ -195,6 +231,7 @@ "flagChars": ["c", "d", "m", "n", "p", "t"], "flags": [ "api-version", + "flags-dir", "from-org", "include-packages", "json", @@ -212,7 +249,7 @@ "command": "project:list:ignored", "flagAliases": ["sourcepath"], "flagChars": ["p"], - "flags": ["json", "source-dir"], + "flags": ["flags-dir", "json", "source-dir"], "plugin": "@salesforce/plugin-deploy-retrieve" }, { @@ -220,7 +257,7 @@ "command": "project:reset:tracking", "flagAliases": ["apiversion", "noprompt", "targetusername", "u"], "flagChars": ["o", "p", "r"], - "flags": ["api-version", "json", "loglevel", "no-prompt", "revision", "target-org"], + "flags": ["api-version", "flags-dir", "json", "loglevel", "no-prompt", "revision", "target-org"], "plugin": "@salesforce/plugin-deploy-retrieve" }, { @@ -228,7 +265,7 @@ "command": "project:retrieve:preview", "flagAliases": [], "flagChars": ["c", "o"], - "flags": ["concise", "ignore-conflicts", "json", "target-org"], + "flags": ["concise", "flags-dir", "ignore-conflicts", "json", "target-org"], "plugin": "@salesforce/plugin-deploy-retrieve" }, { @@ -238,6 +275,7 @@ "flagChars": ["a", "c", "d", "m", "n", "o", "r", "t", "w", "x", "z"], "flags": [ "api-version", + "flags-dir", "ignore-conflicts", "json", "manifest",