Files
dsh-context/scripts/install-hooks.sh
T
bowenliang123 d0b8f0daa0 chore(config): trim comments in build config, scripts and docs tooling
Compress the CSS-channel note in tsdown.config.ts, the vitest lane
explainer and the release workflow header; fix the install-hooks header
(git only consults .git/hooks when core.hooksPath is unset); slim the
social-preview generator and bundle-patch comments.
2026-08-24 17:16:40 +08:00

18 lines
478 B
Bash

#!/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"