yewprint/build.sh

44 lines
947 B
Bash
Raw Normal View History

2020-09-03 14:45:38 +00:00
#!/bin/bash
if [ ${#@} == 0 ]; then
2020-09-27 12:49:05 +00:00
options=(--release)
2020-09-03 14:45:38 +00:00
else
options=()
fi
2020-09-03 15:14:16 +00:00
if ! [ -f core.tgz ]; then
curl -o core.tgz https://registry.npmjs.org/@blueprintjs/core/-/core-3.30.0.tgz
fi
2020-09-27 12:49:05 +00:00
if ! [ -f docs-theme.tgz ]; then
curl -o docs-theme.tgz https://registry.npmjs.org/@blueprintjs/docs-theme/-/docs-theme-3.7.1.tgz
fi
2020-09-21 11:00:10 +00:00
# cleanup
2020-09-21 12:09:31 +00:00
mkdir -p public
rm -fR public/.gitignore public/*
# copy index.html
2020-09-25 19:47:11 +00:00
cp static/* public/
# copy favicon
2020-09-27 12:49:05 +00:00
cp yewprint-doc/src/logo.svg public/favicon.svg
2020-09-21 12:09:31 +00:00
# download blueprint css
tar xzOf core.tgz package/lib/css/blueprint.css > public/blueprint.css
2020-09-20 17:59:47 +00:00
2020-09-27 12:49:05 +00:00
# download blueprint doc css
tar xzOf docs-theme.tgz package/lib/css/docs-theme.css > public/docs-theme.css
2020-09-21 11:00:10 +00:00
# build
2020-09-27 12:49:05 +00:00
(cd yewprint-doc && \
wasm-pack build --no-typescript --target web --out-name wasm \
--out-dir ../public "${options[@]}" "$@")
2020-09-03 14:45:38 +00:00
rc=$?
2020-09-20 17:59:47 +00:00
2020-09-21 12:09:31 +00:00
rm -fR public/{.gitignore,package.json,README.md}
2020-09-03 14:45:38 +00:00
echo Wasm size: $(cat public/*.wasm | wc -c)
2020-09-03 14:45:38 +00:00
exit $rc