Created
November 20, 2016 18:48
-
-
Save okonet/9706ec3b7f29e05109f3744fbc1fc91e to your computer and use it in GitHub Desktop.
Automatic yarn updates as a post-checkout hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"devDependencies": { | |
"ghooks": "^1.3.2" | |
}, | |
"config": { | |
"ghooks": { | |
"post-checkout": "./script/yarn-update.hook.sh $2 $3" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$1" != "$2" ]; then | |
diff=$(git diff $1 $2 yarn.lock) | |
if [ "$diff" != "" ]; then | |
echo "yarn.lock has been changed! Installing dependencies..." | |
yarn | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment