Skip to content

Commit

Permalink
fix: add package version displayancestry command
Browse files Browse the repository at this point in the history
@W-10833165@
  • Loading branch information
peternhale committed Sep 7, 2022
1 parent 0be47a7 commit 30f6d5b
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 17 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"author": "Salesforce",
"bugs": "https://github.com/forcedotcom/cli/issues",
"dependencies": {
"@oclif/core": "^1.14.2",
"@oclif/core": "^1.16.0",
"@salesforce/command": "^5.2.6",
"@salesforce/core": "^3.26.2",
"@salesforce/kit": "^1.6.0",
"@salesforce/packaging": "^0.0.30",
"@salesforce/packaging": "^0.0.31-t-04",
"tslib": "^2",
"chalk": "^4.1.2"
},
Expand Down
26 changes: 23 additions & 3 deletions src/commands/force/package/beta/version/displayancestry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import * as os from 'os';
import { flags, FlagsConfig, SfdxCommand } from '@salesforce/command';
import { Messages } from '@salesforce/core';
import { PackageAncestry, PackageAncestryNodeData } from '@salesforce/packaging';

// Import i18n messages
Messages.importMessagesDirectory(__dirname);
Expand All @@ -19,6 +20,8 @@ export class PackageVersionDisplayAncestryCommand extends SfdxCommand {
public static readonly showProgress = false;
public static readonly varargs = false;
public static readonly requiresDevhubUsername = true;
public static readonly requiresProject = true;
public static readonly require = true;

public static readonly flagsConfig: FlagsConfig = {
// --json is configured automatically
Expand All @@ -38,8 +41,25 @@ export class PackageVersionDisplayAncestryCommand extends SfdxCommand {
}),
};

// eslint-disable-next-line @typescript-eslint/require-await
public async run(): Promise<unknown> {
throw new Error('Beta command not yet implemented');
public async run(): Promise<PackageAncestryNodeData> {
const packageAncestry = await PackageAncestry.create({
packageId: this.flags.package as string,
project: this.project,
connection: this.hubOrg.getConnection(),
});
const jsonProducer = await packageAncestry.getJsonProducer();
if (this.flags.dotcode) {
const dotProducer = await packageAncestry.getDotProducer();
this.ux.log(dotProducer.produce() as string);
} else {
if (packageAncestry.requestedPackageId.startsWith('04t')) {
const paths = await packageAncestry.getLeafPathToRoot(packageAncestry.requestedPackageId);
this.ux.log(`${paths[0].map((p) => p.getVersion()).join(' -> ')} (root)`);
this.ux.log();
}
const treeProducer = await packageAncestry.getTreeProducer(!!this.flags.verbose);
treeProducer.produce();
}
return jsonProducer.produce() as PackageAncestryNodeData;
}
}
74 changes: 62 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -730,9 +730,9 @@
is-wsl "^2.1.1"
tslib "^2.3.1"

"@oclif/core@^1.0.8", "@oclif/core@^1.14.1", "@oclif/core@^1.14.2", "@oclif/core@^1.2.1", "@oclif/core@^1.3.4", "@oclif/core@^1.3.6", "@oclif/core@^1.6.4", "@oclif/core@^1.7.0", "@oclif/core@^1.9.0", "@oclif/core@^1.9.9":
"@oclif/core@^1.0.8", "@oclif/core@^1.14.1", "@oclif/core@^1.14.2", "@oclif/core@^1.16.0", "@oclif/core@^1.2.1", "@oclif/core@^1.3.4", "@oclif/core@^1.3.6", "@oclif/core@^1.6.4", "@oclif/core@^1.7.0", "@oclif/core@^1.9.0", "@oclif/core@^1.9.9":
version "1.16.0"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-1.16.0.tgz#4b53261eeb0c0244700bfc9eb41159d483436f21"
resolved "http://localhost:4873/@oclif%2fcore/-/core-1.16.0.tgz#4b53261eeb0c0244700bfc9eb41159d483436f21"
integrity sha512-xtqhAbjQHBcz+xQpEHJ3eJEVfRQ4zl41Yw5gw/N+D1jgaIUrHTxCY/sfTvhw93LAQo7B++ozHzSb7DISFXsQFQ==
dependencies:
"@oclif/linewrap" "^1.0.0"
Expand Down Expand Up @@ -1150,11 +1150,12 @@
shx "^0.3.3"
tslib "^2.2.0"

