mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(cli): allow merge commit message
This commit is contained in:
parent
2baaf33c62
commit
fac3e60ad2
@ -2,12 +2,13 @@ import signale from 'signale';
|
|||||||
import { readFileSync } from 'fs';
|
import { readFileSync } from 'fs';
|
||||||
|
|
||||||
const commitRE = /^(revert: )?(fix|feat|docs|perf|test|types|build|chore|refactor|breaking change)(\(.+\))?: .{1,50}/;
|
const commitRE = /^(revert: )?(fix|feat|docs|perf|test|types|build|chore|refactor|breaking change)(\(.+\))?: .{1,50}/;
|
||||||
|
const mergeRE = /Merge branch /;
|
||||||
|
|
||||||
export function commitLint() {
|
export function commitLint() {
|
||||||
const gitParams = process.env.HUSKY_GIT_PARAMS as string;
|
const gitParams = process.env.HUSKY_GIT_PARAMS as string;
|
||||||
const commitMsg = readFileSync(gitParams, 'utf-8').trim();
|
const commitMsg = readFileSync(gitParams, 'utf-8').trim();
|
||||||
|
|
||||||
if (!commitRE.test(commitMsg)) {
|
if (!commitRE.test(commitMsg) || !mergeRE.test(commitMsg)) {
|
||||||
signale.error(`Error: invalid commit message: "${commitMsg}".
|
signale.error(`Error: invalid commit message: "${commitMsg}".
|
||||||
|
|
||||||
Proper commit message format is required for automated changelog generation.
|
Proper commit message format is required for automated changelog generation.
|
||||||
@ -30,6 +31,7 @@ Allowed Types:
|
|||||||
- chore
|
- chore
|
||||||
- refactor
|
- refactor
|
||||||
- breaking change
|
- breaking change
|
||||||
|
- Merge branch 'foo' into 'bar'
|
||||||
`);
|
`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import { clean } from '../commands/clean';
|
import { clean } from '../commands/clean';
|
||||||
import { setNodeEnv } from '../common';
|
import { setNodeEnv } from '../common';
|
||||||
import { compileSite } from '../compiler/compile-site';
|
import { compileSite } from '../compiler/compile-site';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user