Implemented vue dve/prod mode switch
This commit is contained in:
parent
6f773104a9
commit
f1479c8afa
21658
amd/src/vue.js
21658
amd/src/vue.js
File diff suppressed because it is too large
Load Diff
11911
amd/vue/dev/vue.js
Normal file
11911
amd/vue/dev/vue.js
Normal file
File diff suppressed because it is too large
Load Diff
8
amd/vue/prod/vue.js
Normal file
8
amd/vue/prod/vue.js
Normal file
File diff suppressed because one or more lines are too long
26
build.sh
26
build.sh
|
@ -1,3 +1,29 @@
|
|||
#!/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
|
||||
grunt amd
|
||||
fi
|
||||
|
||||
# return to the working directory
|
||||
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/"
|
||||
VUEBUILD="$SCRIPTPATH/amd/build"
|
||||
VUEPROD="$SCRIPTPATH/amd/vue/prod"
|
||||
VUEDEV="$SCRIPTPATH/amd/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 New Issue
Block a user