Skip to content

Modernize library: ESM, SWC, TypeORM 0.3+, 100% test coverage - #6

Open
tankist wants to merge 10 commits into
EchelonFour:masterfrom
tankist:upstream-merge
Open

Modernize library: ESM, SWC, TypeORM 0.3+, 100% test coverage#6
tankist wants to merge 10 commits into
EchelonFour:masterfrom
tankist:upstream-merge

Conversation

@tankist

@tankist tankist commented May 19, 2026

Copy link
Copy Markdown

Summary

Complete rewrite and modernization of typeorm-in-memory-cache to bring it up to current ecosystem standards.

Changes

Module system

  • Converted to ESM ("type": "module")
  • export class InMemoryCacheProvider instead of export default — named export for better tree-shaking

Dependencies

  • Replaced deprecated node-cache with @cacheable/node-cache
  • Updated typeorm peer dependency to >=0.3.0
  • Updated QueryResultCache interface implementation with optional queryRunner parameters (TypeORM 0.3.x requirement)

Build

  • SWC for TS→JS compilation (~55ms)
  • tsc --emitDeclarationOnly for .d.ts generation
  • TypeScript 6 with NodeNext module resolution, verbatimModuleSyntax

Tests

  • Jest + @swc/jest transformer
  • 25 tests, 100% coverage (statements, branches, functions, lines)
  • Coverage threshold enforced at 95%+

Linting & formatting

  • ESLint 9 flat config (eslint.config.mjs)
  • typescript-eslint strict + stylistic type-checked rules
  • Prettier integration

CI/CD

  • GitHub Actions: test on Node 18/20/22, publish on release

Infrastructure

  • Node.js >= 18 required
  • Source moved to src/, tests in __tests__/
  • Removed stale .vscode/, updated .node-version, .gitignore

Migration from 1.x

- import InMemoryCacheProvider from 'typeorm-in-memory-cache'
+ import { InMemoryCacheProvider } from 'typeorm-in-memory-cache'

The API is fully backward-compatible — only the import syntax changes.

Test plan

  • npm run typecheck — passes
  • npm run lint — passes (0 errors)
  • npm run build — passes
  • npm test — 25/25 tests pass, 100% coverage
  • CI green on Node 18, 20, 22

tankist added 10 commits May 19, 2026 22:46
- Removed custom in-memory cache implementation.
- Added `eslint.config.mjs` for enhanced linting rules and Prettier integration.
- Upgraded `node` version to 22 in `.node-version`.
- Updated `package-lock.json` with new dependencies, including TypeScript 6.x and ESLint upgrades.
- Introduced `.circleci/config.yml` to set up CI workflows.
- Added jobs for testing across multiple Node.js versions.
- Automated npm publishing on tagged releases.
- Updated `.github/workflows/publish.yml` to use Node.js 24.
- Adjusted `.circleci/config.yml` Node.js matrix and Docker image to include Node.js 24.15.
- Modified `.github/workflows/ci.yml` to add Node.js 24 to the test matrix.
- Replaced `ts-jest` with `@swc/jest` for improved performance.
- Removed `ts-jest` and its dependencies from `package.json` and `package-lock.json`.
- Added `@swc/core` and `@swc/jest` as dev dependencies.
- Updated test scripts in `package.json` to drop `NODE_OPTIONS` flags.
- Updated `.node-version` to use Node.js 24.
- Adjusted `tsconfig.build.json` to use `emitDeclarationOnly` for faster builds.
- Added `.swcrc` configuration to enable SWC compilation.
- Updated `package-lock.json` with new dependencies, including SWC tools and other adjacency.
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