123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- const fs = require('fs');
- const path = require('path');
- const { execSync } = require('child_process');
- const scopes = fs
- .readdirSync(path.resolve(__dirname, 'src'), { withFileTypes: true })
- .filter((dirent) => dirent.isDirectory())
- .map((dirent) => dirent.name.replace(/s$/, ''));
- const scopeComplete = execSync('git status --porcelain || true')
- .toString()
- .trim()
- .split('\n')
- .find((r) => ~r.indexOf('M src'))
- ?.replace(/(\/)/g, '%%')
- ?.match(/src%%((\w|-)*)/)?.[1]
- ?.replace(/s$/, '');
- module.exports = {
- ignores: [(commit) => commit.includes('init')],
- extends: ['@commitlint/config-conventional'],
- rules: {
- 'body-leading-blank': [2, 'always'],
- 'footer-leading-blank': [1, 'always'],
- 'header-max-length': [2, 'always', 108],
- 'subject-empty': [2, 'never'],
- 'type-empty': [2, 'never'],
- 'subject-case': [0],
- 'type-enum': [
- 2,
- 'always',
- [
- 'feat',
- 'fix',
- 'perf',
- 'style',
- 'docs',
- 'test',
- 'refactor',
- 'build',
- 'ci',
- 'chore',
- 'revert',
- 'wip',
- 'workflow',
- 'types',
- 'release',
- ],
- ],
- },
- prompt: {
-
- alias: {
- f: 'docs: fix typos',
- r: 'docs: update README',
- s: 'style: update code format',
- b: 'build: bump dependencies',
- c: 'chore: update config',
- },
- customScopesAlign: !scopeComplete ? 'top' : 'bottom',
- defaultScope: scopeComplete,
- scopes: [...scopes, 'mock'],
- allowEmptyIssuePrefixs: false,
- allowCustomIssuePrefixs: false,
-
- typesAppend: [
- { value: 'wip', name: 'wip: work in process' },
- { value: 'workflow', name: 'workflow: workflow improvements' },
- { value: 'types', name: 'types: type definition file changes' },
- ],
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- },
- };
|