Skip to content

Commit

Permalink
🧑‍💻 chore(custom): 添加commit规范
Browse files Browse the repository at this point in the history
可以看这条commit是怎么写的,或者使用(p)npm run commit 来替代git commit

ISSUES CLOSED: #12
  • Loading branch information
master1lan committed Feb 17, 2023
1 parent 4dacd82 commit 77cc224
Show file tree
Hide file tree
Showing 6 changed files with 1,709 additions and 57 deletions.
3 changes: 3 additions & 0 deletions .commitlintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ["gitmoji"],
};
48 changes: 48 additions & 0 deletions .cz-config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
module.exports = {
types: [
{
value: ":zap: feat",
name: "⚡️ feat: 新功能",
},
{
value: ":bug: fix",
name: "🐛 fix: 修复bug",
},
{
value: ":pencil2: docs",
name: "✏️ docs: 文档变更",
},
{
value: ":lipstick: style",
name: "💄 style: 代码的样式美化",
},
{
value: ":building_construction: refactor",
name: "🏗️ refactor: 重构",
},
{
value: ":wheelchair: perf",
name: "♿️ perf: 性能优化",
},
{
value: ":monocle_face: test",
name: "🧐 test: 测试",
},
{
value: ":technologist: chore",
name: "🧑‍💻 chore: 构建/工程依赖/工具",
},
],
messages: {
type: "请选择提交类型(必填)",
customScope: "请输入文件修改范围(可选)",
subject: "请简要描述提交(必填)",
body: "请输入详细描述(可选)",
breaking: "列出任何BREAKING CHANGES(可选)",
footer: "请输入要关闭的issue(可选)",
confirmCommit: "确定提交此说明吗?",
},
allowCustomScopes: true,
allowBreakingChanges: ["feat", "fix"], // 当提交类型为feat、fix时才有破坏性修改选项
subjectLimit: 72,
};
3 changes: 3 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

npx --no-install commitlint --edit "$1"
16 changes: 15 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@
"dev": "vite",
"build": "tsc && vite build && node build.js",
"preview": "vite preview",
"localdev": "vite --host 192.168.2.250"
"commit": "cz"
},
"config": {
"commitizen": {
"path": "node_modules/cz-customizable"
},
"cz-customizable": {
"config": ".cz-config.cjs"
}
},
"dependencies": {
"@dnd-kit/core": "^6.0.7",
Expand Down Expand Up @@ -47,6 +55,12 @@
"@types/react-lazy-load-image-component": "^1.5.2",
"@vitejs/plugin-legacy": "^4.0.1",
"@vitejs/plugin-react-swc": "^3.0.0",
"commitizen": "^4.3.0",
"commitlint": "^17.4.3",
"commitlint-config-gitmoji": "^2.3.1",
"cz-conventional-changelog": "^3.3.0",
"cz-customizable": "^7.0.0",
"husky": "^8.0.3",
"less": "^4.1.3",
"rollup-plugin-visualizer": "^5.9.0",
"terser": ">=5.4.0 <6.0.0",
Expand Down
Loading

0 comments on commit 77cc224

Please sign in to comment.