Skip to content

Commit 9709789

Browse files
dario-piotrowiczpenalosa
authored andcommitted
bump C3's stable create-next-app to 15.0.3 (#7241)
bump C3's `create-next-app` to 15.0.3 for the stable Next.js template, but pin the dependency to `14.2.5` in the experimental template since our open-next adapter doesn't yet have a fully stable and tested support for Next.js 15
1 parent df56faa commit 9709789

File tree

10 files changed

+35
-19
lines changed

10 files changed

+35
-19
lines changed

.changeset/shy-waves-prove.md

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+
update Next.js template to use Next.js v.15

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ function getFrameworkTests(opts: {
484484
"--tailwind",
485485
"--src-dir",
486486
"--app",
487+
"--turbopack",
487488
"--import-alias",
488489
"@/*",
489490
],

packages/create-cloudflare/src/frameworks/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ export const getFrameworkCli = (ctx: C3Context, withVersion = true) => {
1212

1313
const frameworkCli = ctx.template
1414
.frameworkCli as keyof typeof frameworksPackageJson.dependencies;
15-
const version = frameworksPackageJson.dependencies[frameworkCli];
15+
const version =
16+
ctx.template.frameworkCliPinnedVersion ??
17+
frameworksPackageJson.dependencies[frameworkCli];
1618
return withVersion ? `${frameworkCli}@${version}` : frameworkCli;
1719
};
1820

packages/create-cloudflare/src/frameworks/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@angular/create": "19.0.4",
1111
"create-docusaurus": "3.6.3",
1212
"create-hono": "0.14.3",
13-
"create-next-app": "14.2.5",
13+
"create-next-app": "15.0.3",
1414
"create-qwik": "1.11.0",
1515
"create-vite": "6.0.1",
1616
"create-remix": "2.15.1",

packages/create-cloudflare/src/templates.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,21 @@ export type TemplateConfig = {
6565
* to handle config version skew between different versions of c3
6666
*/
6767
configVersion: number;
68-
/** The id by which template is referred to internally and keyed in lookup maps*/
68+
/** The id by which template is referred to internally and keyed in lookup maps */
6969
id: string;
70-
/** A string that controls how the template is presented to the user in the selection menu*/
70+
/** A string that controls how the template is presented to the user in the selection menu */
7171
displayName: string;
72-
/** A string that explains what is inside the template, including any resources and how those will be used*/
72+
/** A string that explains what is inside the template, including any resources and how those will be used */
7373
description?: string;
7474
/** The deployment platform for this template */
7575
platform: "workers" | "pages";
76-
/** The name of the framework cli tool that is used to generate this project or undefined if none. */
76+
/** The name of the framework cli tool that is used to generate this project or undefined if none */
7777
frameworkCli?: string;
78+
/**
79+
* A specific version of the framework cli tool to use instead of the standard one taken from the src/frameworks/package.json
80+
* (which gets managed and bumped by dependabot)
81+
*/
82+
frameworkCliPinnedVersion?: string;
7883
/** When set to true, hides this template from the selection menu */
7984
hidden?: boolean;
8085
/** Specifies a set of files that will be copied to the project directory during creation.

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export default {
3030
configVersion: 1,
3131
id: "next",
3232
frameworkCli: "create-next-app",
33+
// TODO: here we need to specify a version of create-next-app which is different from the
34+
// standard one used in the stable Next.js template, that's because our open-next adapter
35+
// is not yet fully ready for Next.js 15, once it is we should remove the following
36+
frameworkCliPinnedVersion: "14.2.5",
3337
platform: "workers",
3438
displayName: "Next (using Node.js compat + Workers Assets)",
3539
path: "templates-experimental/next",

packages/create-cloudflare/templates/next/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ In order to enable the example:
4646
```ts
4747
// KV Example:
4848
```
49-
and uncomment the commented lines below it.
49+
and uncomment the commented lines below it (also uncomment the relevant imports).
5050
- Do the same in the `wrangler.toml` file, where
5151
the comment is:
5252
```
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { getRequestContext } from '@cloudflare/next-on-pages'
1+
// import { getRequestContext } from '@cloudflare/next-on-pages'
22

33
export const runtime = 'edge'
44

5-
export async function GET(request) {
6-
let responseText = 'Hello World'
5+
export async function GET() {
6+
const responseText = 'Hello World'
77

88
// In the edge runtime you can use Bindings that are available in your application
99
// (for more details see:
@@ -15,7 +15,7 @@ export async function GET(request) {
1515
// const myKv = getRequestContext().env.MY_KV_NAMESPACE
1616
// await myKv.put('suffix', ' from a KV store!')
1717
// const suffix = await myKv.get('suffix')
18-
// responseText += suffix
18+
// return new Response(responseText + suffix)
1919

2020
return new Response(responseText)
2121
}
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import type { NextRequest } from 'next/server'
2-
import { getRequestContext } from '@cloudflare/next-on-pages'
1+
// import { getRequestContext } from '@cloudflare/next-on-pages'
32

43
export const runtime = 'edge'
54

6-
export async function GET(request: NextRequest) {
7-
let responseText = 'Hello World'
5+
export async function GET() {
6+
const responseText = 'Hello World'
87

98
// In the edge runtime you can use Bindings that are available in your application
109
// (for more details see:
@@ -16,7 +15,7 @@ export async function GET(request: NextRequest) {
1615
// const myKv = getRequestContext().env.MY_KV_NAMESPACE
1716
// await myKv.put('suffix', ' from a KV store!')
1817
// const suffix = await myKv.get('suffix')
19-
// responseText += suffix
18+
// return new Response(responseText + suffix)
2019

2120
return new Response(responseText)
2221
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ const generate = async (ctx: C3Context) => {
4949
updateStatus("Created wrangler.toml file");
5050
};
5151

52-
const updateNextConfig = () => {
52+
const updateNextConfig = (usesTs: boolean) => {
5353
const s = spinner();
5454

55-
const configFile = "next.config.mjs";
55+
const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
5656
s.start(`Updating \`${configFile}\``);
5757

5858
const configContent = readFile(configFile);
@@ -107,7 +107,7 @@ const configure = async (ctx: C3Context) => {
107107
await writeEslintrc(ctx);
108108
}
109109

110-
updateNextConfig();
110+
updateNextConfig(usesTs);
111111

112112
copyFile(
113113
join(getTemplatePath(ctx), "README.md"),

0 commit comments

Comments
 (0)