1#!/usr/bin/env bash
What wrangler dev and wrangler deploy run before they serve or upload (web/wrangler.toml,
[build]): the link preview's card, then the Worker. So a Worker cannot go out whose own tags
point at a picture that was never made.
tools/build-web.sh (mise run web:build)
The card is drawn by the site's own code (web/src/bin/card.rs prints an SVG) and made a PNG by resvg, because the apps that show link previews do not draw SVG.
16out=web/public/preview 17mkdir -p "$out" 18cargo run --quiet --manifest-path web/Cargo.toml --bin card > "$out/card.svg" 19resvg "$out/card.svg" "$out/card.png" 20rm "$out/card.svg" 21[ -s "$out/card.png" ] || { echo "build-web: the card was not drawn" >&2; exit 1; } 22 23cd web 24exec worker-build --release