Skip to content

Split large CMS files

Problem

A handful of CMS source files are large enough to harm reviewability and slow incremental edits:

None of these are broken; they are simply ripe for extraction.

Proposal

  1. asset-manager.tsx → split into:
    • asset-manager/index.tsx (orchestrator).
    • asset-manager/upload.tsx.
    • asset-manager/listing.tsx.
    • asset-manager/preview.tsx.
    • asset-manager/dialogs.tsx.
    • Keep public API stable by re-exporting from the existing path.
  2. seed.ts → split into seed/index.ts + per-domain files (seed/users.ts, seed/tenants.ts, seed/projects.ts, …). Orchestrator stays small and ordered.
  3. data-driven-widgets.ts → split into data-driven-widgets/index.ts + one file per widget family; index re-exports the renderer map.

For each split:

  • No behavior change.
  • Tests stay green.
  • Follow .cursor/rules/030 re component organization.

Acceptance criteria

  • Each new file under ~250 lines.
  • No public import path changes for consumers (verify via rg sweep).
  • Existing tests pass without modification.
  • npm run check passes.

Out of scope

  • Behavioral changes (UI tweaks, seed data adjustments, renderer fixes).
  • LMS file-size review (separate follow-up if needed).

Notes / decisions log

  • 2026-05-24: Ticket created from monorepo audit.
  • 2026-05-25: Implemented as one PR. seed-fixtures.ts unchanged; preview stays in asset-preview-dialog.tsx. Added seed/seed-data.ts shared with test/e2e/api-v1/helpers.ts. Added download-source-file export unit tests.