Skip to content

build: TS project references + package resolution (nx stack 2/5) - #209

Merged
getlarge merged 8 commits into
chore/nx-21from
chore/ts-project-references
Nov 26, 2026
Merged

getlarge merged 8 commits into
chore/nx-21from
chore/ts-project-references

Conversation

@legreffier

@legreffier legreffier Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Stack 2/5. Replaces tsconfig paths with TypeScript project references and package resolution (Nx's TS solution setup).

This PR moved ahead of nx 22. nx 22 removes external: "none" from @nx/js:tsc, which cluster relied on to bundle typed-event-emitter into its build output, so nx 22 can't land without this.

Layout

  • tsconfig.base.json: drops paths/baseUrl; adds composite, declarationMap, module/moduleResolution: nodenext, esModuleInterop and customConditions: ["@getlarge/source"].
  • Root tsconfig.json is now a solution file. Per-package references are maintained by nx sync.
  • build is inferred by @nx/js/typescript (tsc --build tsconfig.lib.json) into packages/*/dist. typecheck is a new inferred target and runs in CI.
  • package.json: adds main/types/exports and files: [dist, CHANGELOG.md]. nx-release-publish now publishes from the project root.
  • The export condition is @getlarge/source, not development. Bundlers such as Vite enable development for consumers, which would resolve to src/, and src/ isn't published.
  • Jest resolves workspace packages through the same condition (customExportConditions), and test depends on ^build.

Code fixes needed under nodenext

  • file-storage: dropped a deep import of @google-cloud/storage internals and mirrored three option types locally.
  • eslint-plugin: imports from @typescript-eslint/utils/ts-eslint (public) instead of dist/ts-eslint.
  • fastify-upload test: default-imports form-data.
  • lock: redlock@5.0.0-beta.2 (unmaintained) has an exports map without types, so lock's tsconfig gets a types-only paths entry. It goes away when redlock is replaced (@sesamecare-oss/redlock is the candidate).

Consumer-facing changes

  • The published tarball now has dist/… instead of src/…. Root imports (import … from '@getlarge/…') are unchanged.
  • Deep imports are blocked by the new exports map. None are documented, so this only affects undocumented usage.
  • cluster no longer inlines typed-event-emitter; it resolves it as the regular dependency it already declared.

Deferred

isolatedModules stays off. Turning it on surfaces TS1272 errors and one real hazard: amqp-server.ts reads RmqStatus, an ambient const enum from @nestjs/microservices that has no runtime value. It only works because full tsc inlines it. The Vitest PR, which compiles transpile-only, has to fix this.

Verification

  • format:check, build, typecheck and lint pass for all projects.
  • test passes for typed-event-emitter, cluster, fastify-upload, async-local-storage and eslint-plugin. CI runs amqp/lock/file-storage, which need RabbitMQ, Redis and cloud credentials.
  • npm pack --dry-run per package shows only dist, README, CHANGELOG and package.json, with no specs or tsbuildinfo.
  • nx release --dry-run --skip-publish, as the release workflow runs it, writes versions and changelogs to packages/* as before.

legreffier Bot added 5 commits November 26, 2026 09:43
…rage internals

MoltNet-Diary: e6afedd9-9b04-46c7-9cae-dcaf191f1d51
Task-Group: ts-project-references
Task-Family: refactor
…ubpath

MoltNet-Diary: 39a3413b-3a95-4ee2-87e9-ae8eff3a5261
Task-Group: ts-project-references
MoltNet-Diary: c03d2e23-a7cc-422c-b209-cf57f76f0315
Task-Group: ts-project-references
MoltNet-Diary: 58f99f1e-adda-4d77-a3eb-ebddb631ec8e
Task-Group: ts-project-references
Task-Completes: true
# Conflicts:
#	packages/lock/tsconfig.spec.json
@nx-cloud

nx-cloud Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 521c7f6

Command Status Duration Result
nx affected -t lint,typecheck,test,build --para... ✅ Succeeded 1m 12s View ↗

💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-11-26 12:03:18 UTC

MoltNet-Diary: 6ac9aef8-6102-4376-b391-9da5f989ef71
Task-Group: tooling-deps
@getlarge
getlarge merged commit 17f185a into main Nov 26, 2026
6 checks passed
@getlarge
getlarge deleted the chore/ts-project-references branch November 26, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant