chore(core): replace wait-on dependency with custom lighter code#9547
Merged
slorber merged 3 commits intofacebook:mainfrom Nov 20, 2023
Merged
chore(core): replace wait-on dependency with custom lighter code#9547slorber merged 3 commits intofacebook:mainfrom
wait-on dependency with custom lighter code#9547slorber merged 3 commits intofacebook:mainfrom
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
NickGerleman
commented
Nov 14, 2023
|
|
||
| async function waitOn(filepath: string): Promise<void> { | ||
| const pollingIntervalMs = 300; | ||
| const stabilityWindowMs = 750; |
Contributor
Author
There was a problem hiding this comment.
This is the previous logic, but it seems a little bit fragile, or prone to add delay.
Collaborator
There was a problem hiding this comment.
As long as no regression, we'll take it! It should also be much more trivial to make it more robust now :)
Josh-Cena
reviewed
Nov 15, 2023
Collaborator
|
LGTM thanks 👍 |
wait-on dependencywait-on dependency with custom lighter code
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
slorber
pushed a commit
that referenced
this pull request
Nov 30, 2023
This was referenced May 26, 2024
This was referenced Jun 14, 2024
This was referenced Jun 16, 2024
This was referenced Jun 20, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-flight checklist
Motivation
This change removes usage of
wait-onwhich 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-onsees a file as present whenfs.staton the path stops throwingwait-ondefaults 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
waitOnfunction 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.jsPromise 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