"@salesforce/packaging@^0.0.30":
version "0.0.30"
resolved "https://registry.yarnpkg.com/@salesforce/packaging/-/packaging-0.0.30.tgz#960896896614be8658d4dcea2f58915c1264b0b6"
integrity sha512-E7GqZUCU35b02BeV1BmboRMsN1nDocLCuhZmVxJI4/49a7+fOSC79ynfkiPwpVBzl/qk14gahVC13HZKdAqrPQ==
"@salesforce/packaging@^0.0.31-t-04":
version "0.0.31-t-04"
resolved "http://localhost:4873/@salesforce%2fpackaging/-/packaging-0.0.31-t-04.tgz#8c6786afdb6c8310361c01624181ee1862e35d17"
integrity sha512-FVTKgT5Lztsc7+BJ6JgHQ9XO9784pkNz5nGbDrnepknVjYOp2Prv3W2z6MkSWDhbDsaElLZ36BtPn1edQm71nQ==
dependencies:
"@oclif/core" "^1.14.2"
"@salesforce/core" "^3.26.2"
"@salesforce/kit" "^1.6.0"
"@salesforce/schemas" "^1.2.0"
Expand All @@ -1163,6 +1164,9 @@
"@xmldom/xmldom" "^0.8.2"
debug "^4.3.4"
globby "^11"
graphology "^0.24.1"
graphology-traversal "^0.3.1"
graphology-types "^0.24.4"
js2xmlparser "^4.0.2"
jsforce beta
jszip "^3.10.0"
Expand Down Expand Up @@ -1212,12 +1216,7 @@
resolved "https://registry.yarnpkg.com/@salesforce/prettier-config/-/prettier-config-0.0.2.tgz#ded39bf7cb75238edc9db6dd093649111350f8bc"
integrity sha512-KExM355BLbxCW6siGBV7oUOotXvvVp0tAWERgzUkM2FcMb9fWrjwXDrIHc8V0UdDlA3UXtFltDWgN+Yqi+BA/g==

"@salesforce/schemas@^1.0.1", "@salesforce/schemas@^1.1.0":
version "1.1.3"
resolved "https://registry.yarnpkg.com/@salesforce/schemas/-/schemas-1.1.3.tgz#fce83f55c7557d47b9c814d5d02978ad734300b3"
integrity sha512-XWohlOT2oQDqAJH00OXS3f2MGjkwZ6pr4emnnkHSQbg7UdGW0rvGpEnRKqBbDUfZ4K5YKSo9Gj216ZtaP3JLXg==

"@salesforce/schemas@^1.2.0":
"@salesforce/schemas@^1.0.1", "@salesforce/schemas@^1.1.0", "@salesforce/schemas@^1.2.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@salesforce/schemas/-/schemas-1.2.0.tgz#3c7ed492e3ee5d9d9fb24a32b5c574893f6648db"
integrity sha512-76oYf/9Rsn6Yl+awrTQvLaQuRDNX7F3X9ksRiw53OCJdydIF05buX6XLzN0WDWpkCg/asw+lZMuAzbDVS0tBmg==
Expand Down Expand Up @@ -3574,6 +3573,11 @@ events@1.1.1:
resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924"
integrity sha512-kEcvvCBByWXGnZy6JUlgAp2gBIUjfCAV6P6TgT1/aaQKcmuAEC4OZTV1I4EWQLz2gxZw76atuVyvHhTxvi0Flw==

events@^3.3.0:
version "3.3.0"
resolved "http://localhost:4873/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400"
integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==

execa@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-0.10.0.tgz#ff456a8f53f90f8eccc71a96d11bdfc7f082cb50"
Expand Down Expand Up @@ -4289,6 +4293,40 @@ graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.5, graceful-fs@^4.1.6,
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c"
integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==

