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(angular): automatically set next remote port #9422
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/nrwl/nx-dev/An3iQnv1p4M5DpBiV6uPGVXRgkHN [Deployment for a309639 canceled] |
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! 🎉
ports.add(port); | ||
} | ||
|
||
const nextAvailablePort = [...ports].sort((a, b) => b - a)[0] + 1; |
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.
nit: we could improve readability a bit by doing:
const nextAvailablePort = [...ports].sort((a, b) => b - a)[0] + 1; | |
const nextAvailablePort = Math.max(...ports) + 1; |
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.
I like that a lot!
8aa79a1
to
a309639
Compare
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
We expect people to pass a port for their remote apps. However, we default to
4200
if they do not. This can cause conflicts when a host app has multiple remotes on the same port.Expected Behavior
Instead of defaulting to
4200
, scan the ports used in the workspace and pick a port that is 1 greater than the highest value.We should not run into issues with reserved ports as the current range of ports is open for use.
In development, the user shouldn't need to care where their remotes are being served if they are being accessed via host.
Also, the
serve
command on a remote app will specify the URL of the served app.