Files
vacuum-wall/scripts/update-vendor.sh
T
mteehan 5ac69dfa7e refactor: move JS vendors to vendor/ with versioned filenames
Vendor JS files to vendor/ with versioned names, symlinks in
webui/static/ select active version. Update update-vendor.sh and
AGENTS.md.
2026-05-25 01:20:37 +00:00

43 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Download and vendor libraries into vendor/.
# Run from the project root after updating the VERSION variables below.
set -euo pipefail
# ---- Library versions ----
HTMX_VERSION="2.0.4"
HTMX_JSON_ENC_VERSION="2.0.0"
ACME_VERSION="3.1.3"
VENDOR="vendor"
STATIC="webui/static"
download() {
local name="$1" url="$2" dest="$3"
if [[ -n "${SKIP_DOWNLOAD:-}" ]]; then
echo "[skip] $name (SKIP_DOWNLOAD is set)"
return
fi
echo "[download] $name$dest"
curl -sfL -o "$dest" "$url"
}
download "htmx@${HTMX_VERSION}" \
"https://unpkg.com/htmx.org@${HTMX_VERSION}/dist/htmx.min.js" \
"${VENDOR}/htmx-${HTMX_VERSION}.min.js"
download "htmx-ext-json-enc@${HTMX_JSON_ENC_VERSION}" \
"https://unpkg.com/htmx-ext-json-enc@${HTMX_JSON_ENC_VERSION}/json-enc.js" \
"${VENDOR}/json-enc-${HTMX_JSON_ENC_VERSION}.js"
download "acme.sh@${ACME_VERSION}" \
"https://raw.githubusercontent.com/acmesh-official/acme.sh/${ACME_VERSION}/acme.sh" \
"${VENDOR}/acme.sh"
chmod +x "${VENDOR}/acme.sh"
# Symlinks in webui/static/ select the active version
ln -sf "../../vendor/htmx-${HTMX_VERSION}.min.js" "${STATIC}/htmx.min.js"
ln -sf "../../vendor/json-enc-${HTMX_JSON_ENC_VERSION}.js" "${STATIC}/json-enc.js"
echo "[done] All libraries vendored."