-
Notifications
You must be signed in to change notification settings - Fork 80
/
.commitlintrc.js
30 lines (27 loc) · 861 Bytes
/
.commitlintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const { execSync } = require("child_process");
const fs = require("fs");
const path = require("path");
// @example: Branch Name: feature/issue_36 => #36
const issue = execSync("git rev-parse --abbrev-ref HEAD")
.toString()
.trim()
.split("_")[1];
const plugins = fs
.readdirSync(path.resolve(__dirname, "packages/plugins"))
.map((value) => `plugin-${value}`);
/** @type {import('cz-git').UserConfig} */
module.exports = {
extends: ["@commitlint/config-conventional"],
rules: {
"scope-enum": [2, "always", ["theme", ...plugins]]
},
prompt: {
customScopesAlign: "top",
customIssuePrefixsAlign: !issue ? "top" : "bottom",
defaultIssues: !issue ? "" : `#${issue}`,
issuePrefixs: [
{ value: "link", name: "link: Link to ISSUES" },
{ value: "closed", name: "closed: ISSUES has been processed" }
]
}
};