Split large CMS files
Problem¶
A handful of CMS source files are large enough to harm reviewability and slow incremental edits:
- apps/cms/src/components/workarea/asset-manager.tsx — 810 lines (upload, listing, preview, dialogs all in one component).
- apps/cms/src/lib/db/seed.ts — 512 lines (multiple domains mixed).
- apps/cms/src/lib/export/renderers/widget-html/data-driven-widgets.ts — 448 lines (every data-driven widget renderer in one file).
None of these are broken; they are simply ripe for extraction.
Proposal¶
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.
seed.ts→ split intoseed/index.ts+ per-domain files (seed/users.ts,seed/tenants.ts,seed/projects.ts, …). Orchestrator stays small and ordered.data-driven-widgets.ts→ split intodata-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/030re 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 checkpasses.
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.tsunchanged; preview stays inasset-preview-dialog.tsx. Addedseed/seed-data.tsshared withtest/e2e/api-v1/helpers.ts. Addeddownload-source-fileexport unit tests.