Closed babakfp closed 6 months ago
Does having the ability to use a proxy with the CLI not address this issue at all? See: #401 #402
Does having the ability to use a proxy with the CLI not address this issue at all? See: #401 #402
First time trying it out.
This worked: npx shadcn-svelte@latest add dropdown-menu --proxy zx------join.outline-vpn.cloud:443
This didn't: npx shadcn-svelte@latest init --proxy zx------join.outline-vpn.cloud:443
Does GitHub provide something like Vercel to host it here?
We just need to add the proxy option to all the commands and it will work. At this time I'm not considering moving the registry to GitHub or elsewhere.
Sounds good.
I think adding a note about the proxy option on the installation page can help.
This package svelte-add works fine for me without needing to use a VPN or a proxy option. Maybe it's a good idea to take a look into how they do it later on.
If anyone has the cycles to tackle this, we just need to add the proxy options that currently exist for the add
command to the init
and other commands as well!
Hey. I can work on it 🤚
We just need to add the proxy option to all the commands and it will work. At this time I'm not considering moving the registry to GitHub or elsewhere.
@huntabyte I believe a better approach can be to use mirrors of the registry servers instead of proxies. If the registry servers don't need any dynamic server-side functionality, then any static web host can serve as a mirror. And the CLI would try these mirrors just in case the primary registry server fails. A good static site hosting will be Cloudflare Pages, since Cloudflare is an edge-only network and has locations in almost every country, with peer-to-peer network with most ISPs of the world.
Guys, I found a better solution 😄.
I took the JSON registry content, moved it into a fresh SvelteKit project, and deployed it on Netlify. I replaced the registry URL in the CLI with https://inspiring-kheer-efb0f9.netlify.app, tested it out, and things just worked without needing a VPN.
If anyone else wants to test this out, do these steps:
npx shadcn-svelte-text-abc-cli init
git clone --depth 1 https://github.com/huntabyte/shadcn-svelte.git
.packages/cli/src/utils/registry/index.ts
, and replace const baseUrl = process.env.COMPONENTS_REGISTRY_URL ?? "https://shadcn-svelte.com";
with const baseUrl = "https://inspiring-kheer-efb0f9.netlify.app";
.cd packages/cli
.pnpm i
.pnpm dev
(in the first terminal).pnpm start:dev init
.I think this means the whole website needs to be deployed on Netlify.
Maybe react with a 👍 if this works for you.
Try switching network.
That resolved it for me
We're now running on Cloudflare so this issue should be resolved, if not, it won't be and you'll need to fork and maintain a deployed fork on a server that supports your location.
It works with no problems 👏👍🌸
Hi,
You can proxy just by adding/exposing HTTP_PROXY
to the shell. Please read this Docs: Outgoing Requests
. Adding the proxy
flag to every command was inconvenient because you could just use an environment variable.
Here are examples of how you can initialize your project with a proxy:
$ HTTP_PROXY=http://localhost:8080 npx shadcn-svelte@latest init
# Or
$ export HTTP_PROXY=http://localhost:8080
$ npx shadcn-svelte@latest init
This is a really late response, I'm sorry.
Current Behavior
Hello 👋
I was trying out shadcn-svelte for the first time and I found out there is a problem when downloading components:
The issue is that the servers are not accessible from my country (Iran). Is it possible to change servers to whatever GitHub uses?
UPDATE:
This issue isn't specific to this library or Vercel.
I don't know what GitHub does to make their servers to be available in Iran. Whatever it is, Vercel can't do it (I talked to them a while ago and they didn't have a solution if I don't misremember).
For almost all of the time that I use the Internet, I use a VPN called v2rayN. In this app, there is an option called "Tun Mode", which if turned on, the whole system uses the new IP and VPN stuff thing. So, this is how I get the VPN working in the console too.
If it's possible to add a note when the connection times out, we can add a link to redirect the users to a page that guides them on how to solve this issue. I can help with writing the guide.
If it is possible to change the servers or have an alternative that kicks in, I'd be happy to help check it out if it works or not.