Skip to content

Commit 25d5835

Browse files
Update the migrate command to attempt to create an R2 bucket for caching as part of the migration process (#1133)
1 parent 2e4e595 commit 25d5835

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1303
-412
lines changed

.changeset/bright-colts-march.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/cloudflare": minor
3+
---
4+
5+
Update the `migrate` command to attempt to create an R2 bucket for caching, if that is not possible an application without caching enabled will be generated instead.

create-cloudflare/next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
"eslint-config-next": "15.4.6",
2929
"tailwindcss": "^4",
3030
"typescript": "^5.7.4",
31-
"wrangler": "^4.59.3"
31+
"wrangler": "^4.65.0"
3232
}
3333
}

packages/cloudflare/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"cloudflare": "^4.4.1",
5959
"enquirer": "^2.4.1",
6060
"glob": "catalog:",
61+
"comment-json": "^4.5.1",
6162
"ts-tqdm": "^0.8.6",
6263
"yargs": "catalog:"
6364
},

packages/cloudflare/src/cli/build/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import logger from "@opennextjs/aws/logger.js";
99
import type { Unstable_Config } from "wrangler";
1010

1111
import { OpenNextConfig } from "../../api/config.js";
12-
import { ensureNextjsVersionSupported } from "../commands/utils.js";
1312
import type { ProjectOptions } from "../project-options.js";
13+
import { ensureNextjsVersionSupported } from "../utils/nextjs-support.js";
1414
import { bundleServer } from "./bundle-server.js";
1515
import { compileCacheAssetsManifestSqlFile } from "./open-next/compile-cache-assets-manifest.js";
1616
import { compileEnvFiles } from "./open-next/compile-env-files.js";

packages/cloudflare/src/cli/build/bundle-server.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { build, type Plugin } from "esbuild";
1010

1111
import { getOpenNextConfig } from "../../api/config.js";
1212
import type { ProjectOptions } from "../project-options.js";
13+
import { normalizePath } from "../utils/normalize-path.js";
1314
import { patchVercelOgLibrary } from "./patches/ast/patch-vercel-og-library.js";
1415
import { patchWebpackRuntime } from "./patches/ast/webpack-runtime.js";
1516
import { inlineDynamicRequires } from "./patches/plugins/dynamic-requires.js";
@@ -26,7 +27,8 @@ import { shimRequireHook } from "./patches/plugins/require-hook.js";
2627
import { patchRouteModules } from "./patches/plugins/route-module.js";
2728
import { shimReact } from "./patches/plugins/shim-react.js";
2829
import { setWranglerExternal } from "./patches/plugins/wrangler-external.js";
29-
import { copyPackageCliFiles, needsExperimentalReact, normalizePath } from "./utils/index.js";
30+
import { copyPackageCliFiles } from "./utils/copy-package-cli-files.js";
31+
import { needsExperimentalReact } from "./utils/needs-experimental-react.js";
3032

3133
/** The dist directory of the Cloudflare adapter package */
3234
const packageDistDir = path.join(path.dirname(fileURLToPath(import.meta.url)), "../..");

packages/cloudflare/src/cli/build/open-next/compile-env-files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import path from "node:path";
33

44
import { BuildOptions } from "@opennextjs/aws/build/helper.js";
55

6-
import { extractProjectEnvVars } from "../utils/index.js";
6+
import { extractProjectEnvVars } from "../../utils/extract-project-env-vars.js";
77

88
/**
99
* Compiles the values extracted from the project's env files to the output directory for use in the worker.

packages/cloudflare/src/cli/build/open-next/createServerBundle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ import { getCrossPlatformPathRegex } from "@opennextjs/aws/utils/regex.js";
2626
import type { Plugin } from "esbuild";
2727

2828
import { getOpenNextConfig } from "../../../api/config.js";
29+
import { normalizePath } from "../../utils/normalize-path.js";
2930
import { patchResRevalidate } from "../patches/plugins/res-revalidate.js";
3031
import { patchTurbopackRuntime } from "../patches/plugins/turbopack.js";
3132
import { patchUseCacheIO } from "../patches/plugins/use-cache.js";
32-
import { normalizePath } from "../utils/index.js";
3333
import { copyWorkerdPackages } from "../utils/workerd.js";
3434

3535
interface CodeCustomization {

packages/cloudflare/src/cli/build/patches/plugins/dynamic-requires.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { patchCode, type RuleConfig } from "@opennextjs/aws/build/patch/astCodeP
66
import type { ContentUpdater, Plugin } from "@opennextjs/aws/plugins/content-updater.js";
77
import { getCrossPlatformPathRegex } from "@opennextjs/aws/utils/regex.js";
88

9-
import { normalizePath } from "../../utils/normalize-path.js";
9+
import { normalizePath } from "../../../utils/normalize-path.js";
1010

1111
async function getPagesManifests(serverDir: string): Promise<string[]> {
1212
try {

packages/cloudflare/src/cli/build/patches/plugins/instrumentation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { patchCode } from "@opennextjs/aws/build/patch/astCodePatcher.js";
66
import type { ContentUpdater, Plugin } from "@opennextjs/aws/plugins/content-updater.js";
77
import { getCrossPlatformPathRegex } from "@opennextjs/aws/utils/regex.js";
88

9-
import { normalizePath } from "../../utils/normalize-path.js";
9+
import { normalizePath } from "../../../utils/normalize-path.js";
1010

1111
export function patchInstrumentation(updater: ContentUpdater, buildOpts: BuildOptions): Plugin {
1212
const builtInstrumentationPath = getBuiltInstrumentationPath(buildOpts);

packages/cloudflare/src/cli/build/patches/plugins/load-manifest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type { ContentUpdater, Plugin } from "@opennextjs/aws/plugins/content-upd
1313
import { getCrossPlatformPathRegex } from "@opennextjs/aws/utils/regex.js";
1414
import { glob } from "glob";
1515

16-
import { normalizePath } from "../../utils/normalize-path.js";
16+
import { normalizePath } from "../../../utils/normalize-path.js";
1717

1818
export function inlineLoadManifest(updater: ContentUpdater, buildOpts: BuildOptions): Plugin {
1919
return updater.updateContent("inline-load-manifest", [

0 commit comments

Comments
 (0)