Handle ./pre-commit being called directly and not as a git hook

This commit is contained in:
Benoit Daloze
2022-09-09 09:46:27 +02:00
parent a727442384
commit 51899ef157
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
set -e
if git diff --cached --name-only | grep -E '.(js|json)$'; then
if [ "$(dirname "$0")" != ".git/hooks" ] || git diff --cached --name-only | grep -E '.(js|json)$'; then
yarn install
yarn run package
exec git add dist/index.js