Skip to content

refactor!: remove tinyglobby and node 20 BREAKING CHANGE - #12853

Open
Samuron wants to merge 1 commit into
typeorm:masterfrom
Samuron:remove_tinyglobby
Open

Samuron wants to merge 1 commit into
typeorm:masterfrom
Samuron:remove_tinyglobby

Conversation

@Samuron

@Samuron Samuron commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Node 20 support ended on April 2026 so I open this as a discussion. It would be also very nice to remove the dependency and replace with native alternative

@github-actions github-actions Bot added the needs-triage PR needs issue link triage label Sep 9, 2026
@pkg-pr-new

pkg-pr-new Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
  • typeorm-sql-js-example

    npm i https://pkg.pr.new/typeorm@12853
    

commit: 71ae32f

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (1) 📜 Skill insights (0)

Grey Divider


Action required

1. Node 20 users get outdated guidance 📘 Rule violation ≡ Correctness
Description
package.json drops Node 20 from engines, but docs/docs/help/2-supported-platforms.md still
says TypeORM is compatible with Node.js 20 and later. After this release, users checking the support
page receive guidance that conflicts with the package's declared runtime requirement.
Code

package.json[223]

+    "node": "^22.13.0 || >=24.11.0"
Evidence
Compliance rule 2 requires documentation to accompany user-facing usage changes. The changed package
metadata excludes Node 20, while the current supported-platform documentation still declares Node.js
20 compatibility.

Rule 2: Docs updated for user-facing changes
package.json[222-224]
docs/docs/help/2-supported-platforms.md[3-5]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Update the supported-platform documentation to reflect the removal of Node 20 support.
## Issue Context
The package now requires Node.js 22.13 or later, while the current support page still advertises compatibility with Node.js 20 and later.
## Fix Focus Areas
- docs/docs/help/2-supported-platforms.md[3-5]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Directory paths stop loading classes ⊘ Outdated 🐞 Bug ≡ Correctness
Description
The new glob() loop accepts native results unchanged, although native glob returns directory
entries and does not expand a literal directory into its contained files as the removed helper did.
When an entity, migration, or subscriber setting is a directory path, the extension filter discards
that directory and imports none of its classes; wildcard matches can also try to import a directory
whose name ends in a supported extension.
Code

src/util/DirectoryExportedClassesLoader.ts[R47-48]