graphology-indices@^0.17.0:
version "0.17.0"
resolved "http://localhost:4873/graphology-indices/-/graphology-indices-0.17.0.tgz#b93ad32162ff8b09814547aedb101248f0fcbd2e"
integrity sha512-A7RXuKQvdqSWOpn7ZVQo4S33O0vCfPBnUSf7FwE0zNCasqwZVUaCXePuWo5HBpWw68KJcwObZDHpFk6HKH6MYQ==
dependencies:
graphology-utils "^2.4.2"
mnemonist "^0.39.0"

graphology-traversal@^0.3.1:
version "0.3.1"
resolved "http://localhost:4873/graphology-traversal/-/graphology-traversal-0.3.1.tgz#d4342a7093b4d4dab0f9130949166d1a85467bcc"
integrity sha512-lGLrLKEDKtNgAKgHVhVftKf3cb/nuWwuVPQZHXRnN90JWn0RSjco/s+NB2ARSlMapEMlbnPgv6j++427yTnU3Q==
dependencies:
graphology-indices "^0.17.0"
graphology-utils "^2.0.0"

graphology-types@^0.24.4:
version "0.24.4"
resolved "http://localhost:4873/graphology-types/-/graphology-types-0.24.4.tgz#299120fb50dcd7915204068715e7cfc9ef8b5e3c"
integrity sha512-CSgmycWiviCctMFO86YoUTJN1t4/PLKC5Pos2Hite+7kCUXTr+mGlDUAOgpcKG1IfFaeL9VDmTjFpzs2rTnPWw==

graphology-utils@^2.0.0, graphology-utils@^2.4.2:
version "2.5.2"
resolved "http://localhost:4873/graphology-utils/-/graphology-utils-2.5.2.tgz#4d30d6e567d27c01f105e1494af816742e8d2440"
integrity sha512-ckHg8MXrXJkOARk56ZaSCM1g1Wihe2d6iTmz1enGOz4W/l831MBCKSayeFQfowgF8wd+PQ4rlch/56Vs/VZLDQ==

graphology@^0.24.1:
version "0.24.1"
resolved "http://localhost:4873/graphology/-/graphology-0.24.1.tgz#035e452e294b01168cf5c85d5dd0a4b7e4837d87"
integrity sha512-6lNz1PNTAe9Q6ioHKrXu0Lp047sgvOoHa4qmP/8mnJWCGv2iIZPQkuHPUb2/OWDWCqHpw2hKgJLJ55X/66xmHg==
dependencies:
events "^3.3.0"
obliterator "^2.0.2"

grouped-queue@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/grouped-queue/-/grouped-queue-2.0.0.tgz#a2c6713f2171e45db2c300a3a9d7c119d694dac8"
Expand Down Expand Up @@ -5911,6 +5949,13 @@ mkdirp@1.0.4, mkdirp@^1.0.3, mkdirp@^1.0.4:
dependencies:
minimist "^1.2.6"

mnemonist@^0.39.0:
version "0.39.2"
resolved "http://localhost:4873/mnemonist/-/mnemonist-0.39.2.tgz#7e6a0bd5c7199460ee12a651103c7007adc6225a"
integrity sha512-n3ZCEosuMH03DVivZ9N0fcXPWiZrBLEdfSlEJ+S/mJxmk3zuo1ur0dj9URDczFyP1VS3wfiyKzqLLDXoPJ6rPA==
dependencies:
obliterator "^2.0.1"

mocha@^8.4.0:
version "8.4.0"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-8.4.0.tgz#677be88bf15980a3cae03a73e10a0fc3997f0cff"
Expand Down Expand Up @@ -6368,6 +6413,11 @@ object.values@^1.1.5:
define-properties "^1.1.3"
es-abstract "^1.19.1"

obliterator@^2.0.1, obliterator@^2.0.2:
version "2.0.4"
resolved "http://localhost:4873/obliterator/-/obliterator-2.0.4.tgz#fa650e019b2d075d745e44f1effeb13a2adbe816"
integrity sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ==

oclif@^3.0.1:
version "3.1.2"
resolved "https://registry.yarnpkg.com/oclif/-/oclif-3.1.2.tgz#9a26384f1a2a2201ee51281a5376acc4c84dfdf5"
Expand Down

0 comments on commit 30f6d5b

Please sign in to comment.