Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
fixed git hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
dannycoates committed Sep 5, 2019
1 parent 6576e4a commit 9ad9c9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
Expand Down
8 changes: 6 additions & 2 deletions scripts/sync-npm-dependencies.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 9ad9c9f

Please sign in to comment.