Skip to content

Commit

Permalink
chore: slightly improve env-proxy and rephrase docs (#1093)
Browse files Browse the repository at this point in the history
Co-authored-by: CokaKoala <31664583+AdrianGonz97@users.noreply.github.com>
  • Loading branch information
Shahrad Elahi and AdrianGonz97 authored May 16, 2024
1 parent b88992c commit becb41d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/weak-carrots-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"shadcn-svelte": patch
---

chore: Added more http proxy options
8 changes: 6 additions & 2 deletions apps/www/src/content/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ Options:

## Outgoing Requests

### proxy
### Proxy

A proxy to use for outgoing request to fetch from `shadcn` registry. If `HTTP_PROXY` or `http_proxy` environment variables are set, the underlying request library will honor proxy settings.
This enables the use of a proxy when sending out requests to fetch from the `shadcn` registry. If the `HTTP_PROXY` or `http_proxy` environment variables have been set, the request library underneath will respect the proxy settings.

```bash
HTTP_PROXY="<proxy-url>" npx shadcn-svelte@latest init
```
11 changes: 9 additions & 2 deletions packages/cli/src/utils/get-env-proxy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import process from "node:process";

export function getEnvProxy(): string | undefined {
const { HTTP_PROXY, http_proxy } = process.env;
return HTTP_PROXY || http_proxy;
const { env } = process;
return (
env.HTTP_PROXY ||
env.http_proxy ||
env.HTTPS_PROXY ||
env.https_proxy ||
env.npm_config_proxy ||
env.npm_config_https_proxy
);
}

0 comments on commit becb41d

Please sign in to comment.