mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 03:24:54 +00:00
17 lines
932 B
TypeScript
17 lines
932 B
TypeScript
// Writes src/brand.ts from the site's logo files (services/site/src/asset/brand), so the menu carries
|
|
// them inline and works on any host: run `bun script/brand.ts` after the brand files change.
|
|
const source = new URL("../../../services/site/src/asset/brand/", import.meta.url)
|
|
const files = await Promise.all(
|
|
(["transparent", "solid"] as const).flatMap((style) =>
|
|
(["logo", "wordmark"] as const).flatMap((kind) =>
|
|
(["light", "dark"] as const).map(async (tone) => {
|
|
const svg = await Bun.file(new URL(`opencode-${kind}-${style}-${tone}.svg`, source)).text()
|
|
return ` "${kind}-${style}-${tone}": ${JSON.stringify(svg.replace(/\n/g, "").trim())},`
|
|
}),
|
|
),
|
|
),
|
|
)
|
|
await Bun.write(
|
|
new URL("../src/brand.ts", import.meta.url),
|
|
`// Generated by script/brand.ts from services/site/src/asset/brand. Do not edit.\nexport const brandSvgs: Record<string, string> = {\n${files.join("\n")}\n}\n`,
|
|
)
|