reinstated vue mode switch
This commit is contained in:
parent
f6cd15a674
commit
e3e69a88e6
3 changed files with 60 additions and 0 deletions
|
@ -10,6 +10,7 @@ $exclude_paths = [
|
||||||
"build", // dir for build zip files
|
"build", // dir for build zip files
|
||||||
"build/*",
|
"build/*",
|
||||||
"build.*",
|
"build.*",
|
||||||
|
"vuemode.sh",
|
||||||
"amd/src",
|
"amd/src",
|
||||||
"amd/src/*",
|
"amd/src/*",
|
||||||
".git",
|
".git",
|
||||||
|
|
21
build.sh
21
build.sh
|
@ -1,9 +1,30 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
SCRIPTDIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
SCRIPTDIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
WD=`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
|
||||||
|
# so we can be sure all javascript is properly built from the most recent source
|
||||||
|
cd $SCRIPTDIR
|
||||||
|
grunt amd
|
||||||
|
|
||||||
# run the build php script
|
# run the build php script
|
||||||
php ${SCRIPTDIR}/build.php $@
|
php ${SCRIPTDIR}/build.php $@
|
||||||
|
|
||||||
|
if [[ "$VUEMODE" == "dev" ]]; then
|
||||||
|
# switch vuejs vack to original mode
|
||||||
|
$SCRIPTDIR/vuemode.sh $VUEMODE
|
||||||
|
|
||||||
|
# re-do the grunt compiling
|
||||||
|
grunt amd
|
||||||
|
fi
|
||||||
|
|
||||||
# return to the working directory
|
# return to the working directory
|
||||||
cd $WD
|
cd $WD
|
38
vuemode.sh
Executable file
38
vuemode.sh
Executable file
|
@ -0,0 +1,38 @@
|
||||||
|
#!/bin/bash
|
||||||
|
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||||
|
VUESRC="$SCRIPTPATH/amd/src/vue"
|
||||||
|
VUEBUILD="$SCRIPTPATH/amd/build/vue"
|
||||||
|
VUEPROD="$SCRIPTPATH/amd/src/vue/prod"
|
||||||
|
VUEDEV="$SCRIPTPATH/amd/src/vue/dev"
|
||||||
|
|
||||||
|
VUEJS_MD5=($(md5sum $VUESRC/vue.js))
|
||||||
|
VUEPROD_MD5=($(md5sum $VUEPROD/vue.js))
|
||||||
|
VUEDEV_MD5=($(md5sum $VUEDEV/vue.js))
|
||||||
|
|
||||||
|
if [[ "$VUEJS_MD5" == "$VUEDEV_MD5" ]]; then
|
||||||
|
MODE="dev"
|
||||||
|
elif [[ "$VUEJS_MD5" == "$VUEPROD_MD5" ]]; then
|
||||||
|
MODE="prod"
|
||||||
|
elif [[ "$2" != "-f" && "$1" != "query" ]]; then
|
||||||
|
echo "ERROR: $VUELINK is not a a copy of either ../vue/vue-dev.js or ../vue/vue-prod.js"
|
||||||
|
echo "Maybe you manually changed it? Use -f to force overwrite in this case"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# SINCE the production version of vue.js s already minified, we may get away with simply copying it
|
||||||
|
# to the build directory
|
||||||
|
if [ "$1" == "dev" ]; then
|
||||||
|
cp $VUEDEV/vue.js $VUEBUILD/vue.min.js
|
||||||
|
cp $VUEDEV/vue.js $VUESRC/vue.js
|
||||||
|
rm $VUEBUILD/vue.min.js.map 2>/dev/null
|
||||||
|
elif [ "$1" == "prod" ]; then
|
||||||
|
cp $VUEPROD/vue.js $VUEBUILD/vue.min.js
|
||||||
|
cp $VUEPROD/vue.js $VUESRC/vue.js
|
||||||
|
rm $VUEBUILD/vue.min.js.map 2>/dev/null
|
||||||
|
elif [ "$1" == "query" ]; then
|
||||||
|
echo $MODE
|
||||||
|
else
|
||||||
|
echo "Switch VueJS between development and production mode"
|
||||||
|
echo "Usage:"
|
||||||
|
echo "$SCRIPTNAME <dev|prod|query> [-f]"
|
||||||
|
fi
|
Loading…
Reference in a new issue