Skip to content

feat: support NestJS 12 - #312

Merged
juandav merged 3 commits into
mainfrom
feat/nest-12-support
Oct 4, 2026
Merged

juandav merged 3 commits into
mainfrom
feat/nest-12-support

Conversation

@juandav

@juandav juandav commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Closes #310.

Stacked on #311. The base is chore/consolidate-open-prs; once #311 is merged, GitHub will retarget this PR to main. The commits belonging to this PR are feat: support NestJS 12 and build: declare node types explicitly and test against ioredis 6.

The problem

@nestjs/terminus was pinned to 11.1.1 in optionalDependencies, so npm always installs it. Terminus 11 declares @nestjs/common ^10 || ^11 as a peer, so on a NestJS 12 app npm reports ERESOLVE overriding peer dependency and installs Terminus 11 against Nest 12.

On top of that, NestJS 12 and Terminus 12 are ESM-only ("type": "module"), while this library is published as CommonJS.

Changes

  • @nestjs/terminus: 11.1.1 → ^11.1.1 || ^12.1.0 (still in optionalDependencies, so nothing changes for anyone who didn't install it). Terminus 12 accepts @nestjs/common ^11 || ^12, and the range lets npm dedupe with the app's own Terminus.
  • import { ModuleMetadata, Type } from '@nestjs/common' instead of @nestjs/common/interfaces: NestJS 12's exports map no longer resolves that path. Both versions export those types from the root.
  • The library keeps compiling to CommonJS and loads Nest 12 through Node's require(esm) (20.19+, 22.12+, 24+, the same engines Terminus 12 declares). Tested from both CJS and ESM apps.
  • Dev dependencies on NestJS 12.1.2 / Terminus 12.1.0. Jest needs --experimental-vm-modules to require ESM packages, so test runs node --experimental-vm-modules node_modules/jest/bin/jest.js.
  • CI matrix: build + unit tests (100% coverage) against NestJS 12 + Terminus 12 (ioredis 5 and 6), NestJS 11 + Terminus 12 and NestJS 11 + Terminus 11.
  • @types/node as a direct dev dependency (types: ["node", "jest"]): type-checking only worked because ioredis 5 pulled it in transitively. With ioredis 6 (already allowed by the >=5.0.0 peer) TypeScript fell back to @types/node@12 and failed on the NestJS 12 typings.
  • Samples on NestJS 12 (@nestjs/cli 12.0.8, @nestjs/schematics 12.0.6).
  • Docs: compatibility table in Getting Started, and CLAUDE.md updated.

peerDependencies (>=6.7.0) are unchanged: they already allowed Nest 12.

Verification

Unit tests at 100% in all three combinations (run locally):

NestJS Terminus Tests Coverage
12.1.2 12.1.0 94/94 100%
11.2.7 12.1.0 94/94 100%
11.2.7 11.1.1 94/94 100%
12.1.2 + ioredis 6.0.0 12.1.0 94/94 100%

Clean npm consumer (@nestjs/common@12 @nestjs/core@12 ioredis@5 + the package):

npm install Terminus installed Smoke test (health + shutdown, 3 connections)
published 2.2.2 ERESOLVE overriding peer dependency ×2 11.1.1 closes 1/3
this branch (packed) clean 12.1.0 (deduped) CJS ✅ ESM ✅, closes 3/3

Also passing: pnpm check, tsc --noEmit, build and tests for the library and samples, sample e2e tests, docusaurus build, pnpm install --frozen-lockfile. pnpm audit is unchanged from #311 (2 dev findings with no upstream patch).

- Widen the optional @nestjs/terminus dependency from a pinned 11.1.1 to
  ^11.1.1 || ^12.1.0. Terminus 11 only accepts @nestjs/common ^10 || ^11,
  so npm reported ERESOLVE peer conflicts on NestJS 12 apps. A range also
  lets npm dedupe with the app's own Terminus.
- Import ModuleMetadata and Type from @nestjs/common instead of the deep
  @nestjs/common/interfaces path, which NestJS 12's exports map no longer
  resolves.
- Develop and test against NestJS 12 (now ESM-only). The library stays
  CommonJS and loads it through require(esm); Jest runs with
  --experimental-vm-modules for the same reason.
- CI runs the unit tests against NestJS 12 + Terminus 12, NestJS 11 +
  Terminus 12 and NestJS 11 + Terminus 11.
- Move the samples to NestJS 12 and document the supported combinations.

Closes #310
The library type-checked only because ioredis 5 pulled in @types/node
transitively. ioredis 6 no longer does, so TypeScript fell back to an
unrelated @types/node@12 and failed on the NestJS 12 and Terminus
typings. Add @types/node as a direct dev dependency and list it in
types.

ioredis 6 is already allowed by the >=5.0.0 peer range; CI now builds
and tests against it as well (NestJS 12 + Terminus 12).
Base automatically changed from chore/consolidate-open-prs to main October 4, 2026 02:42
@juandav
juandav merged commit 0b7b801 into main Oct 4, 2026
8 checks passed
@juandav
juandav deleted the feat/nest-12-support branch October 4, 2026 03:01
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.

Nest v12 support

1 participant