readmeIn
uses node:fs
import { README } from "#codebase/tcmts/cli/package_pages"; import fs from "node:fs"; import path from "node:path"; export function readmeIn(dir: string): string | undefined { try { const f = fs.readdirSync(dir).find((n) => README.test(n)); if (!f) return undefined; const text = fs.readFileSync(path.join(dir, f), "utf8"); return text.length > 200_000 ? text.slice(0, 200_000) + "\n\n…" : text; } catch { return undefined; } }