117 lines · 3.5 KB
#!/usr/bin/env bun
/** Writes sample social cards to /tmp/og-samples for visual review: `bun run scripts/og-samples.tsx`. */
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import { FEATURE_PAGES } from "~/lib/marketing/features";
import { AccountCard, FeatureCard, RepoCard, SiteCard } from "~/server/og/cards";
import { loadRuntimeFromDisk } from "~/server/og/disk-runtime";
import { renderPng } from "~/server/og/render";

const OUT = "/tmp/og-samples";
const HOST = "gitfor.dev";
const avatar = `data:image/png;base64,${readFileSync(join(import.meta.dir, "../public/android-chrome-512x512.png")).toString("base64")}`;
const runtime = loadRuntimeFromDisk();

const samples = {
  site: <SiteCard host={HOST} />,
  "repo-full": (
    <RepoCard
      host={HOST}
      avatar={avatar}
      repo={{
        owner: "taigrr",
        name: "stig",
        description:
          "Open-source Git hosting on Cloudflare Workers: repositories, pull requests and code review, Actions-style CI, issues, security scanning and static sites, all in one deployable Worker you can run yourself.",
        stars: 12_480,
        forks: 431,
        openIssues: 27,
        openPulls: 1,
        avatarKey: "sample",
        latestRelease: "v1.4.0",
        topics: ["git", "cloudflare-workers", "ci", "code-review", "self-hosted"],
        languages: [
          { name: "TypeScript", percent: 91 },
          { name: "CSS", percent: 4 },
          { name: "Shell", percent: 3 },
          { name: "Other", percent: 2 },
        ],
      }}
    />