oswilno/scripts/run-wasm-pack.sh

24 lines
631 B
Bash
Raw Normal View History

2022-07-22 13:05:13 +02:00
#!/usr/bin/env bash
set -ex
. ${PWD}/../.env
rm -Rf tmp
mkdir -p tmp
mkdir -p target
cd ${CLIENT_ROOT}
wasm-pack --verbose build --mode ${MODE} ${BUILD_TYPE} --out-name oswilno --out-dir ${CLIENT_ROOT}/build --target web
cd ${CLIENT_ROOT}
rm -Rf ${COPY_TO}/styles.css
rsass -t Expanded ${CLIENT_ROOT}/js/styles.css >${COPY_TO}/styles.css
cp -r ${CLIENT_ROOT}/static/* ${COPY_TO}
cp ${CLIENT_ROOT}/build/*.{js,wasm} ${COPY_TO}/
sed -i 's/\([a-z0-9]*\)Element {/\1Element extends HTMLElement {/g' ${COPY_TO}/oswilno.js
sed -i 's/constructor\(([a-z0-9 ,]*)\) {/constructor() {super();const el = this;/g' ${COPY_TO}/oswilno.js