Skip to content

Commit

Permalink
refactor(fenge): replace chalk with yoctocolors
Browse files Browse the repository at this point in the history
  • Loading branch information
zanminkian committed Dec 22, 2024
1 parent e4da9cf commit e57573c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/fenge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 5 additions & 5 deletions packages/fenge/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

Expand All @@ -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));
});
Expand All @@ -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);
Expand Down

0 comments on commit e57573c

Please sign in to comment.