Files
oh-my-opencode/web/scripts/generate-docs-content.mjs
T

32 lines
994 B
JavaScript
Raw Normal View History

import { readFile, writeFile } from "node:fs/promises"
import path from "node:path"
const SECTIONS = [
{ file: "guide/overview.md" },
{ file: "guide/installation.md" },
{ file: "guide/orchestration.md" },
{ file: "guide/agent-model-matching.md" },
{ file: "guide/team-mode.md" },
{ file: "reference/cli.md" },
{ file: "reference/configuration.md" },
{ file: "reference/features.md" },
{ file: "manifesto.md" },
]
const DOCS_ROOT = path.resolve(process.cwd(), "..", "docs")
const OUTPUT = path.resolve(process.cwd(), "lib", "docs-content.generated.ts")
const sources = {}
for (const s of SECTIONS) {
sources[s.file] = await readFile(path.join(DOCS_ROOT, s.file), "utf8")
}
const out =
"// Generated by scripts/generate-docs-content.mjs - DO NOT EDIT\n" +
"export const DOC_SOURCES: Record<string, string> = " +
JSON.stringify(sources, null, 2) +
"\n"
await writeFile(OUTPUT, out)
console.log("Generated " + OUTPUT + " with " + SECTIONS.length + " docs sources")