Skip to content

Commit

Permalink
fix: remove --prefer-offline when running npm install
Browse files Browse the repository at this point in the history
We were using `--prefer-offline` when running `npm install` during `wrangler init`. The behaviour is odd, it doesn't seem to fetch from the remote when the cache isn't hit, which is not what I'm expecting. So we remove `--prefer-offline`.
  • Loading branch information
threepointone committed Jan 26, 2022
1 parent 487afde commit 8a7ad69
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
7 changes: 7 additions & 0 deletions .changeset/shaggy-suns-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

fix: remove `--prefer-offline` when running `npm install`

We were using `--prefer-offline` when running `npm install` during `wrangler init`. The behaviour is odd, it doesn't seem to fetch from the remote when the cache isn't hit, which is not what I'm expecting. So we remove `--prefer-offline`.
23 changes: 4 additions & 19 deletions packages/wrangler/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export async function main(argv: string[]): Promise<void> {
" "
) + "\n"
);
await execa("npm", ["install", "--prefer-offline"], {
await execa("npm", ["install"], {
stdio: "inherit",
});
console.log(`✨ Created package.json`);
Expand All @@ -264,12 +264,7 @@ export async function main(argv: string[]): Promise<void> {
if (shouldInstall) {
await execa(
"npm",
[
"install",
`wrangler@${wranglerVersion}`,
"--save-dev",
"--prefer-offline",
],
["install", `wrangler@${wranglerVersion}`, "--save-dev"],
{
stdio: "inherit",
}
Expand Down Expand Up @@ -309,12 +304,7 @@ export async function main(argv: string[]): Promise<void> {
);
await execa(
"npm",
[
"install",
"@cloudflare/workers-types",
"--save-dev",
"--prefer-offline",
],
["install", "@cloudflare/workers-types", "--save-dev"],
{ stdio: "inherit" }
);
console.log(
Expand All @@ -340,12 +330,7 @@ export async function main(argv: string[]): Promise<void> {
if (shouldInstall) {
await execa(
"npm",
[
"install",
"@cloudflare/workers-types",
"--save-dev",
"--prefer-offline",
],
["install", "@cloudflare/workers-types", "--save-dev"],
{
stdio: "inherit",
}
Expand Down

0 comments on commit 8a7ad69

Please sign in to comment.