Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove graceful-fs and use direct imports #229

Merged
merged 2 commits into from
Mar 21, 2025
Merged

Conversation

erickzhao
Copy link
Member

@erickzhao erickzhao commented Mar 21, 2025

Closes #227

Uses node:fs directly instead of routing graceful-fs through util.promisify.

  • Works around the issue where import * as fs from 'graceful-fs' would make the fs syntax look like fs.default.fn() instead of fs.fn().
  • graceful-fs doesn't patch fs.rm nor fs.mkdtemp, so it's safe to remove the package altogether and preserve previous behaviour.
  • Adds a small unit test for the withTempDir helper, although I think vitest magic makes it so that the test passes even with the faulty runtime import.

cc @ckerr @erikian

@erickzhao erickzhao requested a review from a team as a code owner March 21, 2025 21:55
@erickzhao erickzhao requested review from ckerr and erikian March 21, 2025 21:56
Copy link
Member

@VerteDinde VerteDinde left a comment

Choose a reason for hiding this comment

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

Read through the linked PR, changes look good 👍

@ckerr
Copy link
Member

ckerr commented Mar 21, 2025

Isn't this what I did four hours ago at #228 😸

I closed that because @erikian said @electron/wg-ecosystem wants to use around using graceful-fs instead of Node's built-in fs when migrating to Node 22...?

Copy link
Member

@ckerr ckerr left a comment

Choose a reason for hiding this comment

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

This PR has better tests than #228 did 👍

@erickzhao
Copy link
Member Author

@ckerr Yeah, I think I wasn't very judicious in the original #222 PR and did blanket replacements for graceful-fs for the original Node 22 migration.

Reading through the code when investigating the bug led me to find that we aren't using any functions that graceful-fs patches anyways, so removing the dep is perfectly fine. 🙇

@erickzhao erickzhao merged commit 451b6e7 into main Mar 21, 2025
2 checks passed
@erickzhao erickzhao deleted the no-import-star branch March 21, 2025 22:35
Copy link

🎉 This PR is included in version 3.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants