mirror of
https://github.com/youzan/vant.git
synced 2025-10-22 03:44:48 +00:00
build: add files of vant-cli 2
This commit is contained in:
36
packages/vant-cli/src/commands/commit-lint.ts
Normal file
36
packages/vant-cli/src/commands/commit-lint.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import signale from 'signale';
|
||||
import { readFileSync } from 'fs';
|
||||
|
||||
const commitRE = /^(revert: )?(fix|feat|docs|perf|test|types|build|chore|refactor|breaking change)(\(.+\))?: .{1,50}/;
|
||||
|
||||
export function commitLint() {
|
||||
const gitParams = process.env.HUSKY_GIT_PARAMS as string;
|
||||
const commitMsg = readFileSync(gitParams, 'utf-8').trim();
|
||||
|
||||
if (!commitRE.test(commitMsg)) {
|
||||
signale.error(`Error: invalid commit message: "${commitMsg}".
|
||||
|
||||
Proper commit message format is required for automated changelog generation.
|
||||
|
||||
Examples:
|
||||
|
||||
- fix(Button): incorrect style
|
||||
- feat(Button): incorrect style
|
||||
- docs(Button): fix typo
|
||||
|
||||
Allowed Types:
|
||||
|
||||
- fix
|
||||
- feat
|
||||
- docs
|
||||
- perf
|
||||
- test
|
||||
- types
|
||||
- build
|
||||
- chore
|
||||
- refactor
|
||||
- breaking change
|
||||
`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user