From 76ea2c7112496252199f8495eea22d87d98a4311 Mon Sep 17 00:00:00 2001 From: Riceball LEE Date: Mon, 30 Sep 2024 10:19:41 +0800 Subject: [PATCH] refactor: use ansicolor instead of ansi-colors --- package.json | 2 +- src/lib/prompt.ts | 2 +- src/lib/run-script.ts | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index ef6b4c3..c4b46ad 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@isdk/detect-text-language": "^0.1.1", "@oclif/core": "^4", "@offline-ai/cli-common": "workspace:*", - "ansi-colors": "^4.1.3", + "ansicolor": "^2.0.3", "color-json": "^3.0.5", "enquirer": "^2.4.1", "lodash-es": "^4.17.21", diff --git a/src/lib/prompt.ts b/src/lib/prompt.ts index 15fa82d..4a3ba84 100644 --- a/src/lib/prompt.ts +++ b/src/lib/prompt.ts @@ -1,7 +1,7 @@ import fs from 'fs' import path from 'path' import enquier from 'enquirer' -import colors from 'ansi-colors' +import colors from 'ansicolor' // Input extends StringPrompt const Input = (enquier as any).Input diff --git a/src/lib/run-script.ts b/src/lib/run-script.ts index 3480869..e2413d7 100644 --- a/src/lib/run-script.ts +++ b/src/lib/run-script.ts @@ -4,7 +4,7 @@ import { ux } from '@oclif/core' import util from 'util' import fs from 'fs' import path from 'path' -import colors from 'ansi-colors' +import colors from 'ansicolor' // import cliSpinners from 'cli-spinners' import _logUpdate from 'log-update' import { get as getByPath, omitBy } from 'lodash-es' @@ -368,7 +368,7 @@ export async function runScript(filename: string, options: IRunScriptOptions) { } finally { if (!isSilence) {logUpdate.clear(options.consoleClear)} if (lastError) { - console.log(colors.magentaBright(`<${lastError}>`)) + console.log(colors.lightMagenta(`<${lastError}>`)) lastError = undefined } } @@ -460,7 +460,7 @@ export async function runScript(filename: string, options: IRunScriptOptions) { } finally { if (!isSilence) {logUpdate.clear(options.consoleClear)} if (lastError) { - input.write(colors.magentaBright(`<${lastError}>\n`)) + input.write(colors.lightMagenta(`<${lastError}>\n`)) lastError = undefined } }