docs(landing): host blog images in the community repo (#98)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Yaowei Zheng
2026-07-28 01:49:23 +08:00
committed by GitHub
parent 71669b2086
commit 0951dbfb8a
13 changed files with 134 additions and 66 deletions
@@ -10,9 +10,15 @@
* dist -> provision one demo user per UI language (password rotated once so the
* initial-password banner never shows) -> open /models, scroll the OpenRouter group
* to the top of the viewport (Claude Opus 5 sits on its first card row, the free
* rows a few rows below) -> screenshot, light theme, zh + en, into
* public/blog-assets/ as free-models-page-<lang>-light.webp (re-encoded to WebP
* inside Chromium, same as capture-shots.mjs).
* rows a few rows below) -> screenshot, light theme, zh + en, as
* free-models-page-<lang>-light.webp (re-encoded to WebP inside Chromium, same as
* capture-shots.mjs).
*
* Output is a two-step flow, because blog images are not committed to this repo:
* 1. this script writes into the gitignored staging dir packages/landing/.blog-assets/;
* 2. upload the files it produced to the `blog-assets/` directory of the sibling
* `Prism-Shadow/penguin-harness-community` repo, which is what the posts load from
* (the renderer resolves /blog-assets/<name> there — see src/lib/links.ts).
*
* Prereqs: `pnpm --filter @prismshadow/penguin-{skills,core,server,web} build` and
* Playwright's chromium. Run: `node scripts/capture-blog-shots.mjs` (or
@@ -27,7 +33,8 @@ import { chromium } from "@playwright/test";
const HERE = path.dirname(fileURLToPath(import.meta.url));
const ROOT = path.resolve(HERE, "../../..");
const OUT_DIR = path.resolve(HERE, "../public/blog-assets");
// Gitignored staging dir: these images are hosted in the community repo, not committed here.
const OUT_DIR = path.resolve(HERE, "../.blog-assets");
const SRV_PORT = 8944; // Distinct from capture-shots.mjs (8940/8941) so both can run.
// On loopback binds the App is canonically served on `localhost`; the 127.0.0.1
// counterpart is the Workspace-preview host, where /api deliberately answers 401
@@ -2,9 +2,15 @@
* Renders the README / blog benchmark chart from the same data the landing page uses
* (src/lib/benchmark-data.ts), so the static SVGs cannot drift from the site when the
* numbers are refreshed. Emits:
* assets/readme/benchmark-light.svg
* assets/readme/benchmark-dark.svg
* packages/landing/public/blog-assets/benchmark-light.svg
* assets/readme/benchmark-light.svg (committed here, used by the README)
* assets/readme/benchmark-dark.svg (committed here, used by the README)
* packages/landing/.blog-assets/benchmark-light.svg
*
* That last one is a two-step flow: blog images are not committed to this repo, so the file
* lands in the gitignored staging dir packages/landing/.blog-assets/ and is then uploaded to
* the `blog-assets/` directory of the sibling `Prism-Shadow/penguin-harness-community` repo,
* which is what the posts load from (the renderer resolves /blog-assets/<name> there — see
* packages/landing/src/lib/links.ts).
*
* Two panels per suite (accuracy, cost), horizontal bars scaled linearly from zero — the
* cost spread is ~70x, so the PenguinHarness bar is by far the shortest. That is the
@@ -15,7 +21,7 @@
*
* Run: node packages/landing/scripts/render-benchmark-svg.mjs
*/
import { readFileSync, writeFileSync } from "node:fs";
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
@@ -171,9 +177,11 @@ const bench = loadBench();
const targets = [
["light", path.join(REPO, "assets/readme/benchmark-light.svg")],
["dark", path.join(REPO, "assets/readme/benchmark-dark.svg")],
["light", path.join(LANDING, "public/blog-assets/benchmark-light.svg")],
["light", path.join(LANDING, ".blog-assets/benchmark-light.svg")],
];
for (const [theme, file] of targets) {
// The blog staging dir is gitignored, so it does not exist in a fresh clone.
mkdirSync(path.dirname(file), { recursive: true });
writeFileSync(file, render(theme, bench));
console.log(`wrote ${path.relative(REPO, file)}`);
}