Skip to content

Commit 641cd0e

Browse files
committed
chore: add tracked pre-commit git hook to run deno task precommit
1 parent 5bf22bb commit 641cd0e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

.githooks/pre-commit

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env sh
2+
# Run deno precommit task. If deno isn't available, fail to avoid committing unformatted/unchecked code.
3+
# This script is POSIX shell compatible.
4+
if command -v deno >/dev/null 2>&1; then
5+
deno task precommit
6+
status=$?
7+
if [ $status -ne 0 ]; then
8+
echo "deno precommit task failed (exit $status). Commit aborted."
9+
exit $status
10+
fi
11+
else
12+
echo "deno not found in PATH. Install Deno or run 'deno task precommit' manually."
13+
exit 1
14+
fi

0 commit comments

Comments
 (0)