Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,6 @@ function getFrameworkTestConfig(pm: string): NamedFrameworkTestConfig[] {
},
{
name: "redwood",
// quarantined while we investigate CI failures
quarantine: true,
testCommitMessage: true,
timeout: LONG_TIMEOUT,
unsupportedOSs: ["win32"],
Expand Down
19 changes: 16 additions & 3 deletions packages/create-cloudflare/src/helpers/packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type InstallConfig = {
startText?: string;
doneText?: string;
dev?: boolean;
force?: boolean;
};

/**
Expand All @@ -21,6 +22,7 @@ type InstallConfig = {
* @param config.dev - Add packages as `devDependencies`
* @param config.startText - Spinner start text
* @param config.doneText - Spinner done text
* @param config.force - Add `--force` flag
*/
export const installPackages = async (
packages: string[],
Expand Down Expand Up @@ -51,10 +53,21 @@ export const installPackages = async (
break;
}

await runCommand([npm, cmd, ...(saveFlag ? [saveFlag] : []), ...packages], {
...config,
const { force, ...commandConfig } = config;

await runCommand(
[
npm,
cmd,
...(saveFlag ? [saveFlag] : []),
...(force ? ["--force"] : []),
...packages,
],
{
...commandConfig,
silent: true,
});
},
);

if (npm === "npm") {
// Npm install will update the package.json with a caret-range rather than the exact version/range we asked for.
Expand Down
9 changes: 9 additions & 0 deletions packages/create-cloudflare/templates/redwood/c3.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { logRaw } from "@cloudflare/cli";
import { runFrameworkGenerator } from "frameworks/index";
import { detectPackageManager } from "helpers/packageManagers";
import { installPackages } from "helpers/packages";
import type { TemplateConfig } from "../../src/templates";
import type { C3Context } from "types";

Expand All @@ -9,6 +10,14 @@ const { npm } = detectPackageManager();
const generate = async (ctx: C3Context) => {
await runFrameworkGenerator(ctx, [ctx.project.name]);

// Note: for redwood projects we need to force install the latest version of wrangler
// if we don't do the CI npm e2e fails to install the app's dependencies
// (we couldn't reproduce this locally, but it can possibly happen to users as well?)
await installPackages([`wrangler@latest`], {
dev: true,
force: true,
});

logRaw("");
};

Expand Down
Loading