Repository navigation
fix: none of the scripts ran; upgrade Nest 7 → 12 and TypeORM 0.2 → 0.3 - #1
Merged
Merged
Conversation
… 0.3
Every npm script starts with `cross-env`, which was never in devDependencies,
so nothing in this repo could be built, started or tested.
Four dependencies were used but never declared
- `cross-env` (all scripts), `lodash` (15 call sites), `body-parser` and
`jsonwebtoken`. They resolved through hoisting under npm/yarn and fail under
pnpm. lodash is now declared; body-parser is replaced by Express's own json()
and urlencoded(); the jsonwebtoken import only supplied a type and is gone.
Framework upgrades
- Nest 7 -> 12. HttpModule / HttpService moved from @nestjs/common to
@nestjs/axios in Nest 8.
- TypeORM 0.2 -> 0.3: createConnection -> DataSource, ConnectionOptions ->
DataSourceOptions, and findOne() now needs explicit `where` options.
- @nestjs/cli is pinned to 11: the 12 line pulls an ESM-only `ora` through
@angular-devkit/schematics, which crashes on Node 22 with
ERR_REQUIRE_CYCLE_MODULE.
- pg, helmet 4 -> 8, express-rate-limit 5 -> 8, class-validator 0.13 -> 0.15,
nodemailer 6 -> 10, TypeScript 4.2 -> 5.9.
Bugs this surfaced
- CatsService swallowed errors: both methods ended in
`catch (err) { return err; }`, so a failed query reached the client as a 200
with an Error object in the body.
- CatEntity declared only id and name, while the endpoint accepts age and
breed — TypeORM silently dropped both on write.
- The e2e spec used `import * as request from 'supertest'`, not callable with
esModuleInterop on.
Jest -> Vitest
- @nestjs/testing 12 is ESM-only and Jest 30 cannot require() ESM before Node
24.9. Vitest runs the suite through SWC, which implements
emitDecoratorMetadata (esbuild does not), so Nest's DI resolves.
- The two Cats specs were Nest CLI stubs that could not resolve their own
dependencies. Replaced with 9 tests that mock the repository and cover both
the service and the controller, including the error-propagation regression.
Also
- ESLint 9 flat config with typescript-eslint, replacing ESLint 7. 0 errors.
- README split into Chinese README.md and English README_EN.md, plus a
CHANGELOG, a bilingual CONTRIBUTING and a CI workflow.
- Migrate to pnpm.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The headline
Nothing in this repo could be built, started or tested. Every npm script begins with
cross-env, which was never indevDependencies:Four dependencies used but never declared
cross-env,lodash(15 call sites),body-parserandjsonwebtoken. All four resolved through hoisting under npm/yarn and fail under pnpm's stricter layout.lodashis now declared.body-parseris replaced by Express's ownjson()/urlencoded()— built in since Express 4.16.jsonwebtokenimport only supplied a type; it is gone.Framework upgrades
HttpModule/HttpServicemoved from@nestjs/commonto@nestjs/axiosin Nest 8.createConnection→DataSource,ConnectionOptions→DataSourceOptions, andfindOne()now requires explicitwhereoptions.@nestjs/clipinned to 11orathrough@angular-devkit/schematics, which crashes on Node 22 withERR_REQUIRE_CYCLE_MODULE.Plus pg 8.23, helmet 4 → 8, express-rate-limit 5 → 8, class-validator 0.13 → 0.15, nodemailer 6 → 10, TypeScript 4.2 → 5.9.
Note
TypeORM 1.x is out and
@nestjs/typeorm12 accepts it, but 0.3 is what nearly all Nest documentation targets. Worth revisiting separately.Bugs this surfaced
CatsServiceswallowed errors and returned them as data. Both methods ended incatch (err) { return err; }, so a failed query reached the client as a 200 with anErrorobject in the body instead of going through the error filter. Errors now propagate, with a regression test.CatEntitywas missing the columns the API accepts. The endpoint takesageandbreed; the entity declared onlyidandname, so TypeORM silently dropped both on write.import * as request from 'supertest', which is not callable withesModuleInteropon.Jest → Vitest
@nestjs/testing12 is ESM-only, and Jest 30 cannotrequire()ESM before Node 24.9 — every suite failed to load. Vitest runs them through SWC, which implementsemitDecoratorMetadata(esbuild does not), so Nest's DI resolves.The two Cats specs were Nest CLI stubs that could not resolve their own dependencies — they had never run. Replaced with 9 tests mocking the repository via
getRepositoryToken, covering both the service and the controller.Also
tsconfig.typecheck.json: the CommonJS build'snoderesolution cannot read Vitest's type exports, so the two need different resolvers.README.mdand EnglishREADME_EN.md, both with badges and the full architecture notes. NewCHANGELOG.mdand bilingualCONTRIBUTING.md.ci.yml(lint, typecheck, test, build on Node 20 and 22) — unit tests only, since the e2e suite needs a live database.Verified
pnpm lint(0 errors),pnpm typecheck(0 errors),pnpm test(9 passing) andpnpm buildall pass.🤖 Generated with Claude Code