pkg icon indicating copy to clipboard operation
pkg copied to clipboard

feat: use native node fs

Open ignatiusmb opened this issue 2 years ago • 2 comments

There's still a test case where it requires fs-extra, so I'm not sure if we can completely remove the package, but at least we can move it out of the dependency tree.

ignatiusmb avatar Sep 20 '22 04:09 ignatiusmb

The rationale for replacing those async methods is because it's immediately await-ed and used — e.g., it's executed as (await asyncThing()).anotherSyncMethod(). I find that using synchronous methods for these operations a bit simpler and easier to read unless we need to do multiple things simultaneously.

fs-extra doesn't create so much overhead as it uses fs internally, it just extends it

For this, I think it's more of a reason to not have it as a dependency, especially when we can already do the things we need with node's fs module.

Another reason is also to reduce and minimize dependencies as much as possible, recent survey shows that managing dependencies is one of the biggest pain points when working with JS. Generally speaking, I think the less dependencies any project has, the better the experience would be, both for the maintainers and the users.

ignatiusmb avatar Sep 20 '22 07:09 ignatiusmb

Please let me know if you prefer to keep the async methods, I'll address them and make the changes.

ignatiusmb avatar Sep 20 '22 07:09 ignatiusmb

@jesec feel free to merge if it looks good to you

robertsLando avatar Oct 03 '22 07:10 robertsLando

This pull-request is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this pull-request entirely you can add the no-stale label

github-actions[bot] avatar Feb 27 '23 00:02 github-actions[bot]

What's left to do?

ignatiusmb avatar Feb 27 '23 06:02 ignatiusmb

@robertsLando ES6 fs/promises import won't work with Node v12 (https://stackoverflow.com/a/70042193).

ignatiusmb avatar Feb 28 '23 18:02 ignatiusmb

@robertsLando ES6 fs/promises import won't work with Node v12 (https://stackoverflow.com/a/70042193).

NodeJS 14.x has passed the end of its LTS support. I doubt that 12.x should still be considered.

#1886

pcnate avatar May 15 '23 13:05 pcnate

This pull-request is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this pull-request entirely you can add the no-stale label

github-actions[bot] avatar Aug 14 '23 00:08 github-actions[bot]

This pull-request is now closed due to inactivity, you can of course reopen or reference this pull-request if you see fit.

github-actions[bot] avatar Aug 20 '23 00:08 github-actions[bot]