diff --git a/package.json b/package.json index 03ee297..c5cf1b3 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ "test:coverage": "vitest run --coverage" }, "dependencies": { - "chalk": "^5.3.0", "change-case": "^5.4.4", "find-up": "^7.0.0", "fs-extra": "^11.2.0", @@ -43,6 +42,7 @@ "@types/yargs": "^17.0.33", "@vitest/coverage-v8": "^2.1.5", "concurrently": "^9.1.0", + "consola": "^3.2.3", "eslint": "^9.15.0", "eslint-plugin-n": "^17.13.2", "fixturify-project": "^7.1.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 65a9c5d..6771c1b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,9 +8,6 @@ importers: .: dependencies: - chalk: - specifier: ^5.3.0 - version: 5.3.0 change-case: specifier: ^5.4.4 version: 5.4.4 @@ -45,6 +42,9 @@ importers: concurrently: specifier: ^9.1.0 version: 9.1.0 + consola: + specifier: ^3.2.3 + version: 3.2.3 eslint: specifier: ^9.15.0 version: 9.15.0(jiti@1.21.6) diff --git a/src/generate-document.ts b/src/generate-document.ts index c7e3af5..30e426b 100644 --- a/src/generate-document.ts +++ b/src/generate-document.ts @@ -1,5 +1,5 @@ -import chalk from "chalk"; import { camelCase, kebabCase, pascalCase } from "change-case"; +import { consola } from "consola"; import { ensureDir, readJson } from "fs-extra/esm"; import { writeFile } from "node:fs/promises"; import { dirname, isAbsolute, join, parse, relative } from "node:path"; @@ -29,7 +29,9 @@ export async function generateDocument( const document = documents.find((document) => document.name === documentName); if (document === undefined) { - throw new Error(`[BUG] Document \`${documentName}\` not found.`); + return consola.error( + new Error(`[BUG] Document \`${documentName}\` not found.`), + ); } const documentPath = await getDocumentPath(documentName, cwd, path); @@ -56,10 +58,8 @@ export async function generateDocument( await ensureDir(parse(file.path).dir); await writeFile(file.path, file.content); - console.log( - chalk.green( - `🫚 Generated ${documentName} \`${entityName}\` at \`${relative(cwd, file.path)}\`.`, - ), + consola.success( + `Generated ${documentName} \`${entityName}\` at \`${relative(cwd, file.path)}\`.`, ); }