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
|
2016-07-28 23:57:29 +02:00
|
|
|
# Initial commit
|
|
|
|
exit 1
|
2016-07-07 23:23:18 +02:00
|
|
|
fi
|
|
|
|
|
2016-07-28 23:57:29 +02:00
|
|
|
js_files=$(git diff-index --name-only $against | grep -e ".jsx\?$" | grep -v "^app/dist")
|
2016-07-07 23:23:18 +02:00
|
|
|
|
|
|
|
# Nothing more to do if no JS files was committed
|
|
|
|
if [ -z "$js_files" ]
|
|
|
|
then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Rebuilding dist JavaScript files…"
|
2016-07-29 23:57:21 +02:00
|
|
|
export NODE_ENV=production
|
|
|
|
npm run clean
|
|
|
|
npm run build
|
2016-07-07 23:23:18 +02:00
|
|
|
git add app/dist
|