Skip to content

Commit acbea32

Browse files
fix and update experimental Next.js template to work on @opennextjs/[email protected] (#7638)
* update the experimental Next.js template to work on `@opennextjs/[email protected]` * include `.dev.vars` template file * skip bun and yarn experimental e2es
1 parent 9989022 commit acbea32

File tree

8 files changed

+50
-10
lines changed

8 files changed

+50
-10
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-cloudflare": patch
3+
---
4+
5+
fix and update experimental Next.js template to work on `@opennextjs/[email protected]`

packages/create-cloudflare/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ templates*/**/pnpm-lock.yaml
1313
# the build step renames .gitignore files to __dot__gitignore
1414
templates*/**/__dot__gitignore
1515

16+
# include .dev.vars template files
17+
!templates*/**/.dev.vars
18+
1619
scripts/snippets
1720
!scripts/snippets/.gitkeep

packages/create-cloudflare/e2e-tests/frameworks.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ function getFrameworkTests(opts: {
188188
expectedText: "Create Next App",
189189
},
190190
unsupportedOSs: ["win32"],
191+
unsupportedPms: [
192+
// bun and yarn are failing in CI
193+
"bun",
194+
"yarn",
195+
],
191196
},
192197
nuxt: {
193198
testCommitMessage: true,

packages/create-cloudflare/templates-experimental/next/c3.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const generate = async (ctx: C3Context) => {
1919

2020
const configure = async () => {
2121
const packages = [
22-
"@opennextjs/cloudflare@0.2.x",
22+
"@opennextjs/cloudflare@0.3.x",
2323
"@cloudflare/workers-types",
2424
];
2525
await installPackages(packages, {
@@ -47,8 +47,8 @@ export default {
4747
configure,
4848
transformPackageJson: async () => ({
4949
scripts: {
50-
deploy: `cloudflare && wrangler deploy`,
51-
preview: `cloudflare && wrangler dev`,
50+
deploy: `opennextjs-cloudflare && wrangler deploy`,
51+
preview: `opennextjs-cloudflare && wrangler dev`,
5252
"cf-typegen": `wrangler types --env-interface CloudflareEnv env.d.ts`,
5353
},
5454
}),
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Load .env.development* files when running `wrangler dev`
2+
NEXTJS_ENV=development

packages/create-cloudflare/templates-experimental/next/templates/.gitignore

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,5 @@ yarn-error.log*
3535
*.tsbuildinfo
3636
next-env.d.ts
3737

38-
39-
# Cloudflare related
40-
/.save.next
41-
/.worker-next
42-
/.wrangler
38+
# OpenNext
39+
/.open-next
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import cache from "@opennextjs/cloudflare/kvCache";
2+
3+
const config = {
4+
default: {
5+
override: {
6+
wrapper: "cloudflare-node",
7+
converter: "edge",
8+
incrementalCache: async () => cache,
9+
tagCache: "dummy",
10+
queue: "dummy",
11+
},
12+
},
13+
14+
middleware: {
15+
external: true,
16+
override: {
17+
wrapper: "cloudflare-edge",
18+
converter: "edge",
19+
proxyExternalRequest: "fetch",
20+
},
21+
},
22+
23+
dangerous: {
24+
enableCacheInterception: false,
25+
},
26+
};
27+
28+
export default config;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#:schema node_modules/wrangler/config-schema.json
22
name = "<app-name>"
3-
main = ".worker-next/index.mjs"
3+
main = ".open-next/worker.js"
44

55
compatibility_date = "2024-09-26"
66
compatibility_flags = ["nodejs_compat"]
@@ -9,4 +9,4 @@ compatibility_flags = ["nodejs_compat"]
99
minify = true
1010

1111
# Use the new Workers + Assets to host the static frontend files
12-
assets = { directory = ".worker-next/assets", binding = "ASSETS" }
12+
assets = { directory = ".open-next/assets", binding = "ASSETS" }

0 commit comments

Comments
 (0)