Skip to content

docs: add release OG image generator#1258

Merged
fi3ework merged 1 commit into
mainfrom
feat/og-image-generator
Jul 2, 2026
Merged

docs: add release OG image generator#1258
fi3ework merged 1 commit into
mainfrom
feat/og-image-generator

Conversation

@fi3ework

@fi3ework fi3ework commented May 14, 2026

Copy link
Copy Markdown
Member

Summary

image

Background

Each Rstest release needs an Open Graph image for its blog post og:image / twitter:image tags. Until now there was no template — only a single site-level rstest-og-image.png lived in rstack-design-resources, and per-release covers had to be hand-composed in Sketch.

Implementation

  • Add website/scripts/og-image/ (cli.mts + render.mts + template.mts) plus a pnpm gen:og --version <ver> script.
  • Pipeline: satori (HTML → SVG via satori-html) → @resvg/resvg-js (SVG → PNG) rendered at 2x zoom for retina (final 2400×1260). Raw resvg PNG is emitted as-is; the CLI prints a tip with the TinyPNG URL on its own indented line so the URL stays clickable, and the author compresses externally (TinyPNG / Squoosh / ImageOptim) before committing to design-resources. This keeps the toolchain free of native deps like sharp/libvips.
  • Logo SVG is fetched from the assets.rspack.rs CDN at generation time so logo updates flow through without re-committing the template.
  • Background uses randomized radial gradients: weighted color schemes (tonal/duo/tri), quadrant-anchored blob placement to keep gradient mass off the central text column, single-blob visibility floor. Blob aspect ratio is capped at ~1.4:1 and elongated blobs hug a canvas edge so one long edge clips off-canvas — together these prevent "long bar" shapes floating mid-frame.
  • Space Grotesk (SIL OFL) is committed under assets/fonts/ (the geist npm package pulls in next>=13.2 so its raw .ttf was avoided).
  • Documents the manual workflow in website/AGENTS.md + website/README.md: generate locally, compress externally, commit the PNG to rstackjs/rstack-design-resources, CDN serves it.

Out of scope

Wiring rspress.config.ts to route each blog routePath → per-version PNG is a separate follow-up. The site still uses the single static og:image via pluginOpenGraph; only the generator + assets are added here.

User Impact

None — internal tooling for release authors. Generated PNGs are committed to rstack-design-resources, not this repo.

Checklist

  • Tests updated (or not required). Manual CLI script; verified by running it (pnpm gen:og --version 0.5 --description …).
  • Documentation updated (or not required). website/AGENTS.md + website/README.md updated.

