Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): preserve random port when restarting #5793

Merged
merged 6 commits into from
May 25, 2019
Merged

Conversation

Atinux
Copy link
Member

@Atinux Atinux commented May 23, 2019

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

It's only for nuxt dev command.
When the given port is already used and Nuxt uses a random port, changing nuxt.config.js will restart the server but it will assign another port again and the DX is ruined.

This PR aims to re-uses the same port when a random port is assigned at first.

Checklist:

  • I have added tests to cover my changes (if not applicable, please state why)
    -> Will need some help here @clarkdo 馃檹
  • All new and existing tests are passing.

@pi0
Copy link
Member

pi0 commented May 23, 2019

Can we move used port variable to the listener.js file? Memorizing random port and reusing it again.

@Atinux
Copy link
Member Author

Atinux commented May 23, 2019

Will do it :)

@codecov-io
Copy link

codecov-io commented May 23, 2019

Codecov Report

Merging #5793 into dev will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #5793      +/-   ##
==========================================
+ Coverage   95.66%   95.67%   +<.01%     
==========================================
  Files          82       82              
  Lines        2675     2679       +4     
  Branches      685      685              
==========================================
+ Hits         2559     2563       +4     
  Misses         98       98              
  Partials       18       18
Flag Coverage 螖
#e2e 100% <酶> (酶) 猬嗭笍
#fixtures 50.46% <14.28%> (-0.04%) 猬囷笍
#unit 92.64% <100%> (+0.01%) 猬嗭笍
Impacted Files Coverage 螖
packages/server/src/listener.js 100% <100%> (酶) 猬嗭笍

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update 668db6f...4c68961. Read the comment docs.

@pi0 pi0 changed the title fix: Use same port when restarting Nuxt with random port used fix(server): preserve random port when restarting May 25, 2019
@Atinux
Copy link
Member Author

Atinux commented May 25, 2019

Thanks @pi0 for the refactor and tests 鉂わ笍

I reviewed and approve (but cannot through GH since I am the author of the PR).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants