withastro/astro

@astrojs/upgrade fails when registry URL includes port

millette opened this issue · 1 comments

Astro Info

Astro                    v4.16.16
Node                     v22.12.0
System                   Linux (x64)
Package Manager          pnpm
Output                   hybrid
Adapter                  @astrojs/node
Integrations             @astrojs/tailwind
                         astro-devtool-breakpoints
                         @astrojs/solid-js

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

@astrojs/upgrade fails with "Unable to connect to the internet" error because I use verdaccio registry on localhost.

create astro simply checks if github is online:
https://github.com/withastro/astro/blob/main/packages/create-astro/src/actions/verify.ts#L35C1-L40C2

@astrojs/upgrade on the other hand checks if the registry is online, but that fails on localhost (with local verdaccio registry).

What's the expected result?

@astrojs/node should detect that we're online by simply checking github.com

Link to Minimal Reproducible Example

https://stackblitz.com/github/withastro/astro/tree/latest/examples/minimal?file=README.md&on=stackblitz

Participation

  • I am willing to submit a pull request for this issue.

https://www.npmjs.com/package/is-port-reachable is pretty simple (26 loc): https://github.com/sindresorhus/is-port-reachable/blob/main/index.js with no deps. Maybe depend on that in @astrojs/upgrade and create?

That would work to test my localhost verdaccio as well as a remote registry and github.com.