Skip to content

Instantly share code, notes, and snippets.

@okonet
Created November 20, 2016 18:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save okonet/9706ec3b7f29e05109f3744fbc1fc91e to your computer and use it in GitHub Desktop.
Save okonet/9706ec3b7f29e05109f3744fbc1fc91e to your computer and use it in GitHub Desktop.
Automatic yarn updates as a post-checkout hook
{
"devDependencies": {
"ghooks": "^1.3.2"
},
"config": {
"ghooks": {
"post-checkout": "./script/yarn-update.hook.sh $2 $3"
}
}
}
#!/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