Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,24 @@ jobs:
run: pnpm run check

test:
name: Test
name: Test (NestJS ${{ matrix.nest }}, Terminus ${{ matrix.terminus }}, ioredis ${{ matrix.ioredis }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- nest: '12'
terminus: '12'
ioredis: '5'
- nest: '12'
terminus: '12'
ioredis: '6'
- nest: '11'
terminus: '12'
ioredis: '5'
- nest: '11'
terminus: '11'
ioredis: '5'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -51,6 +67,17 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Install NestJS ${{ matrix.nest }}, Terminus ${{ matrix.terminus }} and ioredis ${{ matrix.ioredis }}
if: matrix.nest != '12' || matrix.terminus != '12' || matrix.ioredis != '5'
run: >-
pnpm --filter @nestjs-modules/ioredis add -D
@nestjs/common@^${{ matrix.nest }}
@nestjs/core@^${{ matrix.nest }}
@nestjs/platform-express@^${{ matrix.nest }}
@nestjs/testing@^${{ matrix.nest }}
@nestjs/terminus@^${{ matrix.terminus }}
ioredis@^${{ matrix.ioredis }}

- name: Build
run: pnpm run build --filter=@nestjs-modules/ioredis

Expand Down
9 changes: 8 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,14 @@ Nest creates one `RedisCoreModule` instance per registered connection and calls
- `ioredis` >= 5.0.0

### Optional Dependencies
- `@nestjs/terminus` 11.1.1 (only for health checks)
- `@nestjs/terminus` `^11.1.1 || ^12.1.0` (only for health checks). Kept as a range so npm can dedupe with the app's own Terminus; a pinned version forced Terminus 11 (peer `@nestjs/common ^10 || ^11`) onto NestJS 12 apps.

### NestJS 11 and 12
- Dev dependencies target NestJS 12 and ioredis 5. CI runs build + unit tests against NestJS 12 + Terminus 12 (ioredis 5 and 6), NestJS 11 + Terminus 12 and NestJS 11 + Terminus 11 (matrix in `.github/workflows/ci.yml`).
- `@types/node` is a direct dev dependency and listed in `types`: ioredis 6 no longer pulls it in transitively, and NestJS/Terminus typings need it.
- NestJS 12 and Terminus 12 are ESM-only. The library stays CommonJS and loads them through Node's `require(esm)` (Node 20.19+, 22.12+, 24+).
- Jest needs `--experimental-vm-modules` to `require` ESM packages, which is why the `test` scripts run `node --experimental-vm-modules node_modules/jest/bin/jest.js`.
- Import Nest types from the package root (`@nestjs/common`), never deep paths like `@nestjs/common/interfaces`: NestJS 12's `exports` map does not resolve them.

---

Expand Down
14 changes: 14 additions & 0 deletions apps/website/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ sidebar_position: 1
pnpm add @nestjs-modules/ioredis ioredis
```

### Compatibility

| `@nestjs/*` | `@nestjs/terminus` | Node.js |
|-------------|--------------------|---------|
| 11.x | 11.x | 20+ |
| 11.x | 12.x | 20.19+, 22.12+ or 24+ |
| 12.x | 12.x | 20.19+, 22.12+ or 24+ |

NestJS 12 ships as ES modules only. The library is published as CommonJS
and loads NestJS through `require(esm)`, which is enabled by default from
the Node.js versions listed above. If you run unit tests with Jest, start it
with `--experimental-vm-modules` so Jest can `require` the NestJS 12 packages
as well.

## Basic Usage

Import `RedisModule` into the root `AppModule` and use the `forRoot()` method to configure it:
Expand Down
2 changes: 1 addition & 1 deletion packages/ioredis/lib/interfaces/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ModuleMetadata, Type } from '@nestjs/common/interfaces';
import { ModuleMetadata, Type } from '@nestjs/common';
import Redis, {
Cluster,
ClusterNode,
Expand Down
15 changes: 8 additions & 7 deletions packages/ioredis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"prebuild": "rimraf dist",
"build": "tsc -p tsconfig.json",
"check": "biome check .",
"test": "jest --coverage"
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage"
},
"keywords": [
"nest",
Expand All @@ -37,15 +37,16 @@
"ioredis": ">=5.0.0"
},
"optionalDependencies": {
"@nestjs/terminus": "11.1.1"
"@nestjs/terminus": "^11.1.1 || ^12.1.0"
},
"devDependencies": {
"@nestjs/common": "11.2.7",
"@nestjs/core": "11.2.7",
"@nestjs/platform-express": "11.2.7",
"@nestjs/terminus": "11.1.1",
"@nestjs/testing": "11.2.7",
"@nestjs/common": "12.1.2",
"@nestjs/core": "12.1.2",
"@nestjs/platform-express": "12.1.2",
"@nestjs/terminus": "12.1.0",
"@nestjs/testing": "12.1.2",
"@types/jest": "30.0.0",
"@types/node": "24.19.1",
"ioredis": "5.10.1",
"jest": "30.5.2",
"reflect-metadata": "0.2.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/ioredis/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"outDir": "./dist",
"rootDir": "./lib",
"lib": ["ES2021"],
"types": ["jest"]
"types": ["node", "jest"]
},
"include": ["lib/**/*"],
"exclude": ["node_modules", "dist", "lib/__tests__"]
Expand Down
Loading
Loading