bitque/web/scripts/prod.sh

39 lines
1.2 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2021-10-08 09:38:10 +02:00
export JIRS_SERVER_BIND=jirs.ita-prog.pl;
export JIRS_SERVER_PORT=443;
RSASS_PATH=$(command -v rsass)
if [[ "${RSASS_PATH}" == "" ]]; then
cargo install rsass --features=commandline
fi
2021-01-07 09:13:13 +01:00
export PROJECT_ROOT=$(git rev-parse --show-toplevel)
2021-10-05 14:34:20 +02:00
export CLIENT_ROOT=${PROJECT_ROOT}/web
2021-01-07 09:13:13 +01:00
export HI_ROOT=${PROJECT_ROOT}/highlight/jirs-highlight
export MODE=force
export BUILD_TYPE=--release
. .env
2020-05-19 20:54:46 +02:00
rm -Rf build
mkdir build
2020-11-25 20:14:52 +01:00
cd $CLIENT_ROOT
2021-10-08 09:38:10 +02:00
wasm-pack build --mode normal --release --out-name jirs --out-dir ${CLIENT_ROOT}/build --target web
# wasm-pack build --mode normal --dev --out-name jirs --out-dir ${CLIENT_ROOT}/build --target web
2020-11-25 20:14:52 +01:00
2021-10-08 09:38:10 +02:00
#cd $HI_ROOT
#wasm-pack build --mode normal --release --out-name hi --out-dir ${CLIENT_ROOT}/build --target web
2020-11-25 20:14:52 +01:00
cd $CLIENT_ROOT
rm -Rf ${CLIENT_ROOT}/build/styles.css
2021-10-05 14:34:20 +02:00
rsass -t Compressed ${PROJECT_ROOT}/web/js/styles.css > ${CLIENT_ROOT}/build/styles.css
2021-10-08 09:38:10 +02:00
cp -r ${CLIENT_ROOT}/static/* ${CLIENT_ROOT}/build
cat ./static/index.js |
sed -e "s/process.env.JIRS_SERVER_BIND/'$JIRS_SERVER_BIND'/g" |
2021-10-08 09:38:10 +02:00
sed -e "s/process.env.JIRS_SERVER_PORT/'$JIRS_SERVER_PORT'/g" &> ${CLIENT_ROOT}/build/index.js
2021-10-08 09:38:10 +02:00
cp ${CLIENT_ROOT}/js/template.html ${CLIENT_ROOT}/build/index.html