refactoring

This commit is contained in:
Simon Gardling
2022-04-21 23:25:33 -04:00
parent 06b062b5b4
commit 5d153f4842
14 changed files with 166 additions and 271 deletions

View File

@@ -18,8 +18,9 @@ if test "$1" == "" || test "$1" == "release"; then
wasm_opt #apply wasm optimizations
echo "Binary size (pre-strip): $(du -sb pkg/ytbn_graphing_software_bg.wasm)"
llvm-strip --strip-all pkg/ytbn_graphing_software_bg.wasm
elif test "$1" == "debug"; then
RUSTFLAGS=--cfg=web_sys_unstable_apis wasm-pack build --target web --debug --no-typescript
RUSTFLAGS=--cfg=web_sys_unstable_apis wasm-pack build --target web --dev --no-typescript
else
echo "ERROR: build.sh, argument invalid"
exit 1
@@ -27,12 +28,13 @@ fi
mkdir tmp
cp -r pkg/ytbn_graphing_software_bg.wasm tmp/
sed -i 's/fatal: true/fatal: false/g' pkg/ytbn_graphing_software.js
sed -i "s/TextEncoder('utf-8')/TextEncoder('utf-8', { ignoreBOM: true, fatal: false })/g" pkg/ytbn_graphing_software.js
minify pkg/ytbn_graphing_software.js > tmp/ytbn_graphing_software.js
sed -i 's/fatal: true/fatal: false/g' tmp/ytbn_graphing_software.js
sed -i "s/TextEncoder('utf-8')/TextEncoder('utf-8', { ignoreBOM: true, fatal: false })/g" tmp/ytbn_graphing_software.js
cp www/* tmp/
minify www/index.html > tmp/index.html
minify www/sw.js > tmp/sw.js