UNPKG

@wgoo/cli

Version:

Wgoo Cli 是一个 React 组件库构建工具,通过 Wgoo Cli 可以快速搭建一套功能完备的 React 组件库。

40 lines (30 loc) 845 B
const { readFileSync } = require('fs-extra'); const { consola } = 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(gitParams) { const commitMsg = readFileSync(gitParams, 'utf-8').trim(); if (!commitRE.test(commitMsg) && !mergeRE.test(commitMsg)) { 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); } } module.exports = { commitLint };