2020-04-03 17:52:13 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eux
|
|
|
|
set -o pipefail
|
|
|
|
|
2020-04-04 16:09:48 +00:00
|
|
|
VERSION=$(cat ./VERSION)
|
|
|
|
|
2020-04-03 17:52:13 +00:00
|
|
|
case "$OSTYPE" in
|
|
|
|
darwin*) PLATFORM="OSX" ;;
|
|
|
|
linux*) PLATFORM="LINUX" ;;
|
|
|
|
bsd*) PLATFORM="BSD" ;;
|
|
|
|
*) PLATFORM="UNKNOWN" ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
replace() {
|
2020-04-04 16:09:48 +00:00
|
|
|
RE=$1
|
|
|
|
shift
|
2020-04-03 17:52:13 +00:00
|
|
|
if [[ "${PLATFORM}" == "OSX" || "${PLATFORM}" == "BSD" ]]; then
|
2020-04-04 16:09:48 +00:00
|
|
|
sed -i "" "$RE" $*
|
2020-04-03 17:52:13 +00:00
|
|
|
elif [ "${PLATFORM}" == "LINUX" ]; then
|
2020-04-04 16:09:48 +00:00
|
|
|
sed -i "$RE" $*
|
2020-04-03 17:52:13 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
tsc
|
|
|
|
replace "s#<%= SERVER_PATH %>#${SERVER_PATH}#g" build/*.js
|
2020-04-04 16:09:48 +00:00
|
|
|
replace "s#<%= VERSION %>#${VERSION}#g" build/*.js
|
2020-04-03 17:52:13 +00:00
|
|
|
tar -czvf dist.tgz index.html assets/ build/
|