Files
clean-architecture-frontend…/scripts/check-realtime-boundary-fixtures.ts
T
DongHyeonkaandClaude Opus 5.5 7f2a1607f3 refactor(architecture): move regex import rules into the import graph (12-10, 12-08)
Icon vendor, design-system deep import and realtime composition were regular
expressions beside graph rules, and the regex missed relative deep imports
inside presentation. They are graph rules with fixtures now, with the
components/ui facades and page-templates named. package-script-graph.ts stays;
the reason is recorded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 22:33:14 +09:00

47 lines
1.2 KiB
TypeScript

import { spawnSync } from "node:child_process";
const checker = "scripts/check-realtime-boundaries.ts";
const allowed = run(
"tests/fixtures/realtime-boundaries/allowed",
".tmp/realtime-boundaries-allowed.json",
);
const forbidden = run(
"tests/fixtures/realtime-boundaries/forbidden",
".tmp/realtime-boundaries-forbidden.json",
);
const forbiddenOutput = `${forbidden.stdout}${forbidden.stderr}`;
const expectedRules = [
"NATIVE_REALTIME_API_OUTSIDE_ADAPTER",
"PRESENTATION_INTERVAL_OWNER",
] as const;
if (
allowed.status !== 0 ||
forbidden.status === 0 ||
!expectedRules.every((rule) => forbiddenOutput.includes(rule))
) {
process.stderr.write(allowed.stdout);
process.stderr.write(allowed.stderr);
process.stderr.write(forbidden.stdout);
process.stderr.write(forbidden.stderr);
process.exit(1);
}
process.stdout.write(
`Realtime boundary fixtures: PASS (${expectedRules.length} forbidden rules rejected)\n`,
);
function run(sourceRoot: string, artifact: string) {
return spawnSync(
process.execPath,
[
checker,
"--source-root",
sourceRoot,
"--artifact",
artifact,
],
{ encoding: "utf8" },
);
}