@dazhicheng/common 1.0.2 → 1.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.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env sh
2
+ pnpm exec commitlint < "$1"
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env sh
2
+ pnpm run typecheck
3
+ pnpm run lint:lint-staged
@@ -5,11 +5,14 @@
5
5
  * https://cz-git.qbb.sh/zh/guide/
6
6
  */
7
7
 
8
- const customRules = {
8
+ const taskIdPlugin = {
9
9
  rules: {
10
- "header-match-team-format": ({ header }) => {
11
- const reg = /^([^:\s]+):\s#\d+#\s.+$/;
12
- return [reg.test(header), "commit message 必须符合格式:type: #任务ID# 描述,例如 feat: #123456# 新增导出功能"];
10
+ "task-id-required": parsed => {
11
+ const { header } = parsed;
12
+ if (!/#\d+#/.test(header)) {
13
+ return [false, "commit message 必须包含任务ID,格式为 #任务ID#(如 #1234567#)"];
14
+ }
15
+ return [true, ""];
13
16
  },
14
17
  },
15
18
  };
@@ -18,7 +21,7 @@ module.exports = {
18
21
  // 继承的规则
19
22
  extends: ["@commitlint/config-conventional"],
20
23
  // 自定义插件
21
- plugins: [customRules],
24
+ plugins: [taskIdPlugin],
22
25
  // 自定义规则
23
26
  rules: {
24
27
  // 提交类型枚举,git提交type必须是以下类型
@@ -40,8 +43,11 @@ module.exports = {
40
43
  "wip", // 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)
41
44
  ],
42
45
  ],
46
+ "task-id-required": [2, "always"], // 必须包含任务ID
43
47
  "subject-case": [0], // subject大小写不做校验
44
- "header-match-team-format": [2, "always"],
48
+ "subject-empty": [2, "never"], // 禁止空描述
49
+ "type-empty": [2, "never"], // 禁止空类型
50
+ "type-case": [2, "always", "lower-case"],
45
51
  },
46
52
 
47
53
  prompt: {
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@dazhicheng/common",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "共享配置文件",
5
5
  "type": "module",
6
6
  "files": [
7
- "commitlint.config.cjs"
7
+ "commitlint.config.cjs",
8
+ ".husky"
8
9
  ],
9
10
  "publishConfig": {
10
11
  "access": "public"