mirror of
https://github.com/vercel/chat.git
synced 2026-09-14 18:32:29 +08:00
7ecb9730e3
Adds official platform adapter branding across the docs site, npm
READMEs, and social previews.
- **Homepage**: add Twilio to the supported-platforms logo grid
- **OG images**: add custom artwork for all 11 official platform
adapters under content/adapters/official/og/; serve static-first from
the existing /adapters/official/{slug}/og route with dynamic fallback
for state adapters
- **READMEs**: add linked hero banners to every official platform
adapter package README, using the live OG URL as the single image source
- **Tests**: integration-test guardrails for OG image coverage, README
banner discoverability, and knip-clean helpers
- **Changeset**: empty changeset for CI
<img width="2400" height="1256" alt="Chat SDK - Slack"
src="https://github.com/user-attachments/assets/4d186a1c-5651-44b8-8698-091ee23b44da"
/>
Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
34 lines
832 B
TypeScript
34 lines
832 B
TypeScript
import { access, readFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
|
|
const OFFICIAL_PLATFORM_OG_DIR = join(
|
|
process.cwd(),
|
|
"content/adapters/official/og"
|
|
);
|
|
|
|
const OFFICIAL_PLATFORM_OG_EXTENSIONS = [
|
|
{ ext: "png", contentType: "image/png" },
|
|
{ ext: "jpg", contentType: "image/jpeg" },
|
|
{ ext: "webp", contentType: "image/webp" },
|
|
] as const;
|
|
|
|
export const readOfficialPlatformOgImage = async (
|
|
slug: string
|
|
): Promise<{ contentType: string; data: Buffer } | null> => {
|
|
for (const { ext, contentType } of OFFICIAL_PLATFORM_OG_EXTENSIONS) {
|
|
const path = join(OFFICIAL_PLATFORM_OG_DIR, `${slug}.${ext}`);
|
|
|
|
try {
|
|
await access(path);
|
|
return {
|
|
contentType,
|
|
data: await readFile(path),
|
|
};
|
|
} catch {
|
|
// Try the next extension.
|
|
}
|
|
}
|
|
|
|
return null;
|
|
};
|