1 Star 0 Fork 1

huzhanglin/ng-zorro-antd

forked from xiqiaoliang/ng-zorro-antd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
commitlint.config.js 1.08 KB
一键复制 编辑 原始数据 按行查看 历史
Yadong Xie 提交于 2020-04-15 21:41 . chore(release): release 9.0.0 (#5036)
'use strict';
const message = process.env['HUSKY_GIT_PARAMS'];
const fs = require('fs');
const types = ['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'release', 'revert', 'style', 'test'];
const scopes = ['showcase', 'release', 'packaging', 'changelog', 'schematics', 'module:*'];
function parseMessage(message) {
const PATTERN = /^(\w+)(?:\(([^)]+)\))?\: (.+)$/;
const match = PATTERN.exec(message);
if (!match) {
return null;
}
return {
type: match[1] || null,
scope: match[2] || null
};
}
function getScopesRule() {
const messages = fs.readFileSync(message, { encoding: 'utf-8' });
const parsed = parseMessage(messages.split('\n')[0]);
if (!parsed) {
return [2, 'always', scopes];
}
const { scope, type } = parsed;
if (scope && !scopes.includes(scope) && type !== 'release' && !/module:.+/.test(scope)) {
return [2, 'always', scopes];
} else {
return [2, 'always', []];
}
}
module.exports = {
extends: ['@commitlint/config-angular'],
rules: {
'type-enum': [2, 'always', types],
'scope-enum': getScopesRule
}
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/fdgsdajgl/ng-zorro-antd.git
git@gitee.com:fdgsdajgl/ng-zorro-antd.git
fdgsdajgl
ng-zorro-antd
ng-zorro-antd
master

搜索帮助