-
Notifications
You must be signed in to change notification settings - Fork 401
chore: remove fs-extra #1271
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
chore: remove fs-extra #1271
Conversation
tests/utils/siteBuilder.js
Outdated
@@ -22,74 +33,75 @@ const createSiteBuilder = ({ siteName }) => { | |||
const dest = path.join(directory, pathPrefix, 'netlify.toml') | |||
const content = toToml(config, { space: 2 }) | |||
tasks.push(async () => { | |||
await fs.ensureFile(dest) | |||
await ensureDir(path.dirname(dest)) |
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.
We only need to ensure that the directory is created, as writeFile
already creates the file if it does not exists (default mode is 'w'
).
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.
Thanks @JCMais, nice work.
Added some comments.
b72ba58
to
453ccb9
Compare
@erezrokah @ehmicky I've addressed the requested changes. 👍
Almost all tests are green here now, the tests that were failing before were due to missing the I also took the opportunity to do a small refactor on |
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.
Thanks for the quick follow up @JCMais, add a few minor comments and suggestions.
You're correct about Edge Handlers, they are not available for all accounts yet.
// ignore erros for mkdir | ||
} | ||
|
||
const childrenItems = await fs.readdir(src) |
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.
This has the potential to create a lot of promises.
I don't think we should optimise this yet since it's only used for our docs site that doesn't contain many of files.
const binExists = await fs.exists(binPath) | ||
if (!binExists) { | ||
return false | ||
try { |
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.
Nice cleanup!
22bca29
to
814ba72
Compare
Rebased on top of |
By the way, if we look further into this change, it probably makes sense to use graceful-fs directly instead of just fs. As just using fs is not going to handle some scenarios that were being handled before when using v4 does not monkey-patch fs anymore. edit: and from looking at with the above in mind, I don't know if this PR makes sense anymore, given the original context. If it does, let me know and I will finish the remaining requested changes. |
@JCMais, this PR brings value in the form of:
It would be great if you could follow up with the remaining changes. |
Thanks @erezrokah, I will do that as soon as I get a chance today. |
added The test failure is weird, I will try running the project on Windows to take a look if it's also reproducible locally (looks like there are a few EPERM / EBUSY errors too). I have not rebased with master yet, will do after the latest changes are reviewed. |
Latest changes are good, thanks! Can you follow up with a rebase? I'm re-running the tests to verify |
d486341
to
54403f4
Compare
the branch has been rebased with master |
Resolved the conflict directly in the GitHub UI (thus the merge commit), if you need me to rebase with master just let me know. |
Sorry for the delay with this @JCMais, going to merge and publish after https://jamstackconf.com/virtual/ |
no hurries @erezrokah , looking forward to the conf too. 😄 |
create a separated file for fs utils
Co-authored-by: ehmicky <[email protected]>
106d407
to
6c2a274
Compare
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.
Thank you for your patience with this @JCMais
Closes #1241
- Summary
See issue above.
I've left a few comments about some changes that need to be addressed before this is merged.
I also wrote this using Node.js 14, so I need to run the tests again using Node.js 8 as it's probably going to yell at me. 😄 I will do that when I find some time tomorrow.
- Test plan
This PR adds no new features/changes other than removing all usages of fs-extra, so the existing test suite was sufficient.
There are some tests failing locally here, but it should not be related to these changes, as they were already failing before I started working on this. I will take a look later into this.
- Description for the changelog
remove
fs-extra
and useutil.promisify
instead- A picture of a cute animal (not mandatory but encouraged)