+        for await (const file of glob(PlatformTools.pathNormalize(dir))) {
+            allFiles.push(file)
Evidence
The loader documents directory inputs, but the replacement appends every native glob result and
subsequently checks only filename extensions before importing it. All three metadata-loading paths
delegate to this function, so the changed semantics affect entity, migration, and subscriber
discovery.

src/util/DirectoryExportedClassesLoader.ts[8-23]
src/util/DirectoryExportedClassesLoader.ts[45-72]
src/connection/ConnectionMetadataBuilder.ts[32-65]
src/connection/ConnectionMetadataBuilder.ts[82-103]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The native filesystem glob has different directory semantics from tinyglobby: literal directories are not expanded and matching directories are returned alongside files. Restore file-only discovery and expansion of literal directory inputs.
## Issue Context
`importClassesFromDirectories` supports entities, migrations, and subscribers. Add regression coverage for a literal directory and for a supported-extension directory that must not be imported.
## Fix Focus Areas
- src/util/DirectoryExportedClassesLoader.ts[45-72]
- test/github-issues/6284/issue-6284.test.ts[28-45]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Node 20 CI jobs fail at runtime ⊘ Outdated 🐞 Bug ☼ Reliability
Description
package.json drops Node 20 while tests-linux still schedules it, and the changed loader and
cleanup now call fs.promises.glob. Whenever this PR triggers the source-and-tests workflow, the
Node 20 job reaches an API that runtime does not provide and fails instead of completing the suite.
Code

package.json[223]

+    "node": "^22.13.0 || >=24.11.0"
Evidence
The package now requires Node 22 or newer, but the main test workflow still passes Node 20 into the
reusable Linux workflow, which installs that runtime and runs the full suite. The changed production
loader is directly exercised by the existing class-loader test, while the changed functional cleanup
independently invokes the same unavailable API.

package.json[221-224]
.github/workflows/tests.yml[112-121]
.github/workflows/tests-linux.yml[11-21]
src/util/DirectoryExportedClassesLoader.ts[45-48]
test/github-issues/6284/issue-6284.test.ts[28-45]
test/functional/multi-database/multi-database-basic-functionality/multi-database-basic-functionality.test.ts[88-92]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The project no longer supports Node 20 and now depends on the native filesystem glob API, but the Linux test matrix still executes the suite under Node 20. Update CI so every test runtime satisfies the declared engine requirement.
## Issue Context
The source-and-tests change detector schedules Linux tests for Node 20 and Node 24. Both the production loader and a functional-test cleanup path now invoke the unsupported API.
## Fix Focus Areas
- .github/workflows/tests.yml[112-121]
- package.json[221-224]
- src/util/DirectoryExportedClassesLoader.ts[45-50]
- test/functional/multi-database/multi-database-basic-functionality/multi-database-basic-functionality.test.ts[88-92]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

4. Upgrade guidance names the wrong library 🐞 Bug ⚙ Maintainability ⭐ New
Description
Removing tinyglobby and importing glob from node:fs/promises leaves the upgrade guide's glob
implementation statement obsolete. Developers consulting the v1 migration guidance are told that
entity and migration discovery uses a dependency that the package no longer ships or calls.
Code

packages/typeorm/package.json[96]

-    "tinyglobby": "^0.2.17",
Evidence
The loader now imports the native Node glob API while the migration guide explicitly says the same
discovery path is handled by tinyglobby.

packages/typeorm/src/util/DirectoryExportedClassesLoader.ts[1-6]
docs/docs/releases/1.0/02-upgrading-from-0.3.md[488-490]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The v1 upgrade guide still states that entity and migration discovery uses `tinyglobby`, although this PR removes that dependency and switches discovery to Node's native glob implementation.

## Fix Focus Areas
- packages/typeorm/package.json[93-98]
- packages/typeorm/src/util/DirectoryExportedClassesLoader.ts[1-6]
- docs/docs/releases/1.0/02-upgrading-from-0.3.md[488-490]

## Recommended Fix
Update the glob-pattern section of the upgrade guide to state that discovery now uses Node's native glob implementation, and document any relevant compatibility differences users should account for.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. A built-in import breaks file ordering ⊘ Outdated 📘 Rule violation ⚙ Maintainability
Description
The node:fs/promises import is added after five relative imports even though the dependency it
replaces occupied the leading import position and comparable source files place built-ins before
local modules. Future edits to this import block now have conflicting examples for where platform
dependencies belong.
Code

src/util/DirectoryExportedClassesLoader.ts[6]

+import { glob } from "node:fs/promises"
Evidence
Compliance rule 4 prohibits style inconsistent with the file. The new built-in import follows
relative imports, whereas another source module places Node built-ins before project-relative
imports.

Rule 4: Remove AI-generated noise
src/util/DirectoryExportedClassesLoader.ts[1-6]
src/driver/better-sqlite3/BetterSqlite3Driver.ts[1-8]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Restore the source tree's dependency-first import ordering.
## Issue Context
The new Node built-in import replaced a package import that was previously first, but it was inserted below all relative imports.
## Fix Focus Areas
- src/util/DirectoryExportedClassesLoader.ts[1-6]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


  • Author self-review: I have reviewed the code review findings, and addressed the relevant ones.

Grey Divider

Context sources
Review mode: ⚖️ Balanced: This changes runtime file discovery and supported Node versions, creating compatibility and behavioral risks across production loading and test paths.

Grey Divider

Tip of the day
💡 Did you know, you can describe a rule in plain language on the Rules page and Qodo drafts it for you

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 71ae32f ⚖️ Balanced

Results up to commit 60c394d


🐞 Bugs (2) 📘 Rule violations (2) 📜 Skill insights (0)


Action required
1. Node 20 users get outdated guidance 📘 Rule violation ≡ Correctness
Description
package.json drops Node 20 from engines, but docs/docs/help/2-supported-platforms.md still
says TypeORM is compatible with Node.js 20 and later. After this release, users checking the support
page receive guidance that conflicts with the package's declared runtime requirement.
Code

package.json[223]

+    "node": "^22.13.0 || >=24.11.0"
Evidence
Compliance rule 2 requires documentation to accompany user-facing usage changes. The changed package
metadata excludes Node 20, while the current supported-platform documentation still declares Node.js
20 compatibility.

Rule 2: Docs updated for user-facing changes
package.json[222-224]
docs/docs/help/2-supported-platforms.md[3-5]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Update the supported-platform documentation to reflect the removal of Node 20 support.

## Issue Context
The package now requires Node.js 22.13 or later, while the current support page still advertises compatibility with Node.js 20 and later.

## Fix Focus Areas
- docs/docs/help/2-supported-platforms.md[3-5]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Directory paths stop loading classes 🐞 Bug ≡ Correctness
Description
The new glob() loop accepts native results unchanged, although native glob returns directory
entries and does not expand a literal directory into its contained files as the removed helper did.
When an entity, migration, or subscriber setting is a directory path, the extension filter discards
that directory and imports none of its classes; wildcard matches can also try to import a directory
whose name ends in a supported extension.
Code

src/util/DirectoryExportedClassesLoader.ts[R47-48]

+        for await (const file of glob(PlatformTools.pathNormalize(dir))) {
+            allFiles.push(file)
Evidence
The loader documents directory inputs, but the replacement appends every native glob result and
subsequently checks only filename extensions before importing it. All three metadata-loading paths
delegate to this function, so the changed semantics affect entity, migration, and subscriber
discovery.

src/util/DirectoryExportedClassesLoader.ts[8-23]
src/util/DirectoryExportedClassesLoader.ts[45-72]
src/connection/ConnectionMetadataBuilder.ts[32-65]
src/connection/ConnectionMetadataBuilder.ts[82-103]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The native filesystem glob has different directory semantics from tinyglobby: literal directories are not expanded and matching directories are returned alongside files. Restore file-only discovery and expansion of literal directory inputs.

## Issue Context
`importClassesFromDirectories` supports entities, migrations, and subscribers. Add regression coverage for a literal directory and for a supported-extension directory that must not be imported.

## Fix Focus Areas
- src/util/DirectoryExportedClassesLoader.ts[45-72]
- test/github-issues/6284/issue-6284.test.ts[28-45]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Node 20 CI jobs fail at runtime 🐞 Bug ☼ Reliability
Description
package.json drops Node 20 while tests-linux still schedules it, and the changed loader and
cleanup now call fs.promises.glob. Whenever this PR triggers the source-and-tests workflow, the
Node 20 job reaches an API that runtime does not provide and fails instead of completing the suite.
Code

package.json[223]

+    "node": "^22.13.0 || >=24.11.0"
Evidence
The package now requires Node 22 or newer, but the main test workflow still passes Node 20 into the
reusable Linux workflow, which installs that runtime and runs the full suite. The changed production
loader is directly exercised by the existing class-loader test, while the changed functional cleanup
independently invokes the same unavailable API.

package.json[221-224]
.github/workflows/tests.yml[112-121]
.github/workflows/tests-linux.yml[11-21]
src/util/DirectoryExportedClassesLoader.ts[45-48]
test/github-issues/6284/issue-6284.test.ts[28-45]
test/functional/multi-database/multi-database-basic-functionality/multi-database-basic-functionality.test.ts[88-92]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The project no longer supports Node 20 and now depends on the native filesystem glob API, but the Linux test matrix still executes the suite under Node 20. Update CI so every test runtime satisfies the declared engine requirement.

## Issue Context
The source-and-tests change detector schedules Linux tests for Node 20 and Node 24. Both the production loader and a functional-test cleanup path now invoke the unsupported API.

## Fix Focus Areas
- .github/workflows/tests.yml[112-121]
- package.json[221-224]
- src/util/DirectoryExportedClassesLoader.ts[45-50]
- test/functional/multi-database/multi-database-basic-functionality/multi-database-basic-functionality.test.ts[88-92]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended
4. A built-in import breaks file ordering 📘 Rule violation ⚙ Maintainability
Description
The node:fs/promises import is added after five relative imports even though the dependency it
replaces occupied the leading import position and comparable source files place built-ins before
local modules. Future edits to this import block now have conflicting examples for where platform
dependencies belong.
Code

src/util/DirectoryExportedClassesLoader.ts[6]

+import { glob } from "node:fs/promises"
Evidence
Compliance rule 4 prohibits style inconsistent with the file. The new built-in import follows
relative imports, whereas another source module places Node built-ins before project-relative
imports.

Rule 4: Remove AI-generated noise
src/util/DirectoryExportedClassesLoader.ts[1-6]
src/driver/better-sqlite3/BetterSqlite3Driver.ts[1-8]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Restore the source tree's dependency-first import ordering.

## Issue Context
The new Node built-in import replaced a package import that was previously first, but it was inserted below all relative imports.

## Fix Focus Areas
- src/util/DirectoryExportedClassesLoader.ts[1-6]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Context sources
Review mode: ⚖️ Balanced: This changes runtime file-discovery behavior and supported Node versions, with compatibility-sensitive native glob semantics across production and test paths.

Grey Divider

Qodo Logo

@alumni alumni changed the title refactor: remove tinyglobby and node 20 refactor!: remove tinyglobby and node 20 BREAKING CHANGE Sep 9, 2026
@alumni

alumni commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

That's the idea in v2.0 :)

@Samuron

Samuron commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@alumni from QODO review it seems that there was some behavior of tinyglobby that this PR will break. I do not understand completely what the issue is, but it may be a good thing to also drop this behavior and rely on the globs how they are implemented by node itself, anyway, it is not my call to decide, so ping me if I need to dig and restore previous behavior

@alumni alumni left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Samuron Qodo is looking for breaking changes. The behavior it is referring is mentioned in https://superchupu.dev/tinyglobby/comparison#trailing-slashes

We recently switched from glob to tinyglobby and we did not bother about the breaking changes because we did this switch in a major version (they should all be more-or-less similar for most people).

In this case, dropping Node 20 support is already a breaking change, so if there are any behavioral differences between tinyglobby and fs.glob that will be fine, since this change will have to wait until 2.x anyway.

@alumni alumni added this to the Future milestone Sep 9, 2026
@michaelbromley

Copy link
Copy Markdown
Member

This repository was recently restructured into a pnpm workspace, and the typeorm package moved from the repo root into packages/typeorm (PR #12854). Everything moved as a pure rename with no content changes, so your branch should replay across the move cleanly once git's rename detection limit is raised:

git fetch origin
git -c merge.renameLimit=999999 -c diff.renameLimit=999999 rebase origin/master

If your branch has diverged enough that a full rebase isn't worth it, scripts/migrate-pr-to-packages-layout.sh --replay (run on top of master) rewrites the paths of your net diff instead. Both approaches, plus a path-mapping table and a prompt you can hand to a coding agent, are documented in scripts/migrate-pr-to-packages-layout.md.

Sorry for the disruption, and thanks for your patience.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-triage PR needs issue link triage

Development

Successfully merging this pull request may close these issues.

3 participants