Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Detect and use the next available port after 3000 when starting Evidence dev server #31

Open
mcrascal opened this issue May 30, 2023 · 6 comments
Labels
enhancement New feature or request UX User experience feature or improvement

Comments

@mcrascal
Copy link
Member

Fine tuning -- not for current release

If you launch the dev server while localhost:3000 is occupied elsewhere, evidence will launch on localhost:3001 -- the simple browser preview that the extension opens should respect the new development url.

@RandomFractals RandomFractals added the enhancement New feature or request label May 30, 2023
@RandomFractals
Copy link
Contributor

Agreed. Occupied port discovery was something I planned to look into. However, I only saw your app use port 3000 and all the docs state so in command examples. So, I thought it's the default and only port your users use.

We already have host forwarding enabled for GitHub Codespaces (#21).

We'll add dynamic port finding in the next release too.

@RandomFractals
Copy link
Contributor

RandomFractals commented May 31, 2023

.@mcrascal: does Evidence dev server simply try the next available port after 3000?

Per your CLI docs, we can pass --port parameter to npm exec evidence dev command we issue to VS Code terminal to start Evidence app dev server with the next available port we find after 3000.

@RandomFractals RandomFractals changed the title Handle fall back localhosts Detect and use the next available port after 3000 when starting Evidence dev server May 31, 2023
@RandomFractals
Copy link
Contributor

RandomFractals commented May 31, 2023

  • Add httpUtils.ts to extension src/utils/ for all http related APIs: available port detection, ping, etc.

@mcrascal
Copy link
Member Author

@RandomFractals yes

https://vitejs.dev/config/server-options.html#server-port

RandomFractals added a commit that referenced this issue Jun 1, 2023
…ence dev command when running local (#31)

for visibility in terminal when starting Evidence app dev server with that command, etc.
RandomFractals added a commit that referenced this issue Jun 1, 2023
…31)

- remove old defaultAppPort constant from preview.ts
- change localAppUrl to just http://localhost without port
- allow relative path page url requests and map them to external Uris with host and port rewriting
@RandomFractals
Copy link
Contributor

This feature is almost complete. We just need to resolve the 5001 port increment disconnect when rewriting preview page url and opening it in a simple browser. We already detect free port and pass it as param to the start server command via terminal.

@archiewood created a good capture of the increment port disconnect here: #52 (comment)

RandomFractals added a commit that referenced this issue Jun 4, 2023
@RandomFractals
Copy link
Contributor

RandomFractals commented Jun 4, 2023

  • This is not fully resolved due to vite server and our free port detection and the server start command we send being out of sync.
  • The way I see it, finalizing this feature is nice to have when we have more time to troubleshoot it.
  • There is a workaround that users can use and set different evidence.defaultPort value in the new Evidence extension settings.
  • Also, listed in our new Limitations section in docs: https://github.com/evidence-dev/evidence-vscode#limitations
  • Will not fix in Sprint 2 for the v1.1.0 enhancements and improved onboarding user experince, but can take a look at this later in Sprint 3, if we have time for this nice to have feature

@RandomFractals RandomFractals added the wontfix This will not be worked on label Jun 4, 2023
@archiewood archiewood added UX User experience feature or improvement and removed wontfix This will not be worked on labels Sep 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request UX User experience feature or improvement
Projects
None yet
Development

No branches or pull requests

3 participants