Implemented vue dve/prod mode switch

This commit is contained in:
PMKuipers 2023-07-26 16:42:21 +02:00
parent 6f773104a9
commit f1479c8afa
5 changed files with 22784 additions and 10857 deletions

File diff suppressed because it is too large Load diff

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

File diff suppressed because one or more lines are too long

View file

@ -1,3 +1,29 @@
#!/bin/bash #!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 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 $@ 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
View 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