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

Merge mkdir and mkdirRecursive #58

Merged

Conversation

JordanMartinez
Copy link
Contributor

@JordanMartinez JordanMartinez commented Feb 15, 2022

Description of the change

Fixes #54


Checklist:

  • Added the change to the changelog's "Unreleased" section with a reference to this PR (e.g. "- Made a change (#0000)")
  • Linked any existing issues or proposals that this pull request should close
  • Updated or added relevant documentation
  • Added a test for the contribution (if applicable)

@JordanMartinez JordanMartinez added purs-0.15 A reminder to address this issue or merge this PR before we release PureScript v0.15.0 type: breaking change A change that requires a major version bump. labels Feb 15, 2022
@JordanMartinez
Copy link
Contributor Author

🏓 @thomashoneyman

@@ -199,36 +198,19 @@ rmdir file cb = mkEffect $ \_ -> runFn2

-- | Makes a new directory.
mkdir :: FilePath
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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?

@JordanMartinez JordanMartinez merged commit 95d37d3 into purescript-node:master Mar 25, 2022
@JordanMartinez JordanMartinez deleted the merge-mkdir-recursive branch March 25, 2022 22:04
@@ -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)
Copy link
Contributor Author

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.

@JordanMartinez JordanMartinez mentioned this pull request Mar 25, 2022
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
purs-0.15 A reminder to address this issue or merge this PR before we release PureScript v0.15.0 type: breaking change A change that requires a major version bump.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unify mkdir and mkdirRecursive
2 participants