From 2f74ed2b23fc2980379626cc24ad8ecf85accd70 Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Fri, 14 Jun 2024 13:18:16 -0600 Subject: [PATCH] feat: create/consume branch flag to filter PVL --- command-snapshot.json | 3 ++- messages/package_version_list.md | 4 ++++ package.json | 2 +- src/commands/package/version/list.ts | 13 +++++++++---- test/commands/package/packageVersion.nut.ts | 14 +++++++++++--- yarn.lock | 11 ++++++----- 6 files changed, 33 insertions(+), 14 deletions(-) diff --git a/command-snapshot.json b/command-snapshot.json index ec872615..4dea076f 100644 --- a/command-snapshot.json +++ b/command-snapshot.json @@ -323,9 +323,10 @@ "target-hub-org", "targetdevhubusername" ], - "flagChars": ["c", "m", "o", "p", "r", "v"], + "flagChars": ["b", "c", "m", "o", "p", "r", "v"], "flags": [ "api-version", + "branch", "concise", "created-last-days", "flags-dir", diff --git a/messages/package_version_list.md b/messages/package_version_list.md index dfa83033..ce3a1c4f 100644 --- a/messages/package_version_list.md +++ b/messages/package_version_list.md @@ -12,6 +12,10 @@ All filter parameters are applied using the AND logical operator (not OR). Display limited package version details. +# flags.branch.summary + +Use to filter the results to a specific branch + # flags.packages.summary Comma-delimited list of packages (aliases or 0Ho IDs) to list. diff --git a/package.json b/package.json index 06417d34..cf6f5dc2 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "bugs": "https://github.com/forcedotcom/cli/issues", "dependencies": { "@oclif/core": "^4", - "@salesforce/core": "^7.3.8", + "@salesforce/core": "^7.4.0", "@salesforce/kit": "^3.1.0", "@salesforce/packaging": "^3.5.16", "@salesforce/sf-plugins-core": "^10.0.0", diff --git a/src/commands/package/version/list.ts b/src/commands/package/version/list.ts index d14c59d7..6abfc417 100644 --- a/src/commands/package/version/list.ts +++ b/src/commands/package/version/list.ts @@ -85,6 +85,10 @@ export class PackageVersionListCommand extends SfCommand { const ids = [record.Id, record.SubscriberPackageVersionId]; - const aliases: string[] = ids.map((id) => project.getAliasesFromPackageId(id)).flat(); + const aliases = ids.map((id) => project.getAliasesFromPackageId(id)).flat(); const AliasStr = aliases.length > 0 ? aliases.join() : ''; // set Ancestor display values diff --git a/test/commands/package/packageVersion.nut.ts b/test/commands/package/packageVersion.nut.ts index d9280282..fbcc1ee4 100644 --- a/test/commands/package/packageVersion.nut.ts +++ b/test/commands/package/packageVersion.nut.ts @@ -71,11 +71,9 @@ describe('package:version:*', () => { describe('package:version:create', () => { it('should create a new package version (human)', () => { const result = execCmd( - `package:version:create --package ${pkgName} -x --code-coverage --version-description "Initial version"`, + `package:version:create --package ${pkgName} -x --code-coverage --version-description "Initial version" --branch testing`, { ensureExitCode: 0 } ).shellOutput.stdout; - // eslint-disable-next-line no-console - console.log(result); expect(result).to.include("Package version creation request status is '"); expect(result).to.match(/Run "sfd?x? package:version:create:report -i 08c.{15}" to query for status\./); }); @@ -286,6 +284,16 @@ describe('package:version:*', () => { /Package Name\s+Namespace\s+Version Name\s+Version\s+Subscriber Package Version Id\sAlias\s+Installation Key\s+Released\s+Validation Skipped\s+Ancestor\s+Ancestor Version\s+Branch\s+Package Id\s+Installation URL\s+Package Version Id\s+Created Date\s+Last Modified Date\s+Tag\s+Description\s+Code Coverage\s+Code Coverage Met\s+Converted From Version Id\s+Org-Dependent\s+Unlocked Package\s+Release\s+Version\s+Build Duration in Seconds\s+Managed Metadata Removed\s+Created By/ ); }); + + it("should list installed packages in dev hub - verbose human readable results only on the 'testing' branch", () => { + const command = `package:version:list -v ${session.hubOrg.username} --verbose --branch testing`; + const output = execCmd(command, { ensureExitCode: 0 }).shellOutput.stdout; + expect(output).to.contain('=== Package Versions ['); + expect(output).to.match( + /Package Name\s+Namespace\s+Version Name\s+Version\s+Subscriber Package Version Id\sAlias\s+Installation Key\s+Released\s+Validation Skipped\s+Ancestor\s+Ancestor Version\s+Branch\s+Package Id\s+Installation URL\s+Package Version Id\s+Created Date\s+Last Modified Date\s+Tag\s+Description\s+Code Coverage\s+Code Coverage Met\s+Converted From Version Id\s+Org-Dependent\s+Unlocked Package\s+Release\s+Version\s+Build Duration in Seconds\s+Managed Metadata Removed\s+Created By/ + ); + expect(output).to.include('testing'); + }); it('should list package versions in dev hub - json results', () => { const command = `package:version:list -v ${session.hubOrg.username} --json`; const output = execCmd<[PackageVersionListCommandResult]>(command, { ensureExitCode: 0 }).jsonOutput?.result; diff --git a/yarn.lock b/yarn.lock index 33cd1436..714219c7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1478,17 +1478,18 @@ strip-ansi "6.0.1" ts-retry-promise "^0.8.0" -"@salesforce/core@^7.0.0", "@salesforce/core@^7.3.1", "@salesforce/core@^7.3.10", "@salesforce/core@^7.3.5", "@salesforce/core@^7.3.6", "@salesforce/core@^7.3.8": - version "7.3.10" - resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-7.3.10.tgz#83da85c4e93ca625e2c13118aad9c1df2931bc0f" - integrity sha512-kEKoqkmhWNoiucAE3Ylv6FpC4iVgk4aE0dmcwSmNrMjxSbtjQJGUybprfO/itrLJv+56eM7/4FARQQ2gDbRzQQ== +"@salesforce/core@^7.0.0", "@salesforce/core@^7.3.1", "@salesforce/core@^7.3.10", "@salesforce/core@^7.3.5", "@salesforce/core@^7.3.6", "@salesforce/core@^7.4.0": + version "7.4.0" + resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-7.4.0.tgz#11c45a5f432e032bf242aaace1a175779e3e096f" + integrity sha512-wn3fJnpG8h493qKR52Il3xgRbXg4zwbV34wonf/mTZP3n5rJeC/7S69249CGN155Os6Lds5rEUo3pGJFwgCBdQ== dependencies: "@jsforce/jsforce-node" "^3.2.0" - "@salesforce/kit" "^3.1.1" + "@salesforce/kit" "^3.1.2" "@salesforce/schemas" "^1.9.0" "@salesforce/ts-types" "^2.0.9" ajv "^8.15.0" change-case "^4.1.2" + fast-levenshtein "^3.0.0" faye "^1.4.0" form-data "^4.0.0" js2xmlparser "^4.0.1"