#!/usr/bin/env bash # Re-download the vendored highlight.js ES modules. # # Run by hand when bumping HLJS_VERSION; the result is committed to git. This is # deliberately NOT part of the Docker build — baking the files into the image is # what keeps the app free of any network dependency at runtime. set -euo pipefail HLJS_VERSION="${HLJS_VERSION:-11.9.0}" BASE="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/${HLJS_VERSION}/es" DEST="$(cd "$(dirname "$0")" && pwd)/hljs" # Keep this list in sync with LANGS in app.py. LANGS=(accesslog apache bash cpp css diff dockerfile go graphql http ini java javascript json markdown nginx php powershell python rust sql typescript xml yaml) mkdir -p "$DEST/languages" echo "highlight.js ${HLJS_VERSION} -> $DEST" curl -fsS "$BASE/core.min.js" -o "$DEST/core.min.js" printf ' %-14s %6s bytes\n' core.min.js "$(wc -c < "$DEST/core.min.js")" for lang in "${LANGS[@]}"; do curl -fsS "$BASE/languages/${lang}.min.js" -o "$DEST/languages/${lang}.min.js" printf ' %-14s %6s bytes\n' "$lang" "$(wc -c < "$DEST/languages/${lang}.min.js")" done echo "total: $(du -sh "$DEST" | cut -f1) in $(find "$DEST" -type f | wc -l) files"