Files
clean-architecture-frontend…/scripts/write-dev-release-manifest.ts
T
DongHyeonka db5728b75f fix(dev): dev release manifest를 src 밖에 쓰고 Vitest에서는 만들지 않는다
문제
c15345c의 플러그인은 apply: "serve"라 Vitest가 Vite를 띄울 때도 돌아,
test:unit마다 자식 프로세스로 manifest를 쓴다. 출력 위치
src/.generated/dev-release-manifest.json에는 자리표시자의 routeChunks(샘플
경로)가 들어 있다. test:sample-removal의 잔여 검사는 src/를 훑으므로
FE-GATE-020이 "fixture-id-residue: src/.generated/dev-release-manifest.json"으로
실패한다.

고른 방법
- 출력을 빌드의 contract set 생성물 옆 .generated/frontend-runtime/로 옮긴다
  (무시 대상).
- apply가 serve이면서 VITEST가 없을 때만 돈다. 테스트는 서버에서
  manifest를 받지 않는다.

검증
- browser-files capability spec(dev server) chromium 3건 통과, 생성물이 새
  위치에 생긴다.
- test:unit 2,880건 통과, 실행 뒤 src/.generated에 manifest가 없다.

Refs: docs/reviews/2026-11-03-maturity-review/README.md 14.6 X2 #3
2026-11-05 02:04:15 +09:00

28 lines
1.2 KiB
TypeScript

import { mkdir, readFile, writeFile } from "node:fs/promises";
import { dirname } from "node:path";
import { buildContractSet } from "./generate-contract-set.ts";
import { DEV_RELEASE_MANIFEST_PATH } from "./lib/dev-release-manifest.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. The output
* is generated and ignored, as .generated/ is.
*/
export async function writeDevReleaseManifest(
source = "public/release-manifest.json",
output = DEV_RELEASE_MANIFEST_PATH,
): Promise<void> {
const manifest = JSON.parse(await readFile(source, "utf8")) as Record<string, unknown>;
manifest["contractSet"] = buildContractSet();
await mkdir(dirname(output), { recursive: true });
await writeFile(output, `${JSON.stringify(manifest, null, 2)}\n`, "utf8");
}
if (process.argv[1]?.endsWith("write-dev-release-manifest.ts")) {
await writeDevReleaseManifest();
}