From fac3e60ad274bdbc6d0909cd0b1ba7b0e59ceb8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Fri, 29 Nov 2019 17:59:57 +0800 Subject: [PATCH] feat(cli): allow merge commit message --- packages/vant-cli/src/commands/commit-lint.ts | 4 +++- packages/vant-cli/src/commands/dev.ts | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/vant-cli/src/commands/commit-lint.ts b/packages/vant-cli/src/commands/commit-lint.ts index f0c732823..2685b99ff 100644 --- a/packages/vant-cli/src/commands/commit-lint.ts +++ b/packages/vant-cli/src/commands/commit-lint.ts @@ -2,12 +2,13 @@ import signale from 'signale'; import { readFileSync } from 'fs'; const commitRE = /^(revert: )?(fix|feat|docs|perf|test|types|build|chore|refactor|breaking change)(\(.+\))?: .{1,50}/; +const mergeRE = /Merge branch /; export function commitLint() { const gitParams = process.env.HUSKY_GIT_PARAMS as string; 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}". Proper commit message format is required for automated changelog generation. @@ -30,6 +31,7 @@ Allowed Types: - chore - refactor - breaking change +- Merge branch 'foo' into 'bar' `); process.exit(1); } diff --git a/packages/vant-cli/src/commands/dev.ts b/packages/vant-cli/src/commands/dev.ts index 780d87636..8e8b8bc0b 100644 --- a/packages/vant-cli/src/commands/dev.ts +++ b/packages/vant-cli/src/commands/dev.ts @@ -1,4 +1,3 @@ - import { clean } from '../commands/clean'; import { setNodeEnv } from '../common'; import { compileSite } from '../compiler/compile-site';