Skip to content

Commit 87bf01f

Browse files
committed
chore: 添加commit
1 parent 7598c14 commit 87bf01f

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no-install commitlint --edit "$1"

.husky/common.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
command_exists () {
3+
command -v "$1" >/dev/null 2>&1
4+
}
5+
6+
# Workaround for Windows 10, Git Bash and Yarn
7+
if command_exists winpty && test -t 1; then
8+
exec < /dev/tty
9+
fi

.husky/pre-commit

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/usr/bin/env sh
22
. "$(dirname -- "$0")/_/husky.sh"
3+
. "$(dirname "$0")/common.sh"
4+
5+
[ -n "$CI" ] && exit 0
36

47
npx lint-staged

commitlint.config.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// feat:新增功能
2+
// fix:bug 修复
3+
// docs:文档更新
4+
// style:不影响程序逻辑的代码修改(修改空白字符,格式缩进,补全缺失的分号等,没有改变代码逻辑)
5+
// refactor:重构代码(既没有新增功能,也没有修复 bug)
6+
// perf:性能, 体验优化
7+
// test:新增测试用例或是更新现有测试
8+
// build:主要目的是修改项目构建系统(例如 glup,webpack,rollup 的配置等)的提交
9+
// ci:主要目的是修改项目继续集成流程(例如 Travis,Jenkins,GitLab CI,Circle等)的提交
10+
// chore:不属于以上类型的其他类,比如构建流程, 依赖管理
11+
// revert:回滚某个更早之前的提交
12+
// version: 改变package.json 版本
13+
14+
module.exports = {
15+
ignores: [(commit) => commit.includes('init')],
16+
extends: ['@commitlint/config-conventional'],
17+
rules: {
18+
'body-leading-blank': [2, 'always'],
19+
'footer-leading-blank': [1, 'always'],
20+
'header-max-length': [2, 'always', 108],
21+
'subject-empty': [2, 'never'],
22+
'type-empty': [2, 'never'],
23+
'subject-case': [0],
24+
'type-enum': [
25+
2,
26+
'always',
27+
[
28+
'feat',
29+
'fix',
30+
'perf',
31+
'style',
32+
'docs',
33+
'test',
34+
'refactor',
35+
'build',
36+
'ci',
37+
'chore',
38+
'revert',
39+
'wip',
40+
'workflow',
41+
'types',
42+
'release',
43+
'version',
44+
],
45+
],
46+
},
47+
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
},
1010
"devDependencies": {
1111
"@antfu/eslint-config": "^0.25.2",
12+
"@commitlint/cli": "^17.1.2",
13+
"@commitlint/config-conventional": "^17.1.0",
1214
"@types/md5": "^2.3.2",
1315
"@types/node": "^18.0.6",
1416
"@types/prettier": "^2.6.3",

0 commit comments

Comments
 (0)