#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
WD=`pwd`
# get the current vuejs mode
VUEMODE=`$SCRIPTDIR/vuemode.sh query`
if [[ $? -eq 1 ]]; then
exit 1
fi
# switch vuejs to prod mode
$SCRIPTDIR/vuemode.sh prod
# run the grunt script in the scripts working directory
cd $SCRIPT_DIR
grunt amd
# run the build php script
php ${SCRIPT_DIR}/build.php $@
if [[ "$VUEMODE" == "dev"]]; then
# switch vuejs vack to original mode
$SCRIPTDIR/vuemode.sh $VUEMODE
# re-do the grunt compiling
# return to the working directory
cd $WD