Browse Source

feat: 新增 commitlint,修改部分规则

奔跑的面条 3 years ago
parent
commit
db3c38a333
6 changed files with 660 additions and 4 deletions
  1. 3 0
      .commitlintrc.js
  2. 4 0
      .husky/commit-msg
  3. 13 1
      README.md
  4. 6 1
      package.json
  5. 632 0
      pnpm-lock.yaml
  6. 2 2
      prettier.config.js

+ 3 - 0
.commitlintrc.js

@@ -0,0 +1,3 @@
+module.exports = {
+  extends: ["@commitlint/config-conventional"]
+};

+ 4 - 0
.husky/commit-msg

@@ -0,0 +1,4 @@
+#!/usr/bin/env sh
+. "$(dirname -- "$0")/_/husky.sh"
+
+npx --no-install commitlint -e 

+ 13 - 1
README.md

@@ -109,10 +109,22 @@ yarn run build
 make dist
 
 ```
+## 代码提交
+
+* feat: 新功能
+* fix: 修复 Bug
+* docs: 文档修改
+* perf: 性能优化
+* revert: 版本回退
+* ci: CICD集成相关
+* test: 添加测试代码
+* refactor: 代码重构
+* build: 影响项目构建或依赖修改
+* style: 不影响程序逻辑的代码修改
+* chore: 不属于以上类型的其他类型(日常事务)
 
 ## 交流
 
-
 QQ 群:1030129384
 
 ![QQ群](readme/goView-QQ.png)

+ 6 - 1
package.json

@@ -4,7 +4,8 @@
   "scripts": {
     "dev": "vite --host",
     "build": "vue-tsc --noEmit && vite build",
-    "new": "plop --plopfile ./plop/plopfile.js"
+    "new": "plop --plopfile ./plop/plopfile.js",
+    "postinstall": "husky install"
   },
   "dependencies": {
     "@types/color": "^3.0.3",
@@ -30,6 +31,8 @@
     "vuedraggable": "^4.1.0"
   },
   "devDependencies": {
+    "@commitlint/cli": "^17.0.2",
+    "@commitlint/config-conventional": "^17.0.2",
     "@types/node": "^16.11.26",
     "@typescript-eslint/eslint-plugin": "^5.18.0",
     "@typescript-eslint/parser": "^5.18.0",
@@ -39,6 +42,7 @@
     "@vitejs/plugin-vue-jsx": "^1.3.9",
     "@vue/compiler-sfc": "^3.2.31",
     "@vueuse/core": "^7.7.1",
+    "commitlint": "^17.0.2",
     "default-passive-events": "^2.0.0",
     "echarts": "^5.3.2",
     "eslint": "^8.12.0",
@@ -46,6 +50,7 @@
     "eslint-plugin-import": "^2.26.0",
     "eslint-plugin-prettier": "^4.0.0",
     "eslint-plugin-vue": "^8.5.0",
+    "husky": "^8.0.1",
     "lodash": "~4.17.21",
     "mockjs": "^1.1.0",
     "plop": "^3.0.5",

File diff suppressed because it is too large
+ 632 - 0
pnpm-lock.yaml


+ 2 - 2
prettier.config.js

@@ -1,10 +1,10 @@
 module.exports = {
-  printWidth: 80,
+  printWidth: 120,
   tabWidth: 2,
   useTabs: false,
   singleQuote: true,
   semi: false,
-  trailingComma: "es5",
+  trailingComma: "none",
   bracketSpacing: true,
   jsxSingleQuote: true,
   jsxBracketSameLine: false,

Some files were not shown because too many files changed in this diff