chore: Replace husky with simple-git-hooks for git hooks management

The change consists in replacing husky which was used for managing git hooks with simple-git-hooks. The simple-git-hooks library is lighter, simpler, and offers almost the same set of features as husky. This change will make the codebase easier to maintain and understand.
This commit is contained in:
mutoe 2023-09-08 16:29:08 +08:00
parent 57d2aa3a62
commit 187b880dcf
No known key found for this signature in database
GPG Key ID: FEE78A0836900C9C
4 changed files with 15 additions and 20 deletions

View File

@ -1,4 +0,0 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm exec lint-staged

View File

@ -1,5 +0,0 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm run lint
npm run build

View File

@ -3,7 +3,7 @@
"private": true,
"license": "MIT",
"scripts": {
"prepare": "husky install",
"prepare": "simple-git-hooks",
"dev": "vite",
"build": "vite build",
"serve": "vite preview --port 4137",
@ -38,10 +38,10 @@
"eslint": "^8.48.0",
"eslint-plugin-cypress": "^2.14.0",
"happy-dom": "^11.0.2",
"husky": "^8.0.2",
"lint-staged": "^13.1.0",
"msw": "^1.3.0",
"rollup-plugin-analyzer": "^4.0.0",
"simple-git-hooks": "^2.9.0",
"swagger-typescript-api": "^13.0.3",
"typescript": "~5.0.4",
"vite": "^4.4.9",
@ -52,5 +52,9 @@
"lint-staged": {
"src/**/*.{ts,vue,js}": "eslint --fix",
"cypress/**/*.{ts,js}": "eslint --fix"
},
"simple-git-hooks": {
"pre-commit": "lint-staged",
"pre-push": "npm run lint && npm run build"
}
}

View File

@ -58,9 +58,6 @@ devDependencies:
happy-dom:
specifier: ^11.0.2
version: 11.0.2
husky:
specifier: ^8.0.2
version: 8.0.2
lint-staged:
specifier: ^13.1.0
version: 13.1.0
@ -70,6 +67,9 @@ devDependencies:
rollup-plugin-analyzer:
specifier: ^4.0.0
version: 4.0.0
simple-git-hooks:
specifier: ^2.9.0
version: 2.9.0
swagger-typescript-api:
specifier: ^13.0.3
version: 13.0.3
@ -3010,12 +3010,6 @@ packages:
engines: {node: '>=12.20.0'}
dev: true
/husky@8.0.2:
resolution: {integrity: sha512-Tkv80jtvbnkK3mYWxPZePGFpQ/tT3HNSs/sasF9P2YfkMezDl3ON37YN6jUUI4eTg5LcyVynlb6r4eyvOmspvg==}
engines: {node: '>=14'}
hasBin: true
dev: true
/iconv-lite@0.4.24:
resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==}
engines: {node: '>=0.10.0'}
@ -4651,6 +4645,12 @@ packages:
resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==}
dev: true
/simple-git-hooks@2.9.0:
resolution: {integrity: sha512-waSQ5paUQtyGC0ZxlHmcMmD9I1rRXauikBwX31bX58l5vTOhCEcBC5Bi+ZDkPXTjDnZAF8TbCqKBY+9+sVPScw==}
hasBin: true
requiresBuild: true
dev: true
/skin-tone@2.0.0:
resolution: {integrity: sha512-kUMbT1oBJCpgrnKoSr0o6wPtvRWT9W9UKvGLwfJYO2WuahZRHOpEyL1ckyMGgMWh0UdpmaoFqKKD29WTomNEGA==}
engines: {node: '>=8'}