소유자 결정(2026-11-07, design-docs repo-structure/README.md 3.4절)으로 템플릿 샘플을 지운다. 샘플이 맡던 시험 대상은 앞 커밋들이 옮겼다. 참조 기능과 예제 화면, 두 context, 그 시험, e2e 3개, 수동 접근성 기록 7개, 런타임 프로필 키, test:reference-feature(명령, 산출물, 게이트 참조), 커버리지 정책 행을 지웠다. removable-template-features 목록은 비우고 장치는 남겼다: test:sample-removal은 인자가 없으면 목록을 하나씩 지우고, 비면 SKIP을 출력하고 보고서에 건너뛴 사례를 남긴다. 기능 스위치 시험과 홈 시작 링크 스위치 시험은 시험 전용 fixture 기능으로 옮겼다. browser soak은 생성 기능을 넣은 빌드에서 돈다. 문서의 샘플 경로를 고쳤다. 날짜가 붙은 설계·리뷰 기록의 본문은 그대로 두었다. 레지스트리 기준선(update:registry-baseline, OWNER DongHyeonka), CI 계약 기준선과 workflow, 초기 JS 기록(194,354B, 17파일, 첫 기능 6,327B, 기능 539B, context 4B)을 다시 받았다. 위험: 레지스트리 행 삭제는 breaking이다. 샘플을 고쳐 쓰는 다운스트림은 수정/삭제 충돌을 만난다. 성능 lab의 기능 라우트 측정은 템플릿에 공개 기능 라우트가 없어 measured:false다. TEMPLATE_FIXTURE 출처는 플랫폼 코드에 남았다. 검증(desktop): check:types, lint, check:architecture, check:registries, check:ci, verify:documentation, test:unit, test:component, test:contract, test:integration, test:recipes, test:coverage(Risk coverage PASS 378/378, 문턱 68개), test:e2e 183, test:a11y, test:visual, test:storybook, test:browser-capabilities, test:feature-scaffold PASS(76 checks), test:sample-removal SKIP, build, check:bundle.
72 lines
2.9 KiB
TypeScript
72 lines
2.9 KiB
TypeScript
import { existsSync, readFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
/**
|
|
* 1105/15-03. Two copies of the list of files `vite build` reads from the
|
|
* root (the initial JavaScript measurement and the
|
|
* `VITE_PRODUCT_FEATURES=none` build test) had to change together each time
|
|
* vite.config.ts imported a new local file (7f9a515, 799ab7f), and a missed
|
|
* copy failed with an unexplained "Could not resolve". There is one list
|
|
* now, and it has to cover what vite.config.ts imports.
|
|
*/
|
|
const LIST_MODULE = "scripts/lib/vite-build-inputs.ts";
|
|
const MEASUREMENT = "scripts/scale/measure-feature-shape-growth.ts";
|
|
// The build test and the feature-shape measurement are template files and
|
|
// are always read (1106/10-01: filtering on "the file exists" let a renamed
|
|
// consumer drop out of the check unnoticed). 2026-11-07: the measurement used
|
|
// to copy the reference sample and went with it; it copies the generated
|
|
// feature now and stays.
|
|
const CONSUMERS = ["tests/unit/product-feature-selection-build.test.ts", MEASUREMENT];
|
|
|
|
const LOCAL_IMPORT =
|
|
/\bfrom\s+["'](\.{1,2}\/[^"']+)["']|\bimport\s+["'](\.{1,2}\/[^"']+)["']/gu;
|
|
|
|
/** Every repository file vite.config.ts reaches through relative imports. */
|
|
function localImportGraph(entry: string): string[] {
|
|
const seen = new Set<string>();
|
|
const pending = [entry];
|
|
while (pending.length > 0) {
|
|
const file = pending.pop()!;
|
|
if (seen.has(file)) continue;
|
|
seen.add(file);
|
|
const source = readFileSync(file, "utf8");
|
|
for (const match of source.matchAll(LOCAL_IMPORT)) {
|
|
const specifier = match[1] ?? match[2]!;
|
|
const resolved = path
|
|
.relative(process.cwd(), path.resolve(path.dirname(file), specifier))
|
|
.split(path.sep)
|
|
.join("/");
|
|
if (existsSync(resolved)) pending.push(resolved);
|
|
}
|
|
}
|
|
return [...seen];
|
|
}
|
|
|
|
describe("vite build inputs (1105/15-03)", () => {
|
|
it("defines the list in one module that both builds import", () => {
|
|
for (const consumer of CONSUMERS) {
|
|
const source = readFileSync(consumer, "utf8");
|
|
expect(source, consumer).not.toMatch(/\bconst BUILD_INPUTS\s*=/u);
|
|
expect(source, consumer).toMatch(/\bVITE_BUILD_INPUTS\b/u);
|
|
expect(source, consumer).toContain("vite-build-inputs.ts");
|
|
}
|
|
});
|
|
|
|
it("covers every local file vite.config.ts imports", async () => {
|
|
// Imported here, not at the top, so the first test still reports the
|
|
// copies when the module is missing.
|
|
const { VITE_BUILD_INPUTS } = await import("../../scripts/lib/vite-build-inputs.ts");
|
|
const covered = (file: string) =>
|
|
VITE_BUILD_INPUTS.some((input) => file === input || file.startsWith(`${input}/`));
|
|
|
|
const missing = localImportGraph("vite.config.ts").filter((file) => !covered(file));
|
|
|
|
expect(
|
|
missing,
|
|
`vite.config.ts reads files ${LIST_MODULE} does not copy; add them there`,
|
|
).toEqual([]);
|
|
});
|
|
});
|