chore: replace husky with simple-git-hooks (#143)
This commit is contained in:
parent
24f15fde5c
commit
831732c719
|
|
@ -1 +0,0 @@
|
||||||
node scripts/verifyCommit.js
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
pnpm lint
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
import type { UserConfig } from '@commitlint/types'
|
||||||
|
import { RuleConfigSeverity } from '@commitlint/types'
|
||||||
|
|
||||||
|
const Configuration: UserConfig = {
|
||||||
|
extends: ['@commitlint/config-conventional'],
|
||||||
|
formatter: '@commitlint/format',
|
||||||
|
rules: {
|
||||||
|
'type-enum': [
|
||||||
|
RuleConfigSeverity.Error,
|
||||||
|
'always',
|
||||||
|
[
|
||||||
|
'feat',
|
||||||
|
'fix',
|
||||||
|
'perf',
|
||||||
|
'style',
|
||||||
|
'docs',
|
||||||
|
'test',
|
||||||
|
'refactor',
|
||||||
|
'build',
|
||||||
|
'ci',
|
||||||
|
'chore',
|
||||||
|
'revert',
|
||||||
|
'wip',
|
||||||
|
'workflow',
|
||||||
|
'types',
|
||||||
|
'release',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Configuration
|
||||||
21
package.json
21
package.json
|
|
@ -8,14 +8,14 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "cross-env MOCK_SERVER_PORT=8086 vite",
|
"dev": "cross-env MOCK_SERVER_PORT=8086 vite",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "vue-tsc --noEmit && vite build",
|
||||||
"build:dev": "vue-tsc --noEmit && vite build --mode=development",
|
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
|
"test": "vitest",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"lint:fix": "eslint . --fix",
|
"lint:fix": "eslint . --fix",
|
||||||
"test": "vitest",
|
|
||||||
"release": "bumpp --commit --push --tag",
|
"release": "bumpp --commit --push --tag",
|
||||||
"prepare": "husky",
|
"typecheck": "vue-tsc --noEmit",
|
||||||
"typecheck": "vue-tsc --noEmit"
|
"commitlint": "commitlint --edit",
|
||||||
|
"prepare": "simple-git-hooks"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@unhead/vue": "~1.11.19",
|
"@unhead/vue": "~1.11.19",
|
||||||
|
|
@ -37,6 +37,9 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "4.3.0",
|
"@antfu/eslint-config": "4.3.0",
|
||||||
|
"@commitlint/cli": "^19.7.1",
|
||||||
|
"@commitlint/config-conventional": "^19.7.1",
|
||||||
|
"@commitlint/types": "^19.5.0",
|
||||||
"@iconify-json/carbon": "^1.2.7",
|
"@iconify-json/carbon": "^1.2.7",
|
||||||
"@intlify/unplugin-vue-i18n": "^6.0.3",
|
"@intlify/unplugin-vue-i18n": "^6.0.3",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
|
|
@ -53,11 +56,12 @@
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"eslint": "^9.20.1",
|
"eslint": "^9.20.1",
|
||||||
"eslint-plugin-format": "^1.0.1",
|
"eslint-plugin-format": "^1.0.1",
|
||||||
"husky": "^9.1.7",
|
|
||||||
"less": "^4.2.2",
|
"less": "^4.2.2",
|
||||||
|
"lint-staged": "^15.4.3",
|
||||||
"mockjs": "^1.1.0",
|
"mockjs": "^1.1.0",
|
||||||
"postcss-mobile-forever": "^4.4.0",
|
"postcss-mobile-forever": "^4.4.0",
|
||||||
"rollup": "^4.34.8",
|
"rollup": "^4.34.8",
|
||||||
|
"simple-git-hooks": "^2.11.1",
|
||||||
"terser": "^5.39.0",
|
"terser": "^5.39.0",
|
||||||
"typescript": "^5.7.3",
|
"typescript": "^5.7.3",
|
||||||
"unocss": "66.0.0",
|
"unocss": "66.0.0",
|
||||||
|
|
@ -82,5 +86,12 @@
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"vite": "^6.1.0"
|
"vite": "^6.1.0"
|
||||||
|
},
|
||||||
|
"simple-git-hooks": {
|
||||||
|
"pre-commit": "pnpm lint-staged",
|
||||||
|
"commit-msg": "pnpm commitlint $1"
|
||||||
|
},
|
||||||
|
"lint-staged": {
|
||||||
|
"*": "eslint --fix"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1065
pnpm-lock.yaml
1065
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
|
@ -1,18 +0,0 @@
|
||||||
import fs from 'node:fs'
|
|
||||||
import process from 'node:process'
|
|
||||||
|
|
||||||
const msg = fs.readFileSync('.git/COMMIT_EDITMSG', 'utf-8').trim()
|
|
||||||
|
|
||||||
const commitRE = /^(revert: )?(feat|fix|docs|dx|style|refactor|perf|test|workflow|build|ci|chore|types|wip|release)(\(.+\))?: .{1,50}/
|
|
||||||
const mergeRe = /^(Merge pull request|Merge branch)/
|
|
||||||
|
|
||||||
if (!commitRE.test(msg)) {
|
|
||||||
if (!mergeRe.test(msg)) {
|
|
||||||
console.log('git commit unpass')
|
|
||||||
console.error('git commit error, needs title(scope): desc')
|
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.log('git commit pass')
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue