2021-03-31 08:32:57 +02:00
|
|
|
#!/usr/bin/env bash
|
2024-03-01 15:23:35 +01:00
|
|
|
# NOTE: this script should be called from the parent directory to
|
|
|
|
# properly work.
|
2021-03-31 08:32:57 +02:00
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
2024-08-05 11:29:14 +02:00
|
|
|
export INCLUDE_STORYBOOK=${BUILD_STORYBOOK:-no};
|
|
|
|
|
2023-12-22 12:40:24 +01:00
|
|
|
export CURRENT_VERSION=$1;
|
|
|
|
export BUILD_DATE=$(date -R);
|
|
|
|
export CURRENT_HASH=${CURRENT_HASH:-$(git rev-parse --short HEAD)};
|
|
|
|
export EXTRA_PARAMS=$SHADOWCLJS_EXTRA_PARAMS;
|
2024-07-23 14:07:46 +02:00
|
|
|
export TS=$(date +%s);
|
2023-12-22 12:40:24 +01:00
|
|
|
|
|
|
|
# Some cljs reacts on this environment variable for define more
|
|
|
|
# performant code on macros (example: rumext)
|
|
|
|
export NODE_ENV=production;
|
2021-03-31 08:32:57 +02:00
|
|
|
|
|
|
|
yarn install || exit 1;
|
2024-03-01 15:23:35 +01:00
|
|
|
rm -rf resources/public;
|
|
|
|
rm -rf target/dist;
|
2023-09-19 12:16:37 +02:00
|
|
|
|
2024-11-07 09:42:36 +01:00
|
|
|
yarn run build:app:main --config-merge "{:release-version \"${CURRENT_HASH}-${TS}\"}" $EXTRA_PARAMS || exit 1
|
2024-11-14 13:08:06 +01:00
|
|
|
yarn run build:wasm || exit 1;
|
2024-10-31 16:43:20 +01:00
|
|
|
yarn run build:app:libs || exit 1;
|
2024-08-05 11:29:14 +02:00
|
|
|
yarn run build:app:assets || exit 1;
|
|
|
|
|
2024-03-27 11:08:59 +01:00
|
|
|
mkdir -p target/dist;
|
2024-03-01 15:23:35 +01:00
|
|
|
rsync -avr resources/public/ target/dist/
|
2021-03-31 08:32:57 +02:00
|
|
|
|
|
|
|
sed -i -re "s/\%version\%/$CURRENT_VERSION/g" ./target/dist/index.html;
|
2024-11-14 18:48:48 +01:00
|
|
|
sed -i -re "s/\%version\%/$CURRENT_VERSION/g" ./target/dist/render.html;
|
|
|
|
sed -i -re "s/\%version\%/$CURRENT_VERSION/g" ./target/dist/rasterizer.html;
|
2022-04-06 11:14:18 +02:00
|
|
|
sed -i -re "s/\%buildDate\%/$BUILD_DATE/g" ./target/dist/index.html;
|
2024-11-14 18:48:48 +01:00
|
|
|
sed -i -re "s/\%buildDate\%/$BUILD_DATE/g" ./target/dist/rasterizer.html;
|
2024-11-14 18:14:43 +01:00
|
|
|
sed -i "s/version=develop/version=$CURRENT_VERSION/g" ./target/dist/js/render_wasm.js;
|
2024-08-01 15:13:21 +02:00
|
|
|
|
2024-08-06 10:46:37 +02:00
|
|
|
if [ "$INCLUDE_STORYBOOK" = "yes" ]; then
|
2024-08-05 11:29:14 +02:00
|
|
|
# build storybook
|
|
|
|
yarn run build:storybook || exit 1;
|
|
|
|
rsync -avr storybook-static/ target/dist/storybook-static;
|
|
|
|
fi
|