Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove --prefer-offline when running npm install #312

Merged
merged 1 commit into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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