Ver Fonte

chore: chalk is replaced by piccolors

vben há 3 anos atrás
pai
commit
5a3a7633ac
5 ficheiros alterados com 12 adições e 9 exclusões
  1. 2 2
      build/generate/icon/index.ts
  2. 4 4
      build/script/buildConf.ts
  3. 3 3
      build/script/postBuild.ts
  4. 1 0
      package.json
  5. 2 0
      pnpm-lock.yaml

+ 2 - 2
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}]`,
       );
     });
 }

+ 4 - 4
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));
   }
 }
 

+ 3 - 3
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);
   }
 };

+ 1 - 0
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",

+ 2 - 0
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