import { readFile } from "node:fs/promises"; import { buildContractSet } from "./generate-contract-set.ts"; /** * The release manifest the dev server serves: the committed placeholder * (public/release-manifest.json) with the contract set of the features * installed now. Boot checks that set against the installed declarations, so * a placeholder with a fixed set refused every app with one more feature * (CONTRACT_SET_PACKAGE_MISSING) until someone edited it by hand. */ export async function devReleaseManifest( source = "public/release-manifest.json", ): Promise { const manifest = JSON.parse(await readFile(source, "utf8")) as Record; manifest["contractSet"] = buildContractSet(); return `${JSON.stringify(manifest, null, 2)}\n`; } // Printed, not written: a file the dev server's watcher picks up after the // server started could reload a page while it is booting. if (process.argv[1]?.endsWith("write-dev-release-manifest.ts")) { process.stdout.write(await devReleaseManifest()); }