forked from worldzhao/rush-monorepo-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.commitlintrc.js
More file actions
24 lines (20 loc) · 798 Bytes
/
Copy path.commitlintrc.js
File metadata and controls
24 lines (20 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// 该配置文件调用链路 git-hooks/commit-msg => rush command => autoinstaller => commitlint
// 可以引用到相应 autoinstaller 的依赖
const rushSDK = require("@rushstack/rush-sdk");
const path = require("path");
const rushConfiguration = rushSDK.RushConfiguration.loadFromDefaultLocation();
const packageNames = [];
const packageDirNames = [];
rushConfiguration.projects.forEach((project) => {
packageNames.push(project.packageName);
const dirName = path.parse(project.projectFolder).base;
packageDirNames.push(dirName);
});
// 保证 scope 只能为 all/packageName/packageDirName
const allScope = ["all", ...packageDirNames, ...packageNames];
module.exports = {
extends: ["@commitlint/config-conventional"],
rules: {
"scope-enum": [2, "always", allScope],
},
};