From 51156230f43875881457e08a6ca88c385b9d117e Mon Sep 17 00:00:00 2001 From: chufan Date: Thu, 12 Sep 2024 00:22:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=A7=BB=E9=99=A4=E5=85=A8=E5=B1=80`ch?= =?UTF-8?q?alk`=E6=A8=A1=E5=9D=97=EF=BC=8C=E4=BD=BF=E7=94=A8`vipColor`?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E5=A4=84=E7=90=86=E6=97=A5=E5=BF=97=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 - pnpm-lock.yaml | 12 ------------ verify-commit.js | 18 +++++++++--------- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index 32c8711..777c693 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,6 @@ "@types/node": "^14.18.63", "@types/qs": "^6.9.12", "babel-plugin-import": "^1.13.5", - "chalk": "^5.3.0", "cross-env": "^6.0.0", "eslint": "8.55.0", "eslint-plugin-format": "^0.1.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b30213f..e83c46b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -41,9 +41,6 @@ importers: babel-plugin-import: specifier: ^1.13.5 version: 1.13.8 - chalk: - specifier: ^5.3.0 - version: 5.3.0 cross-env: specifier: ^6.0.0 version: 6.0.3 @@ -6227,10 +6224,6 @@ packages: resolution: {integrity: sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==} engines: {node: '>=12'} - log-symbols@6.0.0: - resolution: {integrity: sha512-i24m8rpwhmPIS4zscNzK6MSEhk0DUWa/8iYQWxhffV8jkI4Phvs3F+quL5xvS0gdQR0FyTCMMH33Y78dDTzzIw==} - engines: {node: '>=18'} - long@5.2.3: resolution: {integrity: sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==} @@ -16538,11 +16531,6 @@ snapshots: chalk: 5.3.0 is-unicode-supported: 1.3.0 - log-symbols@6.0.0: - dependencies: - chalk: 5.3.0 - is-unicode-supported: 1.3.0 - long@5.2.3: {} lowercase-keys@1.0.1: {} diff --git a/verify-commit.js b/verify-commit.js index 5609b16..526b269 100755 --- a/verify-commit.js +++ b/verify-commit.js @@ -1,5 +1,5 @@ import process from 'node:process' -import chalk from 'chalk' +import { vipColor } from '@142vip/utils' import { getReleasePkgJSON, verifyCommit, @@ -11,17 +11,17 @@ const { isSuccess, message, type, scope } = verifyRes if (!isSuccess) { console.error( - `\n${chalk.white(chalk.bgRed(' Git Commit Message ERROR '))} ${chalk.red( + `\n${vipColor.white(vipColor.bgRed(' Git Commit Message ERROR '))} ${vipColor.red( `invalid commit message format.`, )}\n\n${ - chalk.red( + vipColor.red( ` Proper commit message format is required for automated changelog generation. Examples:\n\n`, ) - } ${chalk.green(`feat(Github Actions): add CI/CD option`)}\n` - + ` ${chalk.green( + } ${vipColor.green(`feat(Github Actions): add CI/CD option`)}\n` + + ` ${vipColor.green( `docs: update wbe site (close #28)`, )}\n\n${ - chalk.red(` See .github/commit-convention.md for more details.\n`)}`, + vipColor.red(` See .github/commit-convention.md for more details.\n`)}`, ) process.exit(1) } @@ -43,7 +43,7 @@ const typeList = [ // 校验类型 if (type == null || !typeList.includes(type)) { console.error( - `${chalk.white(chalk.bgRed('Git Commit Message ERROR '))} ${chalk.red( + `${vipColor.white(vipColor.bgRed('Git Commit Message ERROR '))} ${vipColor.red( `invalid commit type , support ${typeList.join('|')}`, )}`, ) @@ -62,7 +62,7 @@ const scopeList = [ // scope范围不支持 if (scope != null && !scopeList.includes(scope)) { console.error( - `${chalk.white(chalk.bgRed('Git Commit Message ERROR '))} ${chalk.red( + `${vipColor.white(vipColor.bgRed('Git Commit Message ERROR '))} ${vipColor.red( `invalid commit scope name , Examples:\n${scopeList.join('\n')}`, )}`, ) @@ -72,7 +72,7 @@ if (scope != null && !scopeList.includes(scope)) { // 判断message长度 if (message == null || message.length > 80) { console.error( - ` ${chalk.white(chalk.bgRed('Git Commit Message ERROR '))} ${chalk.red( + ` ${vipColor.white(vipColor.bgRed('Git Commit Message ERROR '))} ${vipColor.red( `invalid commit message length , max length is 80`, )}`, )