#!/usr/bin/env bash # Rebuild the vendored frontend bundles in ../static/ from scratch. # Requires Node. Run from this build/ directory: ./build.sh set -euo pipefail cd "$(dirname "$0")" npm install --no-fund --no-audit \ @codemirror/state@6 @codemirror/view@6 @codemirror/commands@6 @codemirror/language@6 \ @codemirror/lang-python@6 @codemirror/lang-javascript@6 @codemirror/lang-java@6 @codemirror/lang-cpp@6 \ @lezer/highlight@1 @gradio/client@1 esbuild EB=./node_modules/.bin/esbuild "$EB" cm-entry.mjs --bundle --format=iife --global-name=CM6 --minify --outfile=../static/cm.bundle.js "$EB" gradio-entry.mjs --bundle --format=iife --global-name=GradioClient --minify --platform=browser \ --external:fs/promises --external:path --external:fs --external:url --external:stream \ --external:crypto --external:http --external:https --external:os --external:child_process \ --outfile=../static/gradio-client.js curl -sL "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js" -o ../static/mermaid.min.js echo "Rebuilt static/{cm.bundle.js, gradio-client.js, mermaid.min.js}. (Fonts are vendored separately.)"