fixed git hooks

This commit is contained in:
Danny Coates 2019-09-05 13:16:32 -07:00
parent 6576e4a74c
commit 9ad9c9feb2
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
2 changed files with 7 additions and 3 deletions

View file

@ -35,7 +35,7 @@
"hooks": {
"pre-commit": "lint-staged",
"pre-push": "npm test",
"post-merge": "scripts/sync-npm-dependencies.sh",
"post-merge": "npm install",
"post-checkout": "scripts/sync-npm-dependencies.sh"
}
},

View file

@ -1,8 +1,12 @@
#!/bin/bash
echo "checking package-lock.json for changes"
if [ "$1" != "$2" ]; then
DIFF=$(git diff $1 $2 package-lock.json)
IFS=' '
read -ra G_PARAMS <<< "$HUSKY_GIT_PARAMS"
PREV=${G_PARAMS[0]}
NEXT=${G_PARAMS[1]}
if [ "$PREV" != "$NEXT" ]; then
DIFF=$(git diff $PREV $NEXT package-lock.json)
if [ "$DIFF" != "" ]; then
npm install
fi