Skip to content

Commit 4f8186c

Browse files
committed
Add pre-commit hook and install script
1 parent 75dec62 commit 4f8186c

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

scripts/install

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
cd "$(dirname "$0")/.."
5+
6+
HOOK=".git/hooks/pre-commit"
7+
8+
if [ -f "$HOOK" ]; then
9+
echo "Pre-commit hook already exists at $HOOK"
10+
echo "Remove it manually if you want to reinstall."
11+
exit 1
12+
fi
13+
14+
mkdir -p .git/hooks
15+
ln -s ../../scripts/pre-commit "$HOOK"
16+
echo "Installed pre-commit hook."

scripts/pre-commit

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
cd "$(git rev-parse --show-toplevel)"
5+
6+
echo "Running pre-commit checks..."
7+
scripts/lint

0 commit comments

Comments
 (0)