Validation: ran pnpm format, pnpm run lint, pnpm run typecheck, and pnpm --filter rstest-website build. Skipped pnpm test / e2e because the change is a standalone website CLI script with no runtime impact on @rstest/* packages.

@fi3ework fi3ework changed the title feat(website): add release OG image generator docs(website): add release OG image generator May 14, 2026
@github-actions

github-actions Bot commented May 14, 2026

Copy link
Copy Markdown

Rsdoctor Bundle Diff Analysis

Found 12 projects in monorepo, 0 projects with changes.

📊 Quick Summary
Project Total Size Change
adapter-rsbuild 3.7 KB 0
adapter-rslib 24.7 KB 0
adapter-rspack 7.8 KB 0
browser 2.0 MB 0
browser-react 3.7 KB 0
browser-ui 803.5 KB 0
coverage-istanbul 9.6 KB 0
core/browser 970.0 KB 0
core/loaders 869.0 B 0
core/main 1.7 MB 0
vscode/extension 26.9 MB 0
vscode/worker 14.4 KB 0

Generated by Rsdoctor GitHub Action

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 14, 2026

Copy link
Copy Markdown

Deploying rstest with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8f97c9d
Status: ✅  Deploy successful!
Preview URL: https://da989181.rstest.pages.dev
Branch Preview URL: https://feat-og-image-generator.rstest.pages.dev

View logs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 84c20799b8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread website/README.md Outdated
@fi3ework fi3ework force-pushed the feat/og-image-generator branch from 8c7b7d0 to a17b810 Compare May 15, 2026 03:29
@fi3ework fi3ework changed the title docs(website): add release OG image generator feat(website): add release OG image generator May 15, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a17b810aeb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread website/AGENTS.md Outdated
@fi3ework fi3ework force-pushed the feat/og-image-generator branch from a17b810 to 8abdbe7 Compare May 15, 2026 03:35

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 86bc34ffc3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread website/scripts/og-image/assets/fonts/LICENSE.txt
@fi3ework fi3ework requested a review from 9aoy May 15, 2026 05:16
@fi3ework fi3ework force-pushed the feat/og-image-generator branch from d4f6185 to 7c00332 Compare July 2, 2026 07:50
@fi3ework fi3ework enabled auto-merge (squash) July 2, 2026 07:51
@fi3ework fi3ework changed the title feat(website): add release OG image generator docs(website): add release OG image generator Jul 2, 2026
@fi3ework fi3ework changed the title docs(website): add release OG image generator docs: add release OG image generator Jul 2, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7c0033287e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread website/package.json
"build": "rspress build",
"build:agent-install": "node scripts/buildAgentInstall.mjs",
"dev": "rspress dev",
"gen:og": "node --experimental-strip-types scripts/og-image/cli.mts",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep gen:og runnable on supported Node 20

On Node 20.19.x, which this repo still allows via the root engines (^20.19.0 || >=22.12.0), this script exits before loading because --experimental-strip-types was only added in Node 22.6.0 (Node CLI docs list "Added in: v22.6.0", and the Node 20.19.0 CLI options do not include it). Release authors using a supported Node 20 LTS environment therefore cannot run pnpm gen:og; please either make the script executable under Node 20 or narrow the required engine for this workflow.

Useful? React with 👍 / 👎.

Comment thread website/AGENTS.md

1. Run `pnpm gen:og --version <ver> --description "<tagline>"` from `website/`. Use `--out` to write directly into a local clone of the design-resources repo at `rstest/assets/rstest-og-image-v{version-with-hyphens}.png` (e.g. `v0-5.png`). The background gradient is randomized (color scheme, blob count, placement) on every run and there is no seed flag — re-run until you get a composition you like before committing.
2. Commit the PNG in the design-resources repo and open a PR — that repo is the only place release PNGs are stored.
3. After CDN deploy, the PNG is reachable at `assets.rspack.rs/rstest/assets/rstest-og-image-v0-5.png`. Wiring it up per blog `routePath` in `rspress.config.ts` is a separate follow-up — the site currently sets a single static `og:image` via `pluginOpenGraph`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Align the release asset path with the OG hook

Fresh evidence: the current website/rspress.config.ts:84-90 already maps release blog routes to https://assets.rspack.rs/rstest/rstest-og-image-v*.png, so this documented /rstest/assets/... CDN target (and the "separate follow-up" wording) makes release authors upload generated images to a path the live og:image hook never requests. For any release following the workflow, the blog keeps pointing at /rstest/rstest-og-image-vX-Y.png while the new PNG sits under /rstest/assets/; align the storage path or the config mapping.

Useful? React with 👍 / 👎.

@fi3ework fi3ework force-pushed the feat/og-image-generator branch from 7c00332 to 8f97c9d Compare July 2, 2026 08:07

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8f97c9d036

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const end = `hsla(${h}, ${s}%, ${l}%, 0)`;
return `radial-gradient(ellipse ${w}% ${h2}% at ${x}% ${y}%, ${start}, ${end} ${endStop}%)`;
});
return `${blobs.join(', ')}, #ffffff`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use supported layers for the randomized background

When pnpm gen:og renders any card, this returns at least two comma-separated background layers (radial-gradient(...), #ffffff, and often more) and template.mts injects them via the background shorthand. Satori’s CSS support is limited to a single backgroundImage/backgroundColor layer, so these stacked blobs are not a supported input and the generated PNGs can lose or drop the randomized 1–3 blob background instead of matching the intended design. Please compose the blobs as separate positioned elements/SVG layers or feed Satori supported single-layer styles.

Useful? React with 👍 / 👎.

@fi3ework fi3ework merged commit 206e952 into main Jul 2, 2026
13 checks passed
@fi3ework fi3ework deleted the feat/og-image-generator branch July 2, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants