@mypaas/hcm-cli
Version:
Vant Cli 是一个 Vue 组件库构建工具,通过 Vant Cli 可以快速搭建一套功能完备的 Vue 组件库。
40 lines (34 loc) • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.commitLint = void 0;
const fs_extra_1 = require("fs-extra");
const logger_1 = require("../common/logger");
const commitRE = /^(revert: )?(fix|feat|docs|perf|test|types|style|build|chore|refactor|breaking change)(\(.+\))?: .{1,50}/;
const mergeRE = /Merge /;
function commitLint() {
const gitParams = process.env.HUSKY_GIT_PARAMS;
const commitMsg = fs_extra_1.readFileSync(gitParams, 'utf-8').trim();
if (!commitRE.test(commitMsg) && !mergeRE.test(commitMsg)) {
logger_1.consola.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
- Merge branch 'foo' into 'bar'
`);
process.exit(1);
}
}
exports.commitLint = commitLint;