Skip to content

Commit

Permalink
feat: 移除全局chalk模块,使用vipColor变量处理日志格式
Browse files Browse the repository at this point in the history
  • Loading branch information
mmdapl committed Sep 11, 2024
1 parent 18272da commit 5115623
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 0 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions verify-commit.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import process from 'node:process'
import chalk from 'chalk'
import { vipColor } from '@142vip/utils'
import {
getReleasePkgJSON,
verifyCommit,
Expand All @@ -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)
}
Expand All @@ -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('|')}`,
)}`,
)
Expand All @@ -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')}`,
)}`,
)
Expand All @@ -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`,
)}`,
)
Expand Down

0 comments on commit 5115623

Please sign in to comment.