From e57573c658ce45ebd6f12cce2d3736da05998ce8 Mon Sep 17 00:00:00 2001 From: zanminkian Date: Sun, 22 Dec 2024 07:43:31 +0000 Subject: [PATCH] refactor(fenge): replace `chalk` with `yoctocolors` --- packages/fenge/package.json | 4 ++-- packages/fenge/src/utils.js | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/fenge/package.json b/packages/fenge/package.json index 92910669..630a1326 100644 --- a/packages/fenge/package.json +++ b/packages/fenge/package.json @@ -51,14 +51,14 @@ "@fenge/prettier-config": "workspace:*", "@fenge/tsconfig": "workspace:*", "@fenge/types": "workspace:*", - "chalk": "5.3.0", "commander": "12.1.0", "eslint": "8.57.1", "lilconfig": "3.1.3", "lint-staged": "15.2.11", "ora": "8.1.1", "prettier": "3.4.2", - "prettier-ignore": "workspace:*" + "prettier-ignore": "workspace:*", + "yoctocolors": "2.1.1" }, "devDependencies": { "@types/node": "22.9.1" diff --git a/packages/fenge/src/utils.js b/packages/fenge/src/utils.js index 72f953db..86988c7f 100644 --- a/packages/fenge/src/utils.js +++ b/packages/fenge/src/utils.js @@ -6,9 +6,9 @@ import { createRequire } from "node:module"; import path from "node:path"; import process from "node:process"; import { fileURLToPath } from "node:url"; -import chalk from "chalk"; import { lilconfig } from "lilconfig"; import ora from "ora"; +import colors from "yoctocolors"; /** * @param {string} filepath @@ -81,7 +81,7 @@ export function execAsync(command, { topic, dryRun, env }) { return reject(new Error("cmd not found")); } if (dryRun) { - process.stdout.write(`${chalk.green(cmd)} ${args.join(" ")};\n\n`); + process.stdout.write(`${colors.green(cmd)} ${args.join(" ")};\n\n`); return resolve(0); } @@ -104,7 +104,7 @@ export function execAsync(command, { topic, dryRun, env }) { }); cp.on("error", (err) => { spinner.fail( - `${topic} got error in ${chalk.yellow(getSpentTime(startTime))}`, + `${topic} got error in ${colors.yellow(getSpentTime(startTime))}`, ); resolve(getExitCode(err)); }); @@ -113,11 +113,11 @@ export function execAsync(command, { topic, dryRun, env }) { const exitCode = getExitCode({ code, signal }); if (exitCode === 0) { spinner.succeed( - `${topic} succeeded in ${chalk.yellow(getSpentTime(startTime))}`, + `${topic} succeeded in ${colors.yellow(getSpentTime(startTime))}`, ); } else { spinner.fail( - `${topic} failed in ${chalk.yellow(getSpentTime(startTime))}`, + `${topic} failed in ${colors.yellow(getSpentTime(startTime))}`, ); } resolve(exitCode);