-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
fix: live reload port fallback if port is used #899
Conversation
Deploy preview for docusaurus-preview ready! Built with commit febf0d5 |
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.
@tom-auger I love that you did this.
In general, this looks overall better to me. I want a 2nd pair of eyes for confirmation.
lib/__tests__/findUnusedPort.test.js
Outdated
@@ -0,0 +1,83 @@ | |||
/** |
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.
❤️ that you are adding tests.
module.exports = { | ||
LIVE_RELOAD_PORT: 35729, | ||
const tinylrServer = { | ||
listen: jest.fn(), |
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 file has no relationship to the constants
file, right? You just changed the constants
file and then made a file move. I am just wondering why GitHub thinks this is a file move.
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.
That's right, the two files are unrelated. I actually deleted the constants
file in a separate commit, and added the tiny-lr
mock in a later one, so I'm not sure why GitHub thinks this was a file move 😕
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.
Skimmed through it, seems ok for me.
Something to consider:
- Use https://www.npmjs.com/package/portfinder instead of building our own. But this PR's
findUnusedPort
looks OK to me - I think
lib/serverController.js
should be namedlib/server/start
or at least moved tolib/server
folder since ideally we want all thedocusaurus-<command>
to be onlib
folder and not others
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.
@tom-auger This is awesome! I think the tests are quite overkill since this is a non-essential feature and pretty simple to test. But I absolutely love that you're adding them. Do you have time to respond to the comments by @endiliey? If not I think we could fix it for you and merge it. Let us know 😄
@yangshun thanks 😃, sure I can fix it up! RE the comments by @endiliey:
|
@yangshun I've made the suggested changes. I fixed the tests too, but if you don't want to keep them feel free to remove them 😄 |
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.
LGTM.
Amazed that you were able to add the test 😭
Motivation
Fixes #731
Have you read the Contributing Guidelines on pull requests?
Yes.
Test Plan
Related PRs
N/A