yewprint/build.sh

31 lines
759 B
Bash
Raw Normal View History

2020-09-03 16:45:38 +02:00
#!/bin/bash
if [ ${#@} == 0 ]; then
options=(--release)
else
options=()
fi
2020-09-03 17:14:16 +02:00
if ! [ -f core.tgz ]; then
curl -o core.tgz https://registry.npmjs.org/@blueprintjs/core/-/core-3.30.0.tgz
fi
2020-09-13 07:53:12 +02:00
mkdir -p static
2020-09-20 14:59:47 -03:00
2020-09-03 16:45:38 +02:00
rm -fR static/.gitignore static/*
2020-09-20 14:59:47 -03:00
# decompress the tar file but extract the `.css` files only
# find every file in the nested directories and move it behind `./static`
# finally remove every directory behind `./static`
bsdtar xvzf core.tgz -C static \*.css &&
find ./static -mindepth 2 -type f -print -exec mv {} ./static \; &&
find ./static -mindepth 1 -type d -print -exec rm -rf {} \;
2020-09-03 16:45:38 +02:00
wasm-pack build --no-typescript --target web --out-name wasm --out-dir ./static "${options[@]}" "$@"
2020-09-20 14:59:47 -03:00
2020-09-03 16:45:38 +02:00
rc=$?
2020-09-20 14:59:47 -03:00
2020-09-03 16:45:38 +02:00
rm -fR static/{.gitignore,package.json}
exit $rc