moodle_local_treestudyplan/build.sh

40 lines
973 B
Bash
Raw Normal View History

#!/bin/bash
2023-08-15 15:34:15 +02:00
SCRIPTDIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
2023-07-26 16:42:21 +02:00
WD=`pwd`
2023-09-01 12:42:21 +02:00
2023-08-22 23:11:50 +02:00
# get the current vuejs mode
VUEMODE=`$SCRIPTDIR/vuemode.sh query`
if [[ $? -eq 1 ]]; then
exit 1
fi
2023-09-01 12:42:21 +02:00
if [[ "$1" == "dev" ]]; then
BUILDMODE='dev';
else
BUILDMODE='prod';
fi
# switch vuejs to build mode
$SCRIPTDIR/vuemode.sh $BUILDMODE
2023-08-22 23:11:50 +02:00
2023-09-08 12:47:29 +02:00
# run the grunt script in the scripts working directory
2023-08-22 23:11:50 +02:00
# so we can be sure all javascript is properly built from the most recent source
cd $SCRIPTDIR
2023-09-05 23:27:34 +02:00
rm -rf "${SCRIPTDIR}/amd/build/" # clear all files in the amd build dir so we don't have leftover files messing things up
2023-08-22 23:11:50 +02:00
grunt amd
grunt scssplugin # plugin specific scss task to compile styles.css from scss files
2023-07-26 16:42:21 +02:00
# run the build php script
2023-08-15 15:34:15 +02:00
php ${SCRIPTDIR}/build.php $@
2023-07-26 16:42:21 +02:00
2023-09-01 12:42:21 +02:00
if [[ "$VUEMODE" != "$BUILDMODE" ]]; then
2023-08-22 23:11:50 +02:00
# switch vuejs vack to original mode
$SCRIPTDIR/vuemode.sh $VUEMODE
# re-do the grunt compiling
grunt amd
fi
2023-07-26 16:42:21 +02:00
# return to the working directory
2023-08-25 11:52:05 +02:00
cd $WD