@dt-frames/commitlint-config 4.0.1 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +69 -0
- package/package.json +27 -25
package/index.mjs
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process'
|
|
2
|
+
|
|
3
|
+
// 提交内容
|
|
4
|
+
const scopeComplete = execSync('git status --porcelain || true')
|
|
5
|
+
.toString()
|
|
6
|
+
.trim()
|
|
7
|
+
.split('\n')
|
|
8
|
+
.find((r) => ~r.indexOf('M src'))
|
|
9
|
+
?.replace(/(\/)/g, '%%')
|
|
10
|
+
?.match(/src%%((\w|-)*)/)?.[1]
|
|
11
|
+
?.replace(/s$/, '')
|
|
12
|
+
|
|
13
|
+
const userConfig = {
|
|
14
|
+
extends: ['@commitlint/config-conventional'],
|
|
15
|
+
plugins: ['commitlint-plugin-function-rules'],
|
|
16
|
+
prompt: {
|
|
17
|
+
/** @use `pnpm commit :f` */
|
|
18
|
+
alias: {
|
|
19
|
+
s: 'style: 修改样式',
|
|
20
|
+
b: 'fix: 修复缺陷',
|
|
21
|
+
f: 'feat: 新增功能',
|
|
22
|
+
r: 'refactor: 代码重构'
|
|
23
|
+
},
|
|
24
|
+
allowCustomIssuePrefixs: false,
|
|
25
|
+
allowEmptyIssuePrefixs: false,
|
|
26
|
+
customScopesAlign: scopeComplete ? 'bottom' : 'top',
|
|
27
|
+
defaultScope: scopeComplete,
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
rules: {
|
|
31
|
+
/**
|
|
32
|
+
* 类型: 描述信息
|
|
33
|
+
*
|
|
34
|
+
* ---这是空行---
|
|
35
|
+
* - 功能点一
|
|
36
|
+
*
|
|
37
|
+
* footer描述内容
|
|
38
|
+
*/
|
|
39
|
+
'body-leading-blank': [2, 'always'],
|
|
40
|
+
'footer-leading-blank': [1, 'always'],
|
|
41
|
+
// 最多多少个字符
|
|
42
|
+
'header-max-length': [2, 'always', 108],
|
|
43
|
+
'scope-enum': [0],
|
|
44
|
+
'subject-case': [0],
|
|
45
|
+
'subject-empty': [2, 'never'],
|
|
46
|
+
'type-empty': [2, 'never'],
|
|
47
|
+
|
|
48
|
+
'type-enum': [
|
|
49
|
+
2,
|
|
50
|
+
'always',
|
|
51
|
+
[
|
|
52
|
+
'feat', // 新增功能
|
|
53
|
+
'fix', // 修复缺陷
|
|
54
|
+
'perf', // 性能优化
|
|
55
|
+
'style', // 代码格式
|
|
56
|
+
'docs', // 文档变更
|
|
57
|
+
'test', // 添加疏漏测试或已有测试改动
|
|
58
|
+
'refactor', // 代码重构
|
|
59
|
+
'build', // 构建流程、外部依赖变更 如npm升级 打包等
|
|
60
|
+
'ci', // 修改 CI 配置、脚本
|
|
61
|
+
'chore', // 对构建过程或辅助工具和库的更改
|
|
62
|
+
'revert', // 回滚 commit
|
|
63
|
+
'types', // 类型定义文件修改
|
|
64
|
+
]
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export default userConfig
|
package/package.json
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
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
|
-
}
|
|
2
|
+
"name": "@dt-frames/commitlint-config",
|
|
3
|
+
"version": "4.0.3",
|
|
4
|
+
"description": "代码提交检验",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"index.mjs"
|
|
10
|
+
],
|
|
11
|
+
"main": "./index.mjs",
|
|
12
|
+
"module": "./index.mjs",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./index.mjs",
|
|
16
|
+
"default": "./index.mjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public",
|
|
21
|
+
"registry": "https://registry.npmjs.org/"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
25
|
+
"commitlint-plugin-function-rules": "^4.0.2"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {}
|
|
28
|
+
}
|