-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: avoid temporal optimize deps dirs #12582
Conversation
|
Almost there, windows is having issues. Probably missing a |
Looks like CI is faster in Windows now 👀 |
files.push( | ||
fsp.writeFile( | ||
path.resolve(depsCacheDir, 'package.json'), | ||
JSON.stringify({ type: 'module' }), |
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.
Would there be duplicated calls of JSON.stringify
?
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 feel like doing a writeFile instead of checking existence before writing would be a bit faster, though perf doesn't matter a lot I think since these optimized files are only served to the browser.
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.
@sun0day changed it to be directly a string so we can have the same formatting as other files in the deps cache. We could use JSON.stringify({ type: 'module' }, null, 2) + '\n'
too but the direct string feels better here.
@bluwy I added the check because I think the normal flow would be that this file is already there.
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, I took that back after the latest changes as it was making the code more complex and I don't think it would make a diff
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.
Tested locally and works great!
I found a trivial bug in main branch. v4.3.0-beta.0: I guess this PR will fix this bug indirectly. (haven't taken a look yet) |
Yes, that will be fixed. Any time you were killing the process while processing (or before committing), the temp dir will end up stale. |
It looks like the change log could do with updating: 4.3.0-beta.0 (2023-03-23) |
@mattydono this PR isn't released yet. Only commits that have been in a release are populated in the changelog. We're also reverting back to temporal dirs so we may clean it up #12622 |
Fixes #9986
Description
Use
write: false
when optimizing deps, and directly write files to the final deps dir when committed.What is the purpose of this pull request?