added sync-npm-dependencies script and hooks

This commit is contained in:
Danny Coates 2019-09-05 08:14:14 -07:00
parent 950872109e
commit 6576e4a74c
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
2 changed files with 11 additions and 1 deletions

View File

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

View File

@ -0,0 +1,9 @@
#!/bin/bash
echo "checking package-lock.json for changes"
if [ "$1" != "$2" ]; then
DIFF=$(git diff $1 $2 package-lock.json)
if [ "$DIFF" != "" ]; then
npm install
fi
fi