chore: use `czg` commitizen adapter (#5750)
parent
4c0f6f5865
commit
d94fe1c0b2
|
@ -149,6 +149,7 @@
|
|||
"cross-env": "^7.0.0",
|
||||
"css-loader": "^5.0.0",
|
||||
"css-minimizer-webpack-plugin": "^3.0.0",
|
||||
"cz-git": "^1.3.8",
|
||||
"date-fns": "^2.24.0",
|
||||
"diacritics": "^1.3.0",
|
||||
"docsearch.js": "^2.6.3",
|
||||
|
@ -298,5 +299,11 @@
|
|||
"tags": "vetur/tags.json",
|
||||
"attributes": "vetur/attributes.json"
|
||||
},
|
||||
"config": {
|
||||
"commitizen": {
|
||||
"path": "node_modules/cz-git",
|
||||
"czConfig": "./scripts/commitizen.js"
|
||||
}
|
||||
},
|
||||
"web-types": "vetur/web-types.json"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
'use strict';
|
||||
|
||||
const { execSync } = require('child_process');
|
||||
const fg = require('fast-glob');
|
||||
|
||||
const components = fg.sync('*', { cwd: 'components', onlyDirectories: true });
|
||||
// precomputed scope
|
||||
const scopeComplete = execSync('git status --porcelain || true')
|
||||
.toString()
|
||||
.trim()
|
||||
.split('\n')
|
||||
.find(r => ~r.indexOf('M '))
|
||||
?.replace(/(\/)/g, '%%')
|
||||
?.match(/components%%((\w|-)*)/)?.[1];
|
||||
|
||||
/** @type {import('cz-git').CommitizenGitOptions} */
|
||||
module.exports = {
|
||||
scopes: ['site', 'util', 'script', 'tool', ...components],
|
||||
scopeFilters: ['__tests__', '_util'],
|
||||
customScopesAlign: !scopeComplete ? 'top' : 'bottom',
|
||||
defaultScope: scopeComplete,
|
||||
maxHeaderLength: 100,
|
||||
allowEmptyIssuePrefixs: false,
|
||||
allowCustomIssuePrefixs: false,
|
||||
};
|
Loading…
Reference in New Issue