Created
May 10, 2018 04:52
-
-
Save stretchkennedy/29c221eaee8fbddabc7c1a1b17095b84 to your computer and use it in GitHub Desktop.
Check the age of all your js files before committing (using husky)
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 | |
DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd)" | |
FILES="$(find "$DIR"/src -type f -name '*.js' -not -name '*.test.js')" | |
IS_OLDER=false | |
for f in $FILES; do | |
if [[ "$f" -nt bundle.js ]]; then | |
echo "$f is newer than bundle.js" | |
IS_OLDER=true | |
fi | |
done | |
if [[ $IS_OLDER = true ]]; then | |
echo | |
echo "found source files newer than bundle.js (did you forget to run 'npm build'?)" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment