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

Recursive mkdir coming to Node core #619

Closed
RyanZim opened this issue Aug 14, 2018 · 5 comments · Fixed by #756
Closed

Recursive mkdir coming to Node core #619

RyanZim opened this issue Aug 14, 2018 · 5 comments · Fixed by #756

Comments

@RyanZim
Copy link
Collaborator

RyanZim commented Aug 14, 2018

Just opening an issue to track this.

A recursive flag was added to fs.mkdir in nodejs/node#21875.

It's unreleased so far, but it's in the 10.9.0 release proposal: nodejs/node#22295.

There is currently an open debate on how to determine in code whether the recursive flag is supported in the running Node version: nodejs/node#22302.

When this feature lands, I'd like to use it for ensureDir in environments that support it. Long-term, we may consider deprecating/removing mkdirp/mkdirs/ensureDir when all supported Node versions support it (separate discussion for another day).

@RyanZim
Copy link
Collaborator Author

RyanZim commented Aug 15, 2018

This was pushed back, and will not be going into Node 10.9.0: nodejs/node#22295 (comment)

@RyanZim
Copy link
Collaborator Author

RyanZim commented Sep 24, 2018

Unblocked as of nodejs/node#21875 (comment); should land in a future v10.x release.

@RyanZim
Copy link
Collaborator Author

RyanZim commented May 14, 2019

This was released in Node v10.12.0; perhaps we should revisit this?

@RyanZim
Copy link
Collaborator Author

RyanZim commented Jan 24, 2020

Just dropping this here for future reference: https://github.com/isaacs/node-mkdirp#choosing-a-recursive-mkdir-implementation

@RyanZim
Copy link
Collaborator Author

RyanZim commented Jan 30, 2020

I'm inclined to fork https://github.com/sindresorhus/make-dir into this project to use as the implementation here. It uses the native solution where possible, and the fallback solution fixes #524. The one sticker is that it depends on semver to determine if the current node version supports the recursive flag. I guess I'll have to hack some simpler version sniffing to avoid adding that dep.

RyanZim added a commit that referenced this issue Feb 6, 2020
Resolves #619

Everything should work similarly to how it did before; except that
we no longer return a file path on success (to match fs.mkdir).
Also, errors may be different.
RyanZim added a commit that referenced this issue Feb 6, 2020
Resolves #619

Everything should work similarly to how it did before; except that
we no longer return a file path on success (to match fs.mkdir).
Also, errors may be different.
RyanZim added a commit that referenced this issue Feb 14, 2020
Resolves #619

Everything should work similarly to how it did before; except that
we no longer return a file path on success (to match fs.mkdir).
Also, errors may be different.
RyanZim added a commit that referenced this issue Feb 18, 2020
* BREAKING: Use internal fork of make-dir for mkdirs implementation

Resolves #619

Everything should work similarly to how it did before; except that
we no longer return a file path on success (to match fs.mkdir).
Also, errors may be different.

* Hopefully fix Windows tests

- Error codes are different
- Match fs.mkdir behavior on Windows when creating root

* Port sindresorhus/make-dir#24

* Add comment for clarity

* Use at-least-node for version sniffing

* Consistent error codes across OSes

* Allow different error codes on different Node versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant