@@ -4,20 +4,11 @@ import fs from "node:fs";
44import path from "node:path" ;
55import stream from "node:stream" ;
66import { promisify } from "node:util" ;
7- import { fetch } from "@remix-run/web-fetch" ;
87import gunzip from "gunzip-maybe" ;
98import tar from "tar-fs" ;
10- import { ProxyAgent } from "proxy-agent" ;
119
1210import { color , isUrl } from "./utils" ;
1311
14- const defaultAgent = new ProxyAgent ( ) ;
15- const httpsAgent = new ProxyAgent ( ) ;
16- httpsAgent . protocol = "https:" ;
17- function agent ( url : string ) {
18- return new URL ( url ) . protocol === "https:" ? httpsAgent : defaultAgent ;
19- }
20-
2112export async function copyTemplate (
2213 template : string ,
2314 destPath : string ,
@@ -234,10 +225,7 @@ async function downloadAndExtractTarball(
234225 ? `https://api.github.com/repos/${ info . owner } /${ info . name } /releases/latest`
235226 : `https://api.github.com/repos/${ info . owner } /${ info . name } /releases/tags/${ info . tag } ` ;
236227
237- let response = await fetch ( releaseUrl , {
238- agent : agent ( "https://api.github.com" ) ,
239- headers,
240- } ) ;
228+ let response = await fetch ( releaseUrl , { headers } ) ;
241229
242230 if ( response . status !== 200 ) {
243231 throw new CopyTemplateError (
@@ -274,10 +262,7 @@ async function downloadAndExtractTarball(
274262 resourceUrl = `https://api.github.com/repos/${ info . owner } /${ info . name } /releases/assets/${ assetId } ` ;
275263 headers . Accept = "application/octet-stream" ;
276264 }
277- let response = await fetch ( resourceUrl , {
278- agent : agent ( resourceUrl ) ,
279- headers,
280- } ) ;
265+ let response = await fetch ( resourceUrl , { headers } ) ;
281266
282267 if ( ! response . body || response . status !== 200 ) {
283268 if ( token ) {
0 commit comments