Skip to content

v2: generate the six manifests, tsconfigs, and knip block from one DAG table #897

Description

@chughtapan

Deferred from #891 / PR #893 (Phase 2 scaffolding).

Problem

The v2 dependency DAG is currently written down in four places:

  1. scripts/check-architecture-boundaries.jsV2_PACKAGES[*].deps
  2. v2/*/package.jsondependencies (six files)
  3. v2/*/tsconfig.jsonreferences (six files)
  4. knip.jsonworkspaces["v2/*"].ignoreDependencies (five entries)

check-architecture-boundaries.js pins all four together, so drift in any of
them fails pnpm lint today — that part is covered and proven in PR #893. The
remaining cost is edit burden: adding a package or changing one edge is ~14 hand
edits across 13 files.

Beyond the DAG, the six manifests carry ~130 lines of byte-identical
boilerplate (scripts.{build,lint}, nx.targets.{build,lint}, type, main,
types) differing only by package name and cwd.

Fix recipe

Add scripts/gen-v2-packages.mjs that emits the six package.json files, the
six tsconfig.json files, and the knip.json v2 block from a single table,
then gate it exactly like the existing precedent in package.json:

"arch:config:check": "pnpm arch:config:generate && git diff --exit-code -- 'packages/*/safer-architecture.config.json'"

scripts/gen-architecture-configs.mjs is the shape to copy.

Not in scope

The V2_PACKAGES table itself should stay hand-written. It is a deliberate
transcription of frozen law in docs/architecture/components.md, and the
value of an independent transcription is that drift fails whichever side moves.

Metadata

Metadata

Assignees

No one assigned

    Labels

    v2Aligned input to the v2 track

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions