SPB Git

Repository Public

record.mts 807 B 9 lines typescript

1// Records the server's outputs for documents produced by SPNotesCore tests (read-only: imports the worktree's modules, writes to /tmp).2import fs from "node:fs";3import { toMarkdown, docText, wordCount, extractPageRefs } from "/Users/simon-pierreboucher/dev/note-next/src/lib/editor/text";4import { docToHtml } from "/Users/simon-pierreboucher/dev/note-next/src/lib/export/html";5const docs = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));6const out = docs.map((doc: any) => { const text = docText(doc); let html: string | null = null; try { html = docToHtml(doc).html; } catch { html = null; } return { doc, markdown: toMarkdown(doc), text, words: wordCount(text), html, refs: extractPageRefs(doc) }; });7fs.writeFileSync(process.argv[3], JSON.stringify(out));8console.log("recorded", out.length);9
Files main
Menu

Theme