source.fact.ngo a coherence.ngo project

worker/gen-embeds.mjs

raw ↗ · AGPL-3.0

// gen-embeds.mjs — generates worker/embeds.js before each Worker deploy, so the // Worker carries the current source registry and topic ontology (the .yaml // files stay canonical and human-editable in the repo). // node worker/gen-embeds.mjs import fs from "node:fs"; import path from "node:path"; import url from "node:url"; const root = path.resolve(path.dirname(url.fileURLToPath(import.meta.url)), ".."); const sources = fs.readFileSync(path.join(root, "sources/sources.yaml"), "utf8"); const topics = fs.readFileSync(path.join(root, "ontology/topics.yaml"), "utf8"); const out = `// GENERATED by worker/gen-embeds.mjs — do not edit; regenerate before deploy. export const SOURCES_YAML = ${JSON.stringify(sources)}; export const TOPICS_YAML = ${JSON.stringify(topics)}; `; fs.writeFileSync(path.join(root, "worker/embeds.js"), out); console.log("worker/embeds.js regenerated");