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

[Feature Request] mkdirp #59

Open
wojtekmaj opened this issue Feb 14, 2024 · 3 comments
Open

[Feature Request] mkdirp #59

wojtekmaj opened this issue Feb 14, 2024 · 3 comments

Comments

@wojtekmaj
Copy link

In Node.js v10.12.0, recursive option was added to fs.mkdir and fs.mkdirSync. This option allows you to create a directory and all its parent directories if they do not exist.

mkdirp is still WIDELY used, for no apparent reason.

Each copy takes 104 kB.

@SukkaW
Copy link
Owner

SukkaW commented Feb 14, 2024

In Node.js v10.12.0, recursive option was added to fs.mkdir and fs.mkdirSync. This option allows you to create a directory and all its parent directories if they do not exist.

mkdirp is still WIDELY used, for no apparent reason.

Each copy takes 104 kB.

The mkdirp is already implemented in a way that the native fs.mkdir and fs.mkdirSync API is always preferred.

On the other hand, the mkdirp package is now primarily used as a polyfill for Node.js version below 10.12, or as a cross-platform CLI (since cp is not available on Windows, you can't put cp in npm scripts).

@wojtekmaj
Copy link
Author

When added as a dependency to a certain package though, it's unlikely (impossible?) for it to be used as a CLI though.

It's great that native APIs are preferred when possible. Still, 104 kB seems... excessive?

@SukkaW
Copy link
Owner

SukkaW commented Feb 14, 2024

When added as a dependency to a certain package though, it's unlikely (impossible?) for it to be used as a CLI though.

It's great that native APIs are preferred when possible. Still, 104 kB seems... excessive?

But nolyfill CLI will always overwrite every copy of mkdirp, which could also break the intended CLI usage.

Besides, the main problem is that the mkdirp is a dual ESM/CJS package, which doubles the original size:

https://www.npmjs.com/package/mkdirp?activeTab=code

image

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

No branches or pull requests

2 participants