import { readFile, writeFile } from "node:fs/promises"; import { buildContractSet } from "./generate-contract-set.ts"; export const DEV_RELEASE_MANIFEST = "public/release-manifest.json"; /** * The release manifest the dev server serves (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) in * `corepack pnpm dev` and in the dev-server browser tests. `create:feature` * and the feature removal drill rewrite it; a project commits it with the * feature, as it does the registry baseline. A build never serves it: the * built manifest comes from scripts/generate-build-manifest.ts. */ export async function devReleaseManifest(source = DEV_RELEASE_MANIFEST): Promise { const manifest = JSON.parse(await readFile(source, "utf8")) as Record; manifest["contractSet"] = buildContractSet(); return `${JSON.stringify(manifest, null, 2)}\n`; } if (process.argv[1]?.endsWith("write-dev-release-manifest.ts")) { await writeFile(DEV_RELEASE_MANIFEST, await devReleaseManifest(), "utf8"); }