[devtools] Introduce REACT_DEVTOOLS_PORT for the standalone react-devtools
Summary
This PR attempts to make running the React DevTools a little friendlier in projects that are not completely React.
At the moment, running the DevTools with npx react-devtools will default to the port to use the PORT env variable otherwise it'll fall back to 8097. PORT is a common env variable, so we can get into this strange situation where the a Rails server (eg Puma) is using PORT, and then the React DevTools attempts to boot using the same PORT.
This PR introduces a dedicated env variable, REACT_DEVTOOLS_PORT to assist in this scenario.
How did you test this change?
I'm using fish shell, so I did the following, please let me know if there's a better way:
cd packages/react-devtools
set -x PORT 1000
set -x REACT_DEVTOOLS_PORT 2000
node bin.js
We can see in the UI that it's listening on 2000. Without this PR, it'd listen on 1000:
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| react-compiler-playground | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Nov 11, 2024 9:44am |
Hi @brendo!
Thank you for your pull request and welcome to our community.
Action Required
In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.
Process
In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.
Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.
If you have received this in error or have any questions, please contact us at [email protected]. Thanks!
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!
👋 @sebmarkbage @hoxyq is this PR something the team would be interested in?
This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.
Bump.
Thanks!
This will be available with the next release of the npm package, I don't have dates set yet, but probably in a few weeks.
Thank you!