Fix build release

This commit is contained in:
Adrian Woźniak 2021-10-08 16:31:34 +02:00
parent d18e9ff6d6
commit fce3bb727f
No known key found for this signature in database
GPG Key ID: DE43476F72AD3F6C
3 changed files with 21 additions and 29 deletions

View File

@ -15,6 +15,7 @@ export CLIENT_ROOT=${PROJECT_ROOT}/web
export HI_ROOT=${PROJECT_ROOT}/highlight/jirs-highlight
export MODE=force
export BUILD_TYPE=--dev
export COPY_TO=${CLIENT_ROOT}/tmp
echo $PROJECT_ROOT
echo $CLIENT_ROOT

View File

@ -1,38 +1,29 @@
#!/usr/bin/env bash
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
WASM_PACK_PATH=$(command -v wasm-pack)
if [[ "${WASM_PACK_PATH}" == "" ]]; then
cargo install wasm-pack
fi
export PROJECT_ROOT=$(git rev-parse --show-toplevel)
export CLIENT_ROOT=${PROJECT_ROOT}/web
export HI_ROOT=${PROJECT_ROOT}/highlight/jirs-highlight
export MODE=force
export BUILD_TYPE=--release
export COPY_TO=/tmp/wasm
mkdir -p ${COPY_TO}
echo $PROJECT_ROOT
echo $CLIENT_ROOT
cd ${CLIENT_ROOT}
. .env
rm -Rf build
mkdir build
cd $CLIENT_ROOT
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
#cd $HI_ROOT
#wasm-pack build --mode normal --release --out-name hi --out-dir ${CLIENT_ROOT}/build --target web
cd $CLIENT_ROOT
rm -Rf ${CLIENT_ROOT}/build/styles.css
rsass -t Compressed ${PROJECT_ROOT}/web/js/styles.css > ${CLIENT_ROOT}/build/styles.css
cp -r ${CLIENT_ROOT}/static/* ${CLIENT_ROOT}/build
cat ./static/index.js |
sed -e "s/process.env.JIRS_SERVER_BIND/'$JIRS_SERVER_BIND'/g" |
sed -e "s/process.env.JIRS_SERVER_PORT/'$JIRS_SERVER_PORT'/g" &> ${CLIENT_ROOT}/build/index.js
cp ${CLIENT_ROOT}/js/template.html ${CLIENT_ROOT}/build/index.html
${CLIENT_ROOT}/scripts/run-wasm-pack.sh

View File

@ -12,11 +12,11 @@ cd ${CLIENT_ROOT}
wasm-pack --verbose build --mode ${MODE} ${BUILD_TYPE} --out-name jirs --out-dir ${CLIENT_ROOT}/build --target web
cd ${CLIENT_ROOT}
rm -Rf ${CLIENT_ROOT}/build/styles.css
rsass -t Expanded ${PROJECT_ROOT}/web/js/styles.css >${CLIENT_ROOT}/tmp/styles.css
rm -Rf ${COPY_TO}/styles.css
rsass -t Expanded ${CLIENT_ROOT}/js/styles.css >${COPY_TO}/styles.css
cp -r ${CLIENT_ROOT}/static/* ${CLIENT_ROOT}/tmp
cp -r ${CLIENT_ROOT}/static/* ${COPY_TO}
cat ${CLIENT_ROOT}/static/index.js &>${CLIENT_ROOT}/tmp/index.js
cp ${CLIENT_ROOT}/build/*.{js,wasm} ${CLIENT_ROOT}/tmp/
cp ${CLIENT_ROOT}/js/template.html ${CLIENT_ROOT}/tmp/index.html
cat ${CLIENT_ROOT}/static/index.js &>${COPY_TO}/index.js
cp ${CLIENT_ROOT}/build/*.{js,wasm} ${COPY_TO}/
cp ${CLIENT_ROOT}/js/template.html ${COPY_TO}/index.html