chore: replace native pre-commit hook with husky running pnpm test

This commit is contained in:
Bowen Liang committed 2026-09-06 21:10:45 +08:00
1 parent b13ad55501
commit 1d5a68e6aa
4 files changed
+14 -19

No files matched your search

+1
View File
@@ -0,0 +1 @@
pnpm test
+3 -2
View File
@@ -43,8 +43,8 @@
"test": "pnpm run typecheck && vitest run --coverage",
"coverage": "vitest run --coverage",
"release": "bash scripts/publish.sh",
"hooks": "bash scripts/install-hooks.sh",
"social-preview": "node docs/social-preview/generate.ts"
"social-preview": "node docs/social-preview/generate.ts",
"prepare": "husky"
},
"dsh": {
"bundle": {
@@ -110,6 +110,7 @@
"@types/react-dom": "^19.2.4",
"@vitest/coverage-v8": "^4.1.11",
"eslint-plugin-sonarjs": "^4.2.0",
"husky": "^9.1.7",
"jsdom": "^30.0.1",
"lightningcss": "^1.33.0",
"oxlint": "1.76.0",
+10
View File
@@ -54,6 +54,9 @@ importers:
eslint-plugin-sonarjs:
specifier: ^4.2.0
version: 4.2.0(eslint@10.8.1)
husky:
specifier: ^9.1.7
version: 9.1.7
jsdom:
specifier: ^30.0.1
version: 30.0.1
@@ -1247,6 +1250,11 @@ packages:
html-void-elements@3.0.0:
resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==}
husky@9.1.7:
resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==}
engines: {node: '>=18'}
hasBin: true
ignore@5.3.2:
resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==}
engines: {node: '>= 4'}
@@ -2967,6 +2975,8 @@ snapshots:
html-void-elements@3.0.0: {}
husky@9.1.7: {}
ignore@5.3.2: {}
import-without-cache@0.4.0: {}
-17
View File
@@ -1,17 +0,0 @@
#!/usr/bin/env bash
# Installs a native pre-commit hook that runs `pnpm run typecheck`. Git only
# executes .git/hooks when `core.hooksPath` is unset (husky sets it to .husky/_).
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
HOOKS_DIR="$ROOT/.git/hooks"
mkdir -p "$HOOKS_DIR"
cat > "$HOOKS_DIR/pre-commit" <<'EOF'
#!/usr/bin/env sh
pnpm run typecheck
EOF
chmod +x "$HOOKS_DIR/pre-commit"
echo "pre-commit hook installed at .git/hooks/pre-commit"