2022-11-27 03:59:26 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
cd "$(git rev-parse --show-toplevel)"
|
|
|
|
|
|
|
|
VERSION="$(jq -r ".version" <package.json)"
|
2022-11-27 04:02:52 +08:00
|
|
|
DIST_NAME="um-web.$1.v${VERSION}"
|
2022-11-27 03:59:26 +08:00
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
"modern") npm run build -- --modern ;;
|
|
|
|
"legacy") npm run build ;;
|
|
|
|
"extension") npm run make-extension ;;
|
|
|
|
|
|
|
|
*)
|
2022-11-27 04:11:05 +08:00
|
|
|
echo "Unknown command: $1"
|
|
|
|
exit 1
|
|
|
|
;;
|
2022-11-27 03:59:26 +08:00
|
|
|
esac
|
|
|
|
|
|
|
|
mv dist "${DIST_NAME}"
|
|
|
|
zip -rJ9 "${DIST_NAME}.zip" "${DIST_NAME}"
|
2022-11-27 04:11:05 +08:00
|
|
|
|
2022-11-27 04:21:43 +08:00
|
|
|
if [ "$1" = "legacy" ]; then
|
2022-11-27 04:11:05 +08:00
|
|
|
# For upcoming extension build
|
|
|
|
mv "${DIST_NAME}" dist
|
|
|
|
else
|
|
|
|
rm -rf "${DIST_NAME}"
|
|
|
|
fi
|