underbbs/build.sh

29 lines
547 B
Bash
Executable File

#!/bin/sh
case "$1" in
front)
if [ ! -e ./frontend/.js ]; then
mkdir ./frontend/.js
fi
buildlog=$(mktemp)
if [ ! -z $"{PLAN9}" ]; then
npx tsc 2>&1 | nobs | sed -e 's/\.ts\(/\.ts:/g' -e 's/,[0-9]+\)://g' > ${buildlog}
else
npx tsc 2>&1 > ${buildlog}
fi
if [ -s ${buildlog} ]; then
cat ${buildlog} | head
else
npx webpack --config webpack.config.js
fi
rm ${buildlog}
;;
server)
go mod tidy
go build
;;
*)
echo "usage: ${0} <front|server>"
;;
esac