vpp-ai-platform/docs/external/diagrams/render.sh
Thomas Bayes e9c1f3d9b7
Some checks are pending
ci / typescript (push) Waiting to run
ci / python (push) Waiting to run
ci / evals (push) Blocked by required conditions
docs: add Chinese architecture brief with localized diagrams
Diagram generator takes a locale (en|zh) via a label dictionary; render.sh
now emits img/ and img/zh/.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bg6jx9vHNHzB91qyV64GQ7
2026-09-02 13:09:07 -04:00

21 lines
788 B
Bash
Executable File

#!/usr/bin/env bash
# Regenerates docs/external/img/*.png from gen.mjs (hand-authored SVG) using headless Chrome.
set -euo pipefail
cd "$(dirname "$0")"
CHROME="${CHROME:-/Applications/Google Chrome.app/Contents/MacOS/Google Chrome}"
for locale in en zh; do
out=../img; [ "$locale" = zh ] && out=../img/zh
mkdir -p "$out"
tmp=$(mktemp -d)
node gen.mjs "$tmp" "$locale" >/dev/null
for f in "$tmp"/*.html; do
n=$(basename "${f%.html}")
dims=$(grep -o 'width="[0-9]*" height="[0-9]*" font' "$f" | head -1 | grep -o '[0-9]*' | tr '\n' ' ')
set -- $dims
"$CHROME" --headless=new --disable-gpu --hide-scrollbars --force-device-scale-factor=2 \
--window-size="$1,$2" --screenshot="$out/$n.png" "$f" >/dev/null 2>&1
done
rm -rf "$tmp"
done
ls ../img ../img/zh