vaultwarden-web/scripts/build_web_vault.sh
Stefan Melmuk e94fdf1d38
don't run npm audit fix
currently it fails (because it can't resolve the $tailwindcss reference)
but also in general we might not want to depend on automatic updating the
dependencies without checking them first.
2023-08-31 19:56:08 +02:00

36 lines
943 B
Bash
Executable file

#!/usr/bin/env bash
set -o pipefail -o errexit
BASEDIR=$(RL=$(readlink -n "$0"); SP="${RL:-$0}"; dirname "$(cd "$(dirname "${SP}")"; pwd)/$(basename "${SP}")")
# Error handling
handle_error() {
read -n1 -r -p "FAILED: line $1, exit code $2. Press any key to exit..." _
exit 1
}
trap 'handle_error $LINENO $?' ERR
# Load default script environment variables
# shellcheck source=.script_env
. "${BASEDIR}/.script_env"
# Show used versions
node --version
npm --version
# Build
pushd "${VAULT_FOLDER}"
npm ci
pushd apps/web
npm run dist:oss:selfhost
# Delete debugging map files, optional
#find build -name "*.map" -delete
# Create vw-version.json with the latest tag from the remote repo.
printf '{"version":"%s"}' \
"$(git -c 'versionsort.suffix=-' ls-remote --tags --refs --sort='v:refname' https://github.com/dani-garcia/bw_web_builds.git 'v*' | tail -n1 | grep -Eo '[^\/v]*$')" \
> build/vw-version.json
popd
popd