From db87983614021ebd4887c88ce1de7cbaa3e7b816 Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Wed, 23 Aug 2023 09:30:32 -0600 Subject: [PATCH 1/2] feat: prep for @oclif/core v3 --- package.json | 5 ++-- src/commands/plugins/index.ts | 10 ++++---- src/commands/plugins/inspect.ts | 2 +- src/commands/plugins/uninstall.ts | 2 +- src/plugins.ts | 2 +- yarn.lock | 38 ++++++++++++++++++++++++++++++- 6 files changed, 47 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 5ce06e9d..73e0c189 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,7 @@ "author": "Salesforce", "bugs": "https://github.com/oclif/plugin-plugins/issues", "dependencies": { - "@oclif/color": "^1.0.10", - "@oclif/core": "^2.11.8", + "@oclif/core": "^2.11.10", "chalk": "^4.1.2", "debug": "^4.3.4", "fs-extra": "^9.0", @@ -89,4 +88,4 @@ "version": "oclif readme && git add README.md" }, "types": "lib/index.d.ts" -} \ No newline at end of file +} diff --git a/src/commands/plugins/index.ts b/src/commands/plugins/index.ts index 52aa66c1..b75f4e2e 100644 --- a/src/commands/plugins/index.ts +++ b/src/commands/plugins/index.ts @@ -1,4 +1,4 @@ -import color from '@oclif/color' +import * as chalk from 'chalk' import {Command, Flags, Plugin, ux} from '@oclif/core' import Plugins from '../../plugins' @@ -18,7 +18,7 @@ export default class PluginsIndex extends Command { async run(): Promise> { const {flags} = await this.parse(PluginsIndex) - let plugins = this.config.plugins + let plugins = this.config.getPluginsList() sortBy(plugins, p => this.plugins.friendlyName(p.name)) if (!flags.core) { plugins = plugins.filter(p => p.type !== 'core' && p.type !== 'dev') @@ -57,13 +57,13 @@ export default class PluginsIndex extends Command { } private formatPlugin(plugin: any): string { - let output = `${this.plugins.friendlyName(plugin.name)} ${color.dim(plugin.version)}` + let output = `${this.plugins.friendlyName(plugin.name)} ${chalk.dim(plugin.version)}` if (plugin.type !== 'user') - output += color.dim(` (${plugin.type})`) + output += chalk.dim(` (${plugin.type})`) if (plugin.type === 'link') output += ` ${plugin.root}` else if (plugin.tag && plugin.tag !== 'latest') - output += color.dim(` (${String(plugin.tag)})`) + output += chalk.dim(` (${String(plugin.tag)})`) return output } } diff --git a/src/commands/plugins/inspect.ts b/src/commands/plugins/inspect.ts index 086e4b7e..354b6886 100644 --- a/src/commands/plugins/inspect.ts +++ b/src/commands/plugins/inspect.ts @@ -85,7 +85,7 @@ export default class PluginsInspect extends Command { } findPlugin(pluginName: string): Plugin { - const pluginConfig = this.config.plugins.find(plg => plg.name === pluginName) + const pluginConfig = this.config.getPluginsList().find(plg => plg.name === pluginName) if (pluginConfig) return pluginConfig as Plugin throw new Error(`${pluginName} not installed`) diff --git a/src/commands/plugins/uninstall.ts b/src/commands/plugins/uninstall.ts index 68b55bf9..749d8593 100644 --- a/src/commands/plugins/uninstall.ts +++ b/src/commands/plugins/uninstall.ts @@ -41,7 +41,7 @@ export default class PluginsUninstall extends Command { ux.action.start(`Uninstalling ${friendly}`) const unfriendly = await this.plugins.hasPlugin(this.removeTags(plugin)) if (!unfriendly) { - const p = this.config.plugins.find(p => p.name === plugin) as Plugin | undefined + const p = this.config.getPluginsList().find(p => p.name === plugin) as Plugin | undefined if (p) { if (p && p.parent) return this.error(`${friendly} is installed via plugin ${p.parent!.name}, uninstall ${p.parent!.name} instead`) } diff --git a/src/plugins.ts b/src/plugins.ts index 9467ac90..1da8b8b6 100644 --- a/src/plugins.ts +++ b/src/plugins.ts @@ -365,7 +365,7 @@ export default class Plugins { private isValidPlugin(p: Config): boolean { if (p.valid) return true - if (!this.config.plugins.find(p => p.name === '@oclif/plugin-legacy') || + if (!this.config.getPluginsList().find(p => p.name === '@oclif/plugin-legacy') || // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore check if this plugin was loaded by `plugin-legacy` p._base.includes('@oclif/plugin-legacy') diff --git a/yarn.lock b/yarn.lock index 78a815c2..c2343058 100644 --- a/yarn.lock +++ b/yarn.lock @@ -772,7 +772,7 @@ read-package-json-fast "^3.0.0" which "^3.0.0" -"@oclif/color@^1.0.10", "@oclif/color@^1.0.3": +"@oclif/color@^1.0.3": version "1.0.10" resolved "https://registry.yarnpkg.com/@oclif/color/-/color-1.0.10.tgz#e83e3a30fffc93076281398cbeaa4f761c4df09e" integrity sha512-INWEDAL3SzzR3pIhkrqk22HV6JravLUeRZXAIpoQqIeLReauaibCVcNTzOlt0z0S8YrqRhksc54ZxZC4Oa8xBw== @@ -817,6 +817,42 @@ widest-line "^3.1.0" wrap-ansi "^7.0.0" +"@oclif/core@^2.11.10": + version "2.11.10" + resolved "https://registry.yarnpkg.com/@oclif/core/-/core-2.11.10.tgz#638128034b8b4bdf4b23480a7278426f85130170" + integrity sha512-/7Umij3OU++6o+z4U+waJ5nP6IvK9KKEVzz+xsla68YoECLQwz43boUKqYizlNMtTfiwNkiYb5QE+OU/q5qEtA== + dependencies: + "@types/cli-progress" "^3.11.0" + ansi-escapes "^4.3.2" + ansi-styles "^4.3.0" + cardinal "^2.1.1" + chalk "^4.1.2" + clean-stack "^3.0.1" + cli-progress "^3.12.0" + debug "^4.3.4" + ejs "^3.1.8" + fs-extra "^9.1.0" + get-package-type "^0.1.0" + globby "^11.1.0" + hyperlinker "^1.0.0" + indent-string "^4.0.0" + is-wsl "^2.2.0" + js-yaml "^3.14.1" + natural-orderby "^2.0.3" + object-treeify "^1.1.33" + password-prompt "^1.1.2" + semver "^7.5.3" + slice-ansi "^4.0.0" + string-width "^4.2.3" + strip-ansi "^6.0.1" + supports-color "^8.1.1" + supports-hyperlinks "^2.2.0" + ts-node "^10.9.1" + tslib "^2.5.0" + widest-line "^3.1.0" + wordwrap "^1.0.0" + wrap-ansi "^7.0.0" + "@oclif/core@^2.11.7", "@oclif/core@^2.11.8", "@oclif/core@^2.8.4": version "2.11.8" resolved "https://registry.yarnpkg.com/@oclif/core/-/core-2.11.8.tgz#780c4fdf53e8569cf754c2a8fefcc7ddeacf1747" From b5c5097c10d73c7580f8cfbfe9d032305b5d0608 Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Wed, 23 Aug 2023 09:44:34 -0600 Subject: [PATCH 2/2] chore: bump @oclif/test --- package.json | 3 +-- yarn.lock | 38 +++++++++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 73e0c189..7b81b5b2 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "devDependencies": { "@commitlint/config-conventional": "^12.1.4", "@oclif/plugin-help": "^5.2.17", - "@oclif/test": "^2.4.4", + "@oclif/test": "^2.4.7", "@types/chai": "^4.3.4", "@types/fs-extra": "^9.0", "@types/mocha": "^8.2.3", @@ -61,7 +61,6 @@ "main": "lib/index.js", "oclif": { "commands": "./lib/commands", - "scope": "heroku-cli", "hooks": { "update": "./lib/hooks/update.js" }, diff --git a/yarn.lock b/yarn.lock index c2343058..9b93344a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -853,7 +853,7 @@ wordwrap "^1.0.0" wrap-ansi "^7.0.0" -"@oclif/core@^2.11.7", "@oclif/core@^2.11.8", "@oclif/core@^2.8.4": +"@oclif/core@^2.11.8", "@oclif/core@^2.8.4": version "2.11.8" resolved "https://registry.yarnpkg.com/@oclif/core/-/core-2.11.8.tgz#780c4fdf53e8569cf754c2a8fefcc7ddeacf1747" integrity sha512-GILmztcHBzze45GvxRpUvqQI5nM26kSE/Q21Y+6DtMR+C8etM/hFW26D3uqIAbGlGtg5QEZZ6pjA/Fqgz+gl3A== @@ -929,13 +929,13 @@ resolved "https://registry.yarnpkg.com/@oclif/screen/-/screen-3.0.4.tgz#663db0ecaf23f3184e7f01886ed578060e4a7f1c" integrity sha512-IMsTN1dXEXaOSre27j/ywGbBjrzx0FNd1XmuhCWCB9NTPrhWI1Ifbz+YLSEcstfQfocYsrbrIessxXb2oon4lA== -"@oclif/test@^2.4.4": - version "2.4.4" - resolved "https://registry.yarnpkg.com/@oclif/test/-/test-2.4.4.tgz#95971b8d5718e8c20595ad8566254fa22b39cfe9" - integrity sha512-iDFp6wvxJX01qNOSu+vrbMoPU41vwVJB6AI8FdDmHhQt4kqLVXyXSpqCq7RZi6CgrsYVkK9hdZTREtXBF+2aNQ== +"@oclif/test@^2.4.7": + version "2.4.7" + resolved "https://registry.yarnpkg.com/@oclif/test/-/test-2.4.7.tgz#4372270157aa6598c0d1b61349b2eff4e2003193" + integrity sha512-r18sKGNUm/VGQ8BkSF9Kn7QeMGjGMDUrLxTDPzL5ERaBF5YSi+O9CT3mKhcFdrMwGnCqPVvlAdX4U/6gtYPy1A== dependencies: - "@oclif/core" "^2.11.7" - fancy-test "^2.0.33" + "@oclif/core" "^2.11.10" + fancy-test "^2.0.34" "@octokit/auth-token@^2.4.4": version "2.5.0" @@ -2831,6 +2831,20 @@ fancy-test@^2.0.33: nock "^13.3.2" stdout-stderr "^0.1.9" +fancy-test@^2.0.34: + version "2.0.35" + resolved "https://registry.yarnpkg.com/fancy-test/-/fancy-test-2.0.35.tgz#18c0ccd767a7332bea186369a7e7a79a3b4582bb" + integrity sha512-XE0L7yAFOKY2jDnkBDDQ3JBD7xbBFwAFl1Z/5WNKBeVNlaEP08wuRTPE3xj2k+fnUp2CMUfD+6aiIS+4pcrjwg== + dependencies: + "@types/chai" "*" + "@types/lodash" "*" + "@types/node" "*" + "@types/sinon" "*" + lodash "^4.17.13" + mock-stdin "^1.0.0" + nock "^13.3.3" + stdout-stderr "^0.1.9" + fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" @@ -4535,6 +4549,16 @@ nock@^13.3.2: lodash "^4.17.21" propagate "^2.0.0" +nock@^13.3.3: + version "13.3.3" + resolved "https://registry.yarnpkg.com/nock/-/nock-13.3.3.tgz#179759c07d3f88ad3e794ace885629c1adfd3fe7" + integrity sha512-z+KUlILy9SK/RjpeXDiDUEAq4T94ADPHE3qaRkf66mpEhzc/ytOMm3Bwdrbq6k1tMWkbdujiKim3G2tfQARuJw== + dependencies: + debug "^4.1.0" + json-stringify-safe "^5.0.1" + lodash "^4.17.21" + propagate "^2.0.0" + node-fetch@^2.6.7: version "2.6.7" resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"