From 246530514459059f8079cb26d84c7a5226a0586c Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Tue, 28 May 2024 12:24:24 -0600 Subject: [PATCH] feat: use @oclif/core v4 --- package.json | 4 ++-- src/hooks/init/check-update.ts | 8 ++++++-- yarn.lock | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index a7994b04..e5d4ef66 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,8 @@ "author": "Salesforce", "bugs": "https://github.com/oclif/plugin-warn-if-update-available/issues", "dependencies": { - "@oclif/core": "^3.26.6", - "chalk": "^5.3.0", + "@oclif/core": "^4.0.0-beat.13", + "ansis": "^3.2.0", "debug": "^4.1.0", "http-call": "^5.2.2", "lodash": "^4.17.21" diff --git a/src/hooks/init/check-update.ts b/src/hooks/init/check-update.ts index 92a73725..0ec46dab 100644 --- a/src/hooks/init/check-update.ts +++ b/src/hooks/init/check-update.ts @@ -1,12 +1,14 @@ /* eslint-disable valid-jsdoc */ import {Hook, Interfaces} from '@oclif/core' -import chalk from 'chalk' +import {Ansis} from 'ansis' import makeDebug from 'debug' import {spawn} from 'node:child_process' import {readFile, stat, writeFile} from 'node:fs/promises' import {dirname, join, resolve} from 'node:path' import {fileURLToPath} from 'node:url' +const ansis = new Ansis() + async function readJSON(file: string): Promise { return JSON.parse(await readFile(file, 'utf8')) as T } @@ -172,7 +174,9 @@ const hook: Hook.Init = async function ({config}) { ]) this.warn( lodash.template(message)({ - chalk, + ansis, + // chalk and ansis have the same api. Keeping chalk for backwards compatibility. + chalk: ansis, config, latest: newerVersion, }), diff --git a/yarn.lock b/yarn.lock index 137df891..aa01f280 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1451,6 +1451,29 @@ wordwrap "^1.0.0" wrap-ansi "^7.0.0" +"@oclif/core@^4.0.0-beat.13": + version "4.0.0-beta.13" + resolved "https://registry.yarnpkg.com/@oclif/core/-/core-4.0.0-beta.13.tgz#0e0a6431cfe612db77073d2f9ef361f14e4090b8" + integrity sha512-ug8CZUCJphgetSZVgd4HQgyewlYVGGG1LIeFXGxjgYsjZ/f5I3nSCj7xpAMEDqjVD/lwmSujtVwa7tvEgLGICw== + dependencies: + ansi-escapes "^4.3.2" + ansis "^3.0.1" + clean-stack "^3.0.1" + cli-spinners "^2.9.2" + cosmiconfig "^9.0.0" + debug "^4.3.4" + ejs "^3.1.10" + get-package-type "^0.1.0" + globby "^11.1.0" + indent-string "^4.0.0" + is-wsl "^2.2.0" + minimatch "^9.0.4" + string-width "^4.2.3" + supports-color "^9.4.0" + widest-line "^3.1.0" + wordwrap "^1.0.0" + wrap-ansi "^7.0.0" + "@oclif/plugin-help@^6.0.21": version "6.0.21" resolved "https://registry.yarnpkg.com/@oclif/plugin-help/-/plugin-help-6.0.21.tgz#c48e688bf6df574e74557ebe2f877556f08dc60b" @@ -2756,6 +2779,11 @@ ansicolors@~0.3.2: resolved "https://registry.yarnpkg.com/ansicolors/-/ansicolors-0.3.2.tgz#665597de86a9ffe3aa9bfbe6cae5c6ea426b4979" integrity sha1-ZlWX3oap/+Oqm/vmyuXG6kJrSXk= +ansis@^3.0.1, ansis@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansis/-/ansis-3.2.0.tgz#0e050c5be94784f32ffdac4b84fccba064aeae4b" + integrity sha512-Yk3BkHH9U7oPyCN3gL5Tc7CpahG/+UFv/6UG03C311Vy9lzRmA5uoxDTpU9CO3rGHL6KzJz/pdDeXZCZ5Mu/Sg== + anymatch@~3.1.2: version "3.1.3" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" @@ -5996,6 +6024,11 @@ supports-color@^7, supports-color@^7.0.0, supports-color@^7.1.0: dependencies: has-flag "^4.0.0" +supports-color@^9.4.0: + version "9.4.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-9.4.0.tgz#17bfcf686288f531db3dea3215510621ccb55954" + integrity sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw== + supports-hyperlinks@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz#3943544347c1ff90b15effb03fc14ae45ec10624"