Last active
August 29, 2015 14:00
-
-
Save noahgrant/57ee6ae5ffe9639069e4 to your computer and use it in GitHub Desktop.
a quick script to call bower install and npm install automatically if bower.json or package.json are changed, respectively. this file should be called post-merge and should be placed in /.git/hooks/. it should be executable. **this hook does not get triggered if your git pulls are set to auto rebase.
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/sh | |
# noah grant | |
# quick script to call bower install and npm install automatically if | |
# bower.json or package.json are changed, respectively. | |
# add to .git/hooks/ | |
# this assumes one top-level file for each | |
changedfiles=( `git diff --name-only HEAD@{1}` ) | |
if [[ "${changedfiles[*]}" =~ "bower.json" ]]; then | |
echo "bower installing" | |
bower install | |
fi | |
if [[ "${changedfiles[*]}" =~ "package.json" ]]; then | |
echo "npm installing" | |
npm install | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment