1
0
forked from um/web
web/scripts/build-and-package.sh

30 lines
495 B
Bash
Raw Permalink Normal View History

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