ampache_react/hooks/pre-commit

23 lines
441 B
Plaintext
Raw Normal View History

2016-07-07 23:23:18 +02:00
# Get against which ref to diff
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit
exit 1
2016-07-07 23:23:18 +02:00
fi
css_js_files=$(git diff-index --name-only $against | grep -e '.\(jsx\?\)\|\(s\?css\)$' | grep -v "^public")
2016-07-07 23:23:18 +02:00
# Nothing more to do if no JS files was committed
2016-07-30 00:48:41 +02:00
if [ -z "$css_js_files" ]
2016-07-07 23:23:18 +02:00
then
exit 0
fi
echo "Rebuilding dist JavaScript files…"
npm run clean
npm run build:prod
npm test
git add public