-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommitizen.js
70 lines (68 loc) · 3.31 KB
/
commitizen.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
63
64
65
66
67
68
69
70
// prettier-ignore
const scopes = [
{ value: 'angular', name: 'angular: anything Angular specific' },
{ value: 'core', name: 'core: anything Nx core specific' },
{ value: 'bundling', name: 'bundling: anything bundling specific (e.g. rollup, webpack, etc.)' },
{ value: 'detox', name: 'detox: anything Detox specific' },
{ value: 'devkit', name: 'devkit: devkit-related changes' },
{ value: 'express', name: 'express: anything Express specific' },
{ value: 'graph', name: 'graph: anything graph app specific' },
{ value: 'js', name: 'js: anything TS->JS specific' },
{ value: 'linter', name: 'linter: anything Linter specific' },
{ value: 'misc', name: 'misc: misc stuff' },
{ value: 'nest', name: 'nest: anything Nest specific' },
{ value: 'nextjs', name: 'nextjs: anything Next specific' },
{ value: 'node', name: 'node: anything Node specific' },
{ value: 'nuxt', name: 'nuxt: anything Nuxt specific' },
{ value: 'nx-cloud', name: 'nx-cloud: anything NxCloud specific' },
{ value: 'nx-plugin', name: 'nx-plugin: anything Nx Plugin specific' },
{ value: 'nx-dev', name: 'nx-dev: anything related to docs infrastructure' },
{ value: 'react', name: 'react: anything React specific' },
{ value: 'react-native', name: 'react-native: anything React Native specific' },
{ value: 'expo', name: 'expo: anything Expo specific' },
{ value: 'repo', name: 'repo: anything related to managing the repo itself' },
{ value: 'storybook', name: 'storybook: anything Storybook specific' },
{ value: 'testing', name: 'testing: anything testing specific (e.g. jest or cypress)' },
{ value: 'vite', name: 'vite: anything Vite specific' },
{ value: 'vue', name: 'vue: anything Vue specific' },
{ value: 'web', name: 'web: anything Web specific' },
{ value: 'webpack', name: 'webpack: anything Webpack specific' },
];
// precomputed scope
const scopeComplete = require('child_process')
.execSync('git status --porcelain || true')
.toString()
.trim()
.split('\n')
.find((r) => ~r.indexOf('M packages'))
?.replace(/(\/)/g, '%%')
?.match(/packages%%((\w|-)*)/)?.[1];
/** @type {import('cz-git').CommitizenGitOptions} */
module.exports = {
/** @usage `pnpm commit :f` */
alias: {
f: 'docs(core): fix typos',
b: 'chore(repo): bump dependencies',
},
scopes,
defaultScope: scopeComplete,
scopesSearchValue: true,
maxSubjectLength: 100,
allowCustomScopes: false,
allowEmptyScopes: false,
allowCustomIssuePrefix: false,
allowEmptyIssuePrefix: false,
types: [
{ value: 'feat', name: 'feat: A new feature' },
{ value: 'fix', name: 'fix: A bug fix' },
{ value: 'docs', name: 'docs: Documentation only changes' },
{
value: 'cleanup',
name: 'cleanup: A code change that neither fixes a bug nor adds a feature',
},
{
value: 'chore',
name: "chore: Other changes that don't modify src or test files",
},
],
};