Skip to content

Barrel Cleanup & Aggregate Export Refactor: @ocom/domain #109

@nnoce14

Description

@nnoce14

Goal: Remove all barrel files (index.ts that only re-export) and star re-export patterns from @ocom/domain. For each domain context, ensure exports target a single aggregate source file (e.g. <context>.ts) that directly exports entities, value objects, repositories, and unit of work types in a designated //#region Exports region at the bottom. Update package.json "exports" to point to these aggregate files instead of index.ts.

Scope:
packages/ocom/domain -- especially src/domain/contexts/*

Tasks:

  • For each domain context folder, audit for index.ts barrel files and constituent code modules
  • Create or refactor a context aggregate file (<context>.ts) with clear Exports section
  • Migrate all exports to aggregate file (no index.ts barrels)
  • Remove index.ts barrel files
  • Update imports throughout repo to use aggregate files
  • Update package.json exports fields to point at aggregate files
  • Add/maintain Biome error-level override (noBarrelFile, noReExportAll) for packages/ocom/domain/**
  • Run lint/build/tests locally and using pnpm run verify
  • Document path changes (dev docs/README)

Success Criteria:

  • All domain contexts aggregate roots have a dedicated entry point, no index.ts barrels remain
  • package.json exports use aggregate files, and any other files which need to be exported from @ocom/domain
  • Imports across repo reference explicit files, not barrels
  • There is no usage of Domain.* namespace pattern import from @ocom/domain anywhere in the codebase.
  • Biome config error overrides active for packages/ocom/domain/**
  • All builds/lint/tests pass (pnpm run verify)

Risk & Coordination:

  • Update may break import paths for downstream packages, coordinate PR merges
  • If aggregate files become unwieldy, consider splitting logic but keep exports centralized
  • Watch for accidental circular references previously masked by barrels

Checklist:

  • Audit contexts
  • Refactor/create aggregate files & exports
  • Remove index.ts barrels
  • Update package.json exports
  • Update all imports
  • Add Biome override
  • Run verify
  • Document changes

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions