Skip to content

Conversation

@rschristian
Copy link
Member

What kind of change does this PR introduce?

Refactor to config precedence

Did you add tests for your changes?

Yes

Summary

Closes #1596

Determining the port is a tad different now:

--port -> $PORT -> 8080 -> <random>

Far left is preferred, far right is the fall back.

The other change is that if a user explicitly selects a port with -p/--port that is already taken, we throw an error and exit. That scenario is almost certainly a mistake, either in something running on a port it shouldn't or the wrong port passed to preact-cli. We will continue to fall back to random if $PORT is already set and already in use, with the idea being that it's probably another service setting and using that value.

I believe this makes a bit more sense, though could just be my opinion. Let me know!

Does this PR introduce a breaking change?

No

@rschristian rschristian requested a review from a team as a code owner November 13, 2021 04:40
@changeset-bot
Copy link

changeset-bot bot commented Nov 13, 2021

🦋 Changeset detected

Latest commit: b6a1ee7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
preact-cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@rschristian rschristian force-pushed the fix/port-config-precedence branch from 5d978ec to 55160ee Compare November 13, 2021 04:47
@ForsakenHarmony ForsakenHarmony merged commit a4a66ce into master Nov 17, 2021
@ForsakenHarmony ForsakenHarmony deleted the fix/port-config-precedence branch November 17, 2021 17:48
@preact-bot preact-bot mentioned this pull request Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

$PORT preferred over --port

3 participants