From 5a3a7633ac5c197615866f83a66ca06c186518c9 Mon Sep 17 00:00:00 2001 From: vben Date: Fri, 18 Mar 2022 18:39:32 +0800 Subject: [PATCH] chore: chalk is replaced by piccolors --- build/generate/icon/index.ts | 4 ++-- build/script/buildConf.ts | 8 ++++---- build/script/postBuild.ts | 6 +++--- package.json | 1 + pnpm-lock.yaml | 2 ++ 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/build/generate/icon/index.ts b/build/generate/icon/index.ts index c78cb09f..b01fec4c 100644 --- a/build/generate/icon/index.ts +++ b/build/generate/icon/index.ts @@ -1,7 +1,7 @@ import path from 'path'; import fs from 'fs-extra'; import inquirer from 'inquirer'; -import chalk from 'chalk'; +import colors from 'picocolors'; import pkg from '../../../package.json'; async function generateIcon() { @@ -64,7 +64,7 @@ async function generateIcon() { } fs.emptyDir(path.join(process.cwd(), 'node_modules/.vite')); console.log( - `✨ ${chalk.cyan(`[${pkg.name}]`)}` + ' - Icon generated successfully:' + `[${prefixSet}]`, + `✨ ${colors.cyan(`[${pkg.name}]`)}` + ' - Icon generated successfully:' + `[${prefixSet}]`, ); }); } diff --git a/build/script/buildConf.ts b/build/script/buildConf.ts index 342c1541..aa7b8439 100644 --- a/build/script/buildConf.ts +++ b/build/script/buildConf.ts @@ -3,7 +3,7 @@ */ import { GLOB_CONFIG_FILE_NAME, OUTPUT_DIR } from '../constant'; import fs, { writeFileSync } from 'fs-extra'; -import chalk from 'chalk'; +import colors from 'picocolors'; import { getEnvConfig, getRootPath } from '../utils'; import { getConfigFileName } from '../getConfigFileName'; @@ -31,10 +31,10 @@ function createConfig(params: CreateConfigParams) { fs.mkdirp(getRootPath(OUTPUT_DIR)); writeFileSync(getRootPath(`${OUTPUT_DIR}/${configFileName}`), configStr); - console.log(chalk.cyan(`✨ [${pkg.name}]`) + ` - configuration file is build successfully:`); - console.log(chalk.gray(OUTPUT_DIR + '/' + chalk.green(configFileName)) + '\n'); + console.log(colors.cyan(`✨ [${pkg.name}]`) + ` - configuration file is build successfully:`); + console.log(colors.gray(OUTPUT_DIR + '/' + colors.green(configFileName)) + '\n'); } catch (error) { - console.log(chalk.red('configuration file configuration file failed to package:\n' + error)); + console.log(colors.red('configuration file configuration file failed to package:\n' + error)); } } diff --git a/build/script/postBuild.ts b/build/script/postBuild.ts index e1554bff..42635d88 100644 --- a/build/script/postBuild.ts +++ b/build/script/postBuild.ts @@ -1,7 +1,7 @@ // #!/usr/bin/env node import { runBuildConfig } from './buildConf'; -import chalk from 'chalk'; +import colors from 'picocolors'; import pkg from '../../package.json'; @@ -14,9 +14,9 @@ export const runBuild = async () => { runBuildConfig(); } - console.log(`✨ ${chalk.cyan(`[${pkg.name}]`)}` + ' - build successfully!'); + console.log(`✨ ${colors.cyan(`[${pkg.name}]`)}` + ' - build successfully!'); } catch (error) { - console.log(chalk.red('vite build error:\n' + error)); + console.log(colors.red('vite build error:\n' + error)); process.exit(1); } }; diff --git a/package.json b/package.json index 713d07b0..7952665f 100644 --- a/package.json +++ b/package.json @@ -111,6 +111,7 @@ "less": "^4.1.2", "lint-staged": "12.3.7", "npm-run-all": "^4.1.5", + "picocolors": "^1.0.0", "postcss": "^8.4.12", "postcss-html": "^1.3.0", "postcss-less": "^6.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 94a4bb9f..9a3ffaea 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -68,6 +68,7 @@ specifiers: npm-run-all: ^4.1.5 nprogress: ^0.2.0 path-to-regexp: ^6.2.0 + picocolors: ^1.0.0 pinia: 2.0.12 postcss: ^8.4.12 postcss-html: ^1.3.0 @@ -196,6 +197,7 @@ devDependencies: less: 4.1.2 lint-staged: 12.3.7 npm-run-all: 4.1.5 + picocolors: 1.0.0 postcss: 8.4.12 postcss-html: 1.3.0 postcss-less: 6.0.0_postcss@8.4.12