47 lines
1.2 KiB
Bash
Executable file
47 lines
1.2 KiB
Bash
Executable file
#!/bin/bash -eav
|
|
target=${1-dev}
|
|
|
|
cd "$(git rev-parse --show-toplevel)"
|
|
|
|
mkdir -p public/compiled
|
|
|
|
ts_apps1="common chess"
|
|
ts_apps2="ceval game tree"
|
|
apps="site chat challenge notify learn insight editor puzzle round analyse lobby tournament tournamentSchedule simul perfStat dasher"
|
|
|
|
YARN_MUTEX="${TMPDIR-/tmp}/.yarn-mutex"
|
|
build_ts() {
|
|
echo "build_ts" "$@"
|
|
set -ev
|
|
cd ui/$1
|
|
grep ': "file:' package.json | cut -d'"' -f2 | xargs -t yarn link
|
|
yarn install --mutex file:$YARN_MUTEX
|
|
yarn run compile
|
|
yarn link
|
|
}
|
|
|
|
build() {
|
|
echo "build" "$@"
|
|
set -ev
|
|
app=$1
|
|
cd ui/$app
|
|
grep ': "file:' package.json | cut -d'"' -f2 | xargs -t yarn link
|
|
yarn install --mutex file:$YARN_MUTEX
|
|
gulp $target
|
|
}
|
|
|
|
(cd ui/types && yarn link)
|
|
|
|
if type -p parallel; then # parallel execution!
|
|
if [ -z "$P_OPTS" -a ! -e ~/.parallel/config ]; then
|
|
P_OPTS="-j+4"
|
|
[ "$TRAVIS" = "true" ] || P_OPTS+=" --bar"
|
|
fi
|
|
parallel --gnu $P_OPTS build_ts ::: $ts_apps1
|
|
parallel --gnu $P_OPTS build_ts ::: $ts_apps2
|
|
parallel --gnu $P_OPTS build ::: $apps
|
|
else # sequential execution
|
|
for app in $ts_apps1 $ts_apps2; do (build_ts $app); done
|
|
for app in $apps; do (build $app); done
|
|
fi
|