From 187b880dcf663e114f441db1aa9e30a314b1ce03 Mon Sep 17 00:00:00 2001 From: mutoe Date: Fri, 8 Sep 2023 16:29:08 +0800 Subject: [PATCH] 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. --- .husky/pre-commit | 4 ---- .husky/pre-push | 5 ----- package.json | 8 ++++++-- pnpm-lock.yaml | 18 +++++++++--------- 4 files changed, 15 insertions(+), 20 deletions(-) delete mode 100755 .husky/pre-commit delete mode 100755 .husky/pre-push diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index a4fc325..0000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - -npm exec lint-staged diff --git a/.husky/pre-push b/.husky/pre-push deleted file mode 100755 index 0a7cec6..0000000 --- a/.husky/pre-push +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - -npm run lint -npm run build diff --git a/package.json b/package.json index df97565..a989af7 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cdc4799..f165692 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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'}