Created
May 31, 2015 21:26
-
-
Save nkt/8bc77c9ed634f1294d3f to your computer and use it in GitHub Desktop.
Frontend git hooks
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 | |
# List changed files | |
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
check_file() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" | |
} | |
check_file "package.json" "npm install" |
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 | |
npm run --silent reformat-css && npm run --silent lint-js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment