This repository has been archived by the owner on Mar 19, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
.cz-config.js
62 lines (58 loc) · 2.29 KB
/
.cz-config.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const glob = require("glob")
/**
* @param {string} pattern
* @param {(path: string) => string} fn
*/
const globMap = (pattern, fn) =>
glob
.sync(pattern)
.map(fn || ((path) => path))
.map((path) => path.replace(/\/$/, ""))
/**
* Check `path` to not include substring in `variants`
* @param {string[]} variants
* @return {(path: string) => boolean}
*/
const exclude = (variants) => (path) =>
variants.every((variant) => !path.includes(variant))
/**
* Check `path` to include substring of one of `variants`
* @param {string[]} variants
* @return {(path: string) => boolean}
*/
const include = (variants) => (path) =>
variants.some((variant) => path.includes(variant))
module.exports = {
// prettier-ignore
types: [
{ value: "feat", name: "feat: A new feature" },
{ value: "fix", name: "fix: A bug fix" },
{ value: "docs", name: "docs: Documentation only changes" },
{ value: "style", name: "style: Changes that do not affect the meaning of the code\n (white-space, formatting, missing semi-colons, etc)", },
{ value: "chore", name: "chore: Changes to the build process or auxiliary tools\n and libraries such as documentation generation", },
{ value: "config", name: "config: Changes in configuration files. Add new or remove old." },
{ value: "refactor", name: "refactor: A code change that neither fixes a bug nor adds a feature", },
{ value: "perf", name: "perf: A code change that improves performance" },
{ value: "test", name: "test: Adding missing tests" },
{ value: "revert", name: "revert: Revert to a commit" },
{ value: "wip", name: "wip: Work in progress" },
],
scopes: [].concat(
"app",
globMap("src/*/", (path) => path.replace(/src\//, "")).filter(
exclude(["features", "ui", "lib"]),
),
"features",
globMap("src/features/*/", (path) => path.replace("src/", "")),
globMap("src/features/*/features/*", (path) =>
path.replace("src/", "").replace(/\/features\//, "/"),
),
"ui",
globMap("src/ui/*/", (path) => path.replace(/^src\//, "")),
"lib",
globMap("src/lib/*/", (path) => path.replace(/^src\//, "")),
"docz",
),
allowCustomScopes: true,
allowBreakingChanges: ["feat", "fix", "revert"],
}