tilastokeskus/frontend/build.sh

23 lines
500 B
Bash
Executable file

#!/usr/bin/env bash
set -eux
set -o pipefail
case "$OSTYPE" in
darwin*) PLATFORM="OSX" ;;
linux*) PLATFORM="LINUX" ;;
bsd*) PLATFORM="BSD" ;;
*) PLATFORM="UNKNOWN" ;;
esac
replace() {
if [[ "${PLATFORM}" == "OSX" || "${PLATFORM}" == "BSD" ]]; then
sed -i "" "$1" "$2"
elif [ "${PLATFORM}" == "LINUX" ]; then
sed -i "$1" "$2"
fi
}
tsc
replace "s#<%= SERVER_PATH %>#${SERVER_PATH}#g" build/*.js
tar -czvf dist.tgz index.html assets/ build/