Skip to content

fix: change import for process dependency - #11248

Merged
gioboa merged 5 commits into
typeorm:masterfrom
yohannpoli:fix-es-module
Jan 5, 2026
Merged

gioboa merged 5 commits into
typeorm:masterfrom
yohannpoli:fix-es-module

Conversation

@yohannpoli

@yohannpoli yohannpoli commented Jan 16, 2025 •

Copy link
Copy Markdown
Contributor

Using Deno, when i run the migration generate command, i got no error, when i use the migration run command, it fail because process.cwd is undefined, this is due to a bad import of the process dependency.

Description of change

I use the same syntax from the migration generate command for the process dependency (tested in local by patching the package) and it works after this change.

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run format to apply prettier formatting
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

Summary by CodeRabbit

  • Refactor
    • Standardized the import style for the Node.js process module to use a default import, aligning with project conventions. No changes to behavior, outputs, or control flow.
  • Chores
    • Minor code cleanup related to import style. No user-facing changes.
    • No configuration updates required.
    • Fully compatible with existing workflows and commands.

@coveralls

coveralls commented Jan 16, 2025 •

Copy link
Copy Markdown

Coverage Status

coverage: 80.879%. remained the same
when pulling 9cbfa66 on yohannpoli:fix-es-module
into 5bb69d0 on typeorm:master.

@gioboa gioboa 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.

Thanks @yohannpoli for your help
Did you try this change with npm too?

@yohannpoli

Copy link
Copy Markdown
Contributor Author

@gioboa I don't have a project setup with TypeORM and npm right now. If you check other command, this is the same import type, and it's seem working with npm. If you have a ready environment, it would be nice if you can run the command for me, or i will test it this week end, i can't before.

@yohannpoli

Copy link
Copy Markdown
Contributor Author

@gioboa How do you want me to try the fix, i need to make a release i think, no ? if i use the patch package dependency, it works, but this is not the same as building the library and test it

@gioboa gioboa added the size-xs label Feb 1, 2025

@gioboa gioboa 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.

@yohannpoli Thanks for your commitment.
I think we can test this change during the review process, so I added this PR to our release board.

@coderabbitai

coderabbitai Bot commented Sep 21, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Updated the import statement for the Node.js process module in src/commands/MigrationRunCommand.ts from a namespace import to a default import. No functional logic, behavior, or control flow was changed.

Changes

Cohort / File(s) Summary
Import style update
src/commands/MigrationRunCommand.ts
Switched from namespace import of process to default import; usages remain unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

I nudge a nibble in the night,
A tiny import set just right.
No flows were stirred, no exits stray—
Just tidy tracks for code’s ballet.
Thump-thump, I hop, review done quick,
One carrot’s worth for one small tick. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "fix(MigrationRunCommand): import process dependency ES module" accurately and concisely summarizes the primary change — modifying how the Node.js process dependency is imported in MigrationRunCommand to address an ES module compatibility bug; it directly relates to the PR objectives and uses conventional commit style to indicate a bugfix.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d4f7b44 and 98a01af.

📒 Files selected for processing (1)
  • src/commands/MigrationRunCommand.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: tests-linux (20) / sqlite
  • GitHub Check: tests-linux (18) / better-sqlite3
  • GitHub Check: tests-linux (20) / mysql_mariadb
  • GitHub Check: tests-linux (20) / mongodb
  • GitHub Check: tests-linux (20) / cockroachdb
  • GitHub Check: tests-linux (20) / mssql
  • GitHub Check: tests-linux (18) / sqljs
  • GitHub Check: tests-linux (18) / mysql_mariadb_latest
  • GitHub Check: tests-linux (18) / mysql_mariadb
  • GitHub Check: tests-linux (18) / mssql
  • GitHub Check: tests-linux (18) / postgres (14)
  • GitHub Check: tests-linux (18) / sqlite
  • GitHub Check: tests-linux (18) / postgres (17)
  • GitHub Check: tests-linux (18) / mongodb
  • GitHub Check: tests-linux (18) / sap
  • GitHub Check: tests-linux (18) / oracle
  • GitHub Check: tests-windows / better-sqlite3
  • GitHub Check: tests-windows / sqljs
  • GitHub Check: tests-windows / sqlite
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
src/commands/MigrationRunCommand.ts (1)

2-2: Prefer node:process import; verify TS interop flags

  • Replace default import in src/commands/MigrationRunCommand.ts for Node/Deno/bundler portability; default import requires esModuleInterop or allowSyntheticDefaultImports.
  • Automated sandbox checks failed to locate/parse tsconfig and repository imports — verify these locally.
-import process from "process"
+import process from "node:process"

Quick local checks:

jq '.compilerOptions | {esModuleInterop, allowSyntheticDefaultImports}' tsconfig.json
rg -n "from\s+['\"](?:node:)?process['\"]" src || true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new

pkg-pr-new Bot commented Sep 21, 2025 •

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

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

commit: 9cbfa66

@gioboa
gioboa requested review from alumni and sgarner September 21, 2025 13:21
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

@gioboa
gioboa requested review from G0maa, alumni and pkuczynski and removed request for alumni December 1, 2025 08:32

@gioboa gioboa 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.

Thanks for your help @yohannpoli

@alumni

alumni commented Dec 1, 2025

Copy link
Copy Markdown
Collaborator

It would be interesting to check the build, I would expect the code to transpiled the same way.

I think we have synthetic default imports enabled in tsconfig, so I actually tend to prefer import x instead of import * as x, but they should be transpiled identically.

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

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

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

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

@gioboa gioboa changed the title fix(MigrationRunCommand): import process dependency ES module fix: change import for process dependency Jan 5, 2026
@gioboa
gioboa merged commit 84e5787 into typeorm:master Jan 5, 2026
37 checks passed
Cprakhar pushed a commit to Cprakhar/typeorm that referenced this pull request Jan 7, 2026
mgohin pushed a commit to mgohin/typeorm that referenced this pull request Jan 15, 2026
kranners pushed a commit to kranners/typeorm that referenced this pull request Mar 1, 2026
@pkuczynski pkuczynski added this to the 1.0 milestone Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants