-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
feat(v2): prompt user when default port is in use #3006
Conversation
Deploy preview for docusaurus-2 ready! Built with commit dbf356c |
} | ||
|
||
// Gets package name in a directory | ||
async function getPackageNameInDirectory( |
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.
No need to export it
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.
Are you saying to remove the export default function getProcessForPort
? I am using the function in another file.
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.
@yangshun I guess it's not a problem to copy facebook code from one project to another right? This is heavily inspired from current CRA code: https://github.com/facebook/create-react-app/blob/f5c3bdb65480f93b2d4a4c2f3214fc50753de434/packages/react-dev-utils/WebpackDevServerUtils.js#L448 |
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.
portfinder should be removed + I think we should document it's code inspired from CRA + isolate it better in a single place. Probably does not belong to webpack utils, it's not really webpack related.
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 seems nice, thanks
Motivation
This PR implements what was proposed in #3005.
When a user already has a process running on the default docusaurus port, docusaurus finds the next open port and runs the client on it. Based on a simular implementation in create-react-app, this feature warns the user if something is already running on the default port, and asks them if they want to run the client on a different port.
Have you read the Contributing Guidelines on pull requests?
yes
Test Plan
Run a program on port 3000 (I ran create-react-app)
yarn start
When you try to run
yarn start
with another app already running on the Docusaurus default port:When you select "Yes":
When you select "No":
Related PRs
(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)