2022-08-01 07:52:01 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-07-10 08:49:09 +02:00
|
|
|
set -e
|
2022-08-01 07:52:01 +02:00
|
|
|
|
2023-10-27 08:03:58 +02:00
|
|
|
# This builds the assets for the Web UI, defaulting to a release build.
|
2022-08-01 07:52:01 +02:00
|
|
|
if [ ! -f build_wasm.sh ]; then
|
2023-03-02 03:47:23 +01:00
|
|
|
echo "Please run from the crate directory. (server/web_ui)"
|
2022-08-01 07:52:01 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ -z "$(which rsync)" ]; then
|
|
|
|
echo "Cannot find rsync which is needed to move things around, quitting!"
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-06-27 03:38:22 +02:00
|
|
|
if [ -z "$(which wasm-pack)" ]; then
|
|
|
|
echo "Cannot find wasm-pack which is needed to build the UI, quitting!"
|
|
|
|
exit 1
|
|
|
|
fi
|
2024-02-29 03:25:40 +01:00
|
|
|
if [ -z "$(which wasm-bindgen)" ]; then
|
|
|
|
echo "Cannot find wasm-bindgen which is needed to build the UI, quitting!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ -z "$(which bc)" ]; then
|
|
|
|
echo "Cannot find bc which is needed to build the UI, quitting!"
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-06-27 03:38:22 +02:00
|
|
|
|
2023-10-27 08:03:58 +02:00
|
|
|
if [ -z "${BUILD_FLAGS}" ]; then
|
|
|
|
export BUILD_FLAGS="--release"
|
2022-08-01 07:52:01 +02:00
|
|
|
fi
|
|
|
|
|
2023-10-27 08:03:58 +02:00
|
|
|
echo "Cleaning up pkg dir"
|
|
|
|
find pkg/ -type f -delete
|
|
|
|
find pkg/ -mindepth 1 -type d -delete
|
2022-08-01 07:52:01 +02:00
|
|
|
|
2023-10-27 08:03:58 +02:00
|
|
|
touch ./pkg/ANYTHING_HERE_WILL_BE_DELETED_IN_BUILDS
|
|
|
|
# cp ../../README.md ./pkg/
|
|
|
|
# cp ../../LICENSE.md ./pkg/
|
|
|
|
if [ -f ./pkg/.gitignore ]; then
|
2022-08-01 07:52:01 +02:00
|
|
|
rm ./pkg/.gitignore
|
2023-10-27 08:03:58 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# copy the shared static things
|
2023-11-11 00:26:44 +01:00
|
|
|
rsync -av shared/static/* admin/static/* user/static/* login_flows/static/* pkg/
|
2023-10-27 08:03:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
cd admin
|
|
|
|
echo "building admin"
|
|
|
|
../individual_build.sh || exit 1
|
|
|
|
cd ..
|
|
|
|
echo "done building admin"
|
|
|
|
|
|
|
|
cd login_flows
|
|
|
|
echo "building login_flows"
|
|
|
|
../individual_build.sh || exit 1
|
|
|
|
cd ..
|
|
|
|
echo "done building login_flows"
|
|
|
|
|
|
|
|
cd user
|
|
|
|
echo "building user"
|
|
|
|
../individual_build.sh || exit 1
|
|
|
|
cd ..
|
|
|
|
echo "done building user"
|
|
|
|
|
|
|
|
|
2023-07-10 08:49:09 +02:00
|
|
|
|
2023-09-05 03:50:51 +02:00
|
|
|
if [ -z "${SKIP_BROTLI}" ]; then
|
|
|
|
# updates the brotli-compressed files
|
2023-10-27 08:03:58 +02:00
|
|
|
echo "brotli-compressing compressible files over 16KB in size..."
|
|
|
|
find ./pkg -size +16k -type f \
|
|
|
|
-not -name '*.br' \
|
|
|
|
-not -name '*.png' \
|
|
|
|
-exec ./find_best_brotli.sh "{}" \; || exit 1
|
|
|
|
fi
|
|
|
|
|