chore: setup commitlint and commitizen

This commit is contained in:
Nex Zhu 2021-12-27 23:33:58 +08:00
parent cd3ad4ef78
commit 6e4869dae1
No known key found for this signature in database
GPG Key ID: 15C6254AD19362B4
7 changed files with 2955 additions and 0 deletions

25
.commitlintrc.js Normal file
View File

@ -0,0 +1,25 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
ignores: [(message) => message.startsWith('WIP: ')],
rules: {
'type-case': [0],
'type-enum': [
2,
'always',
[
'build',
'chore',
'ci',
'docs',
'feat',
'fix',
'perf',
'refactor',
'revert',
'style',
'test',
'WIP',
],
],
},
}

4
.husky/commit-msg Normal file
View File

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

View File

@ -1,9 +1,11 @@
{
"recommendations": [
"christian-kohler.npm-intellisense",
"coenraads.bracket-pair-colorizer-2",
"davidanson.vscode-markdownlint",
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
"joshbolduc.commitlint",
"oderwat.indent-rainbow",
"shardulm94.trailing-spaces",
"misterj.vue-volar-extention-pack"

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"commitlint.config.file": "./.commitlintrc.js"
}

View File

@ -2,6 +2,22 @@
Upstream template: [@daotl/fes-starter](https://github.com/daotl/fes-starter).
## Commit changes
Setup VS Code as the Git editor:
```shell
git config --global core.editor "code --wait"
```
Commit with [Commitizen](https://commitizen.github.io/cz-cli/):
```shell
npx cz
```
Or still use `git commit` and follow [the Conventional Commits spec](https://www.conventionalcommits.org/en/v1.0.0/#summary), your commits will be linted before accepted.
## Technology stack
Basic:

2895
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@
"version": "0.0.0",
"description": "Internet of Data control panel frontend",
"scripts": {
"cz": "npx cz",
"build": "fes build",
"prod": "cross-env FES_ENV=prod fes build",
"analyze": "cross-env ANALYZE=1 fes build",
@ -16,6 +17,11 @@
"stylelint:fix": "stylelint src/**/*.{css,scss,vue,tsx} --fix",
"prepare": "husky install"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"prettier": "@daotl/prettier-config",
"keywords": [
"管理端",
@ -35,6 +41,8 @@
},
"homepage": "https://gitea.internetapi.cn/iod/cpnode-front",
"devDependencies": {
"@commitlint/cli": "^16.0.0",
"@commitlint/config-conventional": "^16.0.0",
"@daotl/eslint-config-vue": "0.2.3",
"@daotl/prettier-config": "^0.1.2",
"@daotl/tsconfig": "^0.0.4",
@ -42,7 +50,9 @@
"@fesjs/plugin-windicss": "^2.0.4",
"@iconify-json/mdi": "^1.0.12",
"@vue/compiler-sfc": "^3.2.26",
"commitizen": "^4.2.4",
"cross-env": "^7.0.3",
"cz-conventional-changelog": "^3.3.0",
"eslint-webpack-plugin": "^3.1.1",
"husky": "^7.0.4",
"lint-staged": "^12.1.4",