diff --git a/package.json b/package.json index 91b13d4391e..3b21b58d817 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "@octokit/plugin-paginate-rest": "^2.17.0", "@octokit/rest": "^18.12.0", "@remix-run/changelog-github": "^0.0.5", + "@remix-run/web-fetch": "^4.4.0-pre.0", "@rollup/plugin-babel": "^5.2.2", "@rollup/plugin-json": "^5.0.0", "@rollup/plugin-node-resolve": "^11.0.1", diff --git a/packages/create-remix/copy-template.ts b/packages/create-remix/copy-template.ts index cf10b6b432d..15c5c92e38a 100644 --- a/packages/create-remix/copy-template.ts +++ b/packages/create-remix/copy-template.ts @@ -4,7 +4,7 @@ import fs from "node:fs"; import path from "node:path"; import stream from "node:stream"; import { promisify } from "node:util"; -import fetch from "node-fetch"; +import { fetch } from "@remix-run/web-fetch"; import gunzip from "gunzip-maybe"; import tar from "tar-fs"; import { ProxyAgent } from "proxy-agent"; @@ -28,9 +28,9 @@ export async function copyTemplate( /** * Valid templates are: * - local file or directory on disk - * - github owner/repo shorthand - * - github owner/repo/directory shorthand - * - full github repo URL + * - GitHub owner/repo shorthand + * - GitHub owner/repo/directory shorthand + * - full GitHub repo URL * - any tarball URL */ @@ -140,7 +140,7 @@ async function copyTemplateFromLocalFilePath( return false; } if (fs.statSync(filePath).isDirectory()) { - // If our template is just a directory on disk, return true here and we'll + // If our template is just a directory on disk, return true here, and we'll // just copy directly from there instead of "extracting" to a temp // directory first return true; @@ -224,10 +224,10 @@ async function downloadAndExtractTarball( headers.Authorization = `token ${token}`; } if (isGithubReleaseAssetUrl(tarballUrl)) { - // We can download the asset via the github api, but first we need to look + // We can download the asset via the GitHub api, but first we need to look // up the asset id let info = getGithubReleaseAssetInfo(tarballUrl); - headers.Accept = "application/vnd.github.v3+json"; + headers.Accept = "application/vnd.GitHub.v3+json"; let releaseUrl = info.tag === "latest" @@ -297,7 +297,7 @@ async function downloadAndExtractTarball( ); } - // file paths returned from github are always unix style + // file paths returned from GitHub are always unix style if (filePath) { filePath = filePath.split(path.sep).join(path.posix.sep); } @@ -419,7 +419,7 @@ function getGithubReleaseAssetInfo(browserUrl: string): ReleaseAssetInfo { let [, owner, name, , downloadOrLatest, tag, asset] = url.pathname.split("/"); if (downloadOrLatest === "latest" && tag === "download") { - // handle the Github URL quirk for latest releases + // handle the GitHub URL quirk for latest releases tag = "latest"; } diff --git a/packages/create-remix/package.json b/packages/create-remix/package.json index ed0c3af7293..38448132309 100644 --- a/packages/create-remix/package.json +++ b/packages/create-remix/package.json @@ -17,12 +17,12 @@ "create-remix": "dist/cli.js" }, "dependencies": { + "@remix-run/web-fetch": "^4.4.0-pre.0", "arg": "^5.0.1", "chalk": "^4.1.2", "execa": "5.1.1", "gunzip-maybe": "^1.4.2", "log-update": "^5.0.1", - "node-fetch": "^2.6.9", "proxy-agent": "^6.3.0", "recursive-readdir": "^2.2.3", "rimraf": "^4.1.2", @@ -34,7 +34,6 @@ }, "devDependencies": { "@types/gunzip-maybe": "^1.4.0", - "@types/node-fetch": "^2.5.7", "@types/recursive-readdir": "^2.2.1", "@types/tar-fs": "^2.0.1", "esbuild": "0.17.6", diff --git a/packages/remix-dev/package.json b/packages/remix-dev/package.json index 76ba763a832..b89933943ad 100644 --- a/packages/remix-dev/package.json +++ b/packages/remix-dev/package.json @@ -48,7 +48,6 @@ "lodash": "^4.17.21", "lodash.debounce": "^4.0.8", "minimatch": "^9.0.0", - "node-fetch": "^2.6.9", "ora": "^5.4.1", "picocolors": "^1.0.0", "picomatch": "^2.3.1", @@ -74,7 +73,6 @@ "@types/jsesc": "^3.0.1", "@types/lodash.debounce": "^4.0.6", "@types/node": "^18.17.1", - "@types/node-fetch": "^2.5.7", "@types/npmcli__package-json": "^4.0.0", "@types/picomatch": "^2.3.0", "@types/shelljs": "^0.8.11", diff --git a/scripts/deployment-test/_shared.mjs b/scripts/deployment-test/_shared.mjs index 15b047f6b4f..eb6055f1740 100644 --- a/scripts/deployment-test/_shared.mjs +++ b/scripts/deployment-test/_shared.mjs @@ -5,7 +5,7 @@ import crypto from "node:crypto"; import { sync as spawnSync } from "cross-spawn"; import PackageJson from "@npmcli/package-json"; import jsonfile from "jsonfile"; -import fetch from "node-fetch"; +import { fetch } from "@remix-run/web-fetch"; import retry from "fetch-retry"; let fetchRetry = retry(fetch); diff --git a/scripts/deployment-test/cf-pages.mjs b/scripts/deployment-test/cf-pages.mjs index b96e3f87f0a..97661b1c836 100644 --- a/scripts/deployment-test/cf-pages.mjs +++ b/scripts/deployment-test/cf-pages.mjs @@ -1,7 +1,7 @@ import path from "node:path"; import { sync as spawnSync } from "cross-spawn"; import fse from "fs-extra"; -import fetch from "node-fetch"; +import { fetch } from "@remix-run/web-fetch"; import PackageJson from "@npmcli/package-json"; import { diff --git a/scripts/deployment-test/cf-workers.mjs b/scripts/deployment-test/cf-workers.mjs index c1a7ca6d92c..9e6e73d1603 100644 --- a/scripts/deployment-test/cf-workers.mjs +++ b/scripts/deployment-test/cf-workers.mjs @@ -2,7 +2,7 @@ import path from "node:path"; import { sync as spawnSync } from "cross-spawn"; import fse from "fs-extra"; import toml from "@iarna/toml"; -import fetch from "node-fetch"; +import { fetch } from "@remix-run/web-fetch"; import PackageJson from "@npmcli/package-json"; import { diff --git a/yarn.lock b/yarn.lock index dd443b56125..3dd3bb86363 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2669,14 +2669,6 @@ resolved "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz" integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== -"@types/node-fetch@^2.5.7": - version "2.5.12" - resolved "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.12.tgz" - integrity sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw== - dependencies: - "@types/node" "*" - form-data "^3.0.0" - "@types/node@*", "@types/node@^18.17.1": version "18.17.1" resolved "https://registry.npmjs.org/@types/node/-/node-18.17.1.tgz#84c32903bf3a09f7878c391d31ff08f6fe7d8335" @@ -9038,7 +9030,7 @@ nice-try@^1.0.4: resolved "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz" integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== -node-fetch@^2.5.0, node-fetch@^2.6.7, node-fetch@^2.6.9: +node-fetch@^2.5.0, node-fetch@^2.6.7: version "2.6.9" resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz#7c7f744b5cc6eb5fd404e0c7a9fec630a55657e6" integrity sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==