-
Notifications
You must be signed in to change notification settings - Fork 34
Merge mkdir and mkdirRecursive #58
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
Merge mkdir and mkdirRecursive #58
Conversation
@@ -199,36 +198,19 @@ rmdir file cb = mkEffect $ \_ -> runFn2 | |||
|
|||
-- | Makes a new directory. | |||
mkdir :: FilePath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're already going to break this, it may be better to provide an options record:
mkdir :: { dirname :: Filepath, recursive :: Boolean, perms :: Perms } -> Callback Unit -> Effect Unit
to avoid boolean blindness. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we need this. mkdir
is pretty well-known from things like bash
and those using JavaScript are already familiar with mkdir { recursive: true }
. I'm not sure what else the boolean it could be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed on the 0.15 call, we should just match the explicit API provided via Node:
https://nodejs.org/api/fs.html#fsmkdirpath-options-callback
mkdir :: FilePath -> { recursive :: Boolean, mode :: Perms } -> Callback Unit -> Effect Unit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
The code was already using mkdir'
, so should we continue using that name to reduce breakage? Or name it the very verbose, mkdirWithOptions
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm personally fine with the primed option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Can I get an approval then?
@@ -5,9 +5,9 @@ Notable changes to this project are documented in this file. The format is based | |||
## [Unreleased] | |||
|
|||
Breaking changes: | |||
- Update `mkdir` to take `Boolean` arg for `recursive` option (#53, #55, #58 by @JordanMartinez) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... This isn't entirely correct as it was mkdir'
that was updated now. I'll need to submit a new PR.
Description of the change
Fixes #54
Checklist: