-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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(core): replace wait-on
dependency with custom lighter code
#9547
Conversation
Fixes facebook#9537 This change removes usage of `wait-on`, and replaces it with an effective copy of the algorithm it ends up taking for our use case. 1. `wait-on` sees a file as present when `fs.stat` on the path stops throwing 2. It polls on a timer (which WaitPlugin sets to 300ms) 3. It waits until a time has passed without file size changing (defaults to 750ms) 4. `wait-on` defaults to no timout, so we poll forever. See https://github.com/jeffbski/wait-on/blob/master/lib/wait-on.js for reference
wait-on
dependencywait-on
dependency
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
⚡️ Lighthouse report for the deploy preview of this PR
|
wait-on
dependencywait-on
dependency
|
||
async function waitOn(filepath: string): Promise<void> { | ||
const pollingIntervalMs = 300; | ||
const stabilityWindowMs = 750; |
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 is the previous logic, but it seems a little bit fragile, or prone to add delay.
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 long as no regression, we'll take it! It should also be much more trivial to make it more robust now :)
LGTM thanks 👍 |
wait-on
dependencywait-on
dependency with custom lighter code
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
Pre-flight checklist
Motivation
This change removes usage of
wait-on
which brings in a few dependencies it ideally wouldn't, and replaces it with an effective copy of the algorithm and APIs it takes under the hood for current usage.wait-on
sees a file as present whenfs.stat
on the path stops throwingwait-on
defaults to no timout, so we poll forever.See https://github.com/jeffbski/wait-on/blob/master/lib/wait-on.js#L200 for reference
Test Plan
waitOn
function to a standalone Node scriptawait waitOn('foo/bar.js')
with CWD of/Users/ngerlem/github/docusaurus
/Users/ngerlem/github/docusaurus/foo
/Users/ngerlem/github/docusaurus/bar.js
Promise is resolved shortly after.
WaitPlugin as invoked by build does not hang.
Test links
Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/
Related issues/PRs