Skip to content

Commit

Permalink
make the Next.js experimental template use a specific version of the …
Browse files Browse the repository at this point in the history
…create-next-app cli
  • Loading branch information
dario-piotrowicz committed Dec 11, 2024
1 parent 074f2a0 commit 0fbfbda
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 3 additions & 1 deletion packages/create-cloudflare/src/frameworks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export const getFrameworkCli = (ctx: C3Context, withVersion = true) => {

const frameworkCli = ctx.template
.frameworkCli as keyof typeof frameworksPackageJson.dependencies;
const version = frameworksPackageJson.dependencies[frameworkCli];
const version =
ctx.template.frameworkCliVersion ??
frameworksPackageJson.dependencies[frameworkCli];
return withVersion ? `${frameworkCli}@${version}` : frameworkCli;
};

Expand Down
13 changes: 9 additions & 4 deletions packages/create-cloudflare/src/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,21 @@ export type TemplateConfig = {
* to handle config version skew between different versions of c3
*/
configVersion: number;
/** The id by which template is referred to internally and keyed in lookup maps*/
/** The id by which template is referred to internally and keyed in lookup maps */
id: string;
/** A string that controls how the template is presented to the user in the selection menu*/
/** A string that controls how the template is presented to the user in the selection menu */
displayName: string;
/** A string that explains what is inside the template, including any resources and how those will be used*/
/** A string that explains what is inside the template, including any resources and how those will be used */
description?: string;
/** The deployment platform for this template */
platform: "workers" | "pages";
/** The name of the framework cli tool that is used to generate this project or undefined if none. */
/** The name of the framework cli tool that is used to generate this project or undefined if none */
frameworkCli?: string;
/**
* The version of the framework cli tool to use.
* If omitted the cli version is taken from src/frameworks/package.json, which is the default/standard behavior.
*/
frameworkCliVersion?: string;
/** When set to true, hides this template from the selection menu */
hidden?: boolean;
/** Specifies a set of files that will be copied to the project directory during creation.
Expand Down
4 changes: 4 additions & 0 deletions packages/create-cloudflare/templates-experimental/next/c3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export default {
configVersion: 1,
id: "next",
frameworkCli: "create-next-app",
// TODO: here we need to specify a version of create-next-app which is different from the
// standard one used in the stable Next.js template, that's because our open-next adapter
// is not yet fully ready for Next.js 15, once it is we should remove the following
frameworkCliVersion: "14.2.5",
platform: "workers",
displayName: "Next (using Node.js compat + Workers Assets)",
path: "templates-experimental/next",
Expand Down

0 comments on commit 0fbfbda

Please sign in to comment.