create-cloudflare 2.60.0 → 2.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cloudflare",
3
- "version": "2.60.0",
3
+ "version": "2.62.0",
4
4
  "description": "A CLI for creating and deploying new applications to Cloudflare.",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -30,7 +30,7 @@
30
30
  "@babel/parser": "^7.21.3",
31
31
  "@babel/types": "^7.21.4",
32
32
  "@clack/prompts": "^0.6.3",
33
- "@cloudflare/workers-types": "^4.20251213.0",
33
+ "@cloudflare/workers-types": "^4.20260103.0",
34
34
  "@types/command-exists": "^1.2.0",
35
35
  "@types/cross-spawn": "^6.0.2",
36
36
  "@types/deepmerge": "^2.2.0",
@@ -74,12 +74,13 @@
74
74
  "wrap-ansi": "^9.0.0",
75
75
  "xdg-app-paths": "^8.3.0",
76
76
  "yargs": "^17.7.2",
77
+ "@cloudflare/workers-utils": "0.6.0",
77
78
  "@cloudflare/cli": "1.2.0",
78
- "@cloudflare/workers-tsconfig": "0.0.0",
79
- "@cloudflare/vite-plugin": "1.18.0",
80
- "@cloudflare/mock-npm-registry": "0.0.0",
81
79
  "@cloudflare/eslint-config-shared": "1.1.0",
82
- "wrangler": "4.55.0"
80
+ "@cloudflare/mock-npm-registry": "0.0.0",
81
+ "@cloudflare/vite-plugin": "1.20.0",
82
+ "@cloudflare/workers-tsconfig": "0.0.0",
83
+ "wrangler": "4.57.0"
83
84
  },
84
85
  "engines": {
85
86
  "node": ">=18.14.1"
@@ -20,7 +20,7 @@ const configure = async (ctx: C3Context) => {
20
20
  usesTypescript(ctx);
21
21
  const filePath = `vite.config.${usesTypescript(ctx) ? "ts" : "js"}`;
22
22
 
23
- const compatDate = await getWorkerdCompatibilityDate();
23
+ const compatDate = getWorkerdCompatibilityDate(ctx.project.path);
24
24
 
25
25
  updateStatus(`Updating configuration in ${blue(filePath)}`);
26
26
 
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "workflows": [
11
11
  {
12
- "name": "workflows-hello-world",
12
+ "name": "workflow-<WORKER_NAME>",
13
13
  "binding": "MY_WORKFLOW",
14
14
  "class_name": "MyWorkflow",
15
15
  },
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "workflows": [
11
11
  {
12
- "name": "workflows-hello-world",
12
+ "name": "workflow-<WORKER_NAME>",
13
13
  "binding": "MY_WORKFLOW",
14
14
  "class_name": "MyWorkflow",
15
15
  },
@@ -17,7 +17,7 @@ const t = recast.types.namedTypes;
17
17
  const { npm } = detectPackageManager();
18
18
 
19
19
  const generate = async (ctx: C3Context) => {
20
- const variant = await getVariant();
20
+ const variant = await getVariant(ctx);
21
21
  ctx.args.lang = variant.lang;
22
22
 
23
23
  await runFrameworkGenerator(ctx, [
@@ -114,7 +114,7 @@ function updateTsconfigJson() {
114
114
  s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
115
115
  }
116
116
 
117
- async function getVariant() {
117
+ async function getVariant(ctx: C3Context) {
118
118
  const variantsOptions = [
119
119
  {
120
120
  value: "react-ts",
@@ -137,6 +137,20 @@ async function getVariant() {
137
137
  label: "JavaScript + SWC",
138
138
  },
139
139
  ];
140
+
141
+ // If variant is provided via CLI args, use it directly
142
+ if (ctx.args.variant) {
143
+ const selected = variantsOptions.find(
144
+ (variant) => variant.value === ctx.args.variant,
145
+ );
146
+ if (!selected) {
147
+ throw new Error(
148
+ `Unknown variant "${ctx.args.variant}". Valid variants are: ${variantsOptions.map((v) => v.value).join(", ")}`,
149
+ );
150
+ }
151
+ return selected;
152
+ }
153
+
140
154
  const value = await inputPrompt({
141
155
  type: "select",
142
156
  question: "Select a variant:",
@@ -1,8 +1,8 @@
1
1
  import { logRaw, updateStatus } from "@cloudflare/cli";
2
2
  import { blue } from "@cloudflare/cli/colors";
3
+ import { getLocalWorkerdCompatibilityDate } from "@cloudflare/workers-utils";
3
4
  import { runFrameworkGenerator } from "frameworks/index";
4
5
  import { mergeObjectProperties, transformFile } from "helpers/codemod";
5
- import { getWorkerdCompatibilityDate } from "helpers/compatDate";
6
6
  import { usesTypescript } from "helpers/files";
7
7
  import { detectPackageManager } from "helpers/packageManagers";
8
8
  import * as recast from "recast";
@@ -23,7 +23,9 @@ const configure = async (ctx: C3Context) => {
23
23
  usesTypescript(ctx);
24
24
  const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
25
25
 
26
- const compatDate = await getWorkerdCompatibilityDate();
26
+ const { date: compatDate } = getLocalWorkerdCompatibilityDate({
27
+ projectPath: ctx.project.path,
28
+ });
27
29
 
28
30
  updateStatus(`Updating configuration in ${blue(filePath)}`);
29
31
 
@@ -0,0 +1,30 @@
1
+ import { logRaw } from "@cloudflare/cli";
2
+ import { runFrameworkGenerator } from "frameworks/index";
3
+ import type { TemplateConfig } from "../../src/templates";
4
+ import type { C3Context } from "types";
5
+
6
+ const generate = async (ctx: C3Context) => {
7
+ await runFrameworkGenerator(ctx, [
8
+ ctx.project.name,
9
+ // Note: the vike create CLI supports a `--cloudflare` argument for creating cloudflare-ready
10
+ // projects, that works great but here we don't want to use that because we do want to
11
+ // exercise the general autoconfig/`wrangler setup` functionality (which amongst other
12
+ // things lets up ensure that we can support the migration of existing vike projects)
13
+ "--no-git",
14
+ ]);
15
+
16
+ logRaw(""); // newline
17
+ };
18
+
19
+ const config: TemplateConfig = {
20
+ configVersion: 1,
21
+ id: "vike",
22
+ platform: "workers",
23
+ frameworkCli: "create-vike",
24
+ displayName: "Vike",
25
+ generate,
26
+ devScript: "dev",
27
+ deployScript: "deploy",
28
+ previewScript: "preview",
29
+ };
30
+ export default config;
@@ -0,0 +1,30 @@
1
+ import { runFrameworkGenerator } from "frameworks/index";
2
+ import { detectPackageManager } from "helpers/packageManagers";
3
+ import type { TemplateConfig } from "../../src/templates";
4
+ import type { C3Context } from "types";
5
+
6
+ const { npm } = detectPackageManager();
7
+
8
+ const generate = async (ctx: C3Context) => {
9
+ await runFrameworkGenerator(ctx, [
10
+ "--project-name",
11
+ ctx.project.name,
12
+ // Note: we could point the waku create CLI to a cloudflare-ready template, that works great
13
+ // but here we don't want to use that because we do want to exercise the general
14
+ // autoconfig/`wrangler setup` functionality (which amongst other things lets up ensure
15
+ // that we can support the migration of existing waku projects)
16
+ ]);
17
+ };
18
+
19
+ const config: TemplateConfig = {
20
+ configVersion: 1,
21
+ id: "waku",
22
+ frameworkCli: "create-waku",
23
+ platform: "workers",
24
+ displayName: "Waku",
25
+ generate,
26
+ devScript: "dev",
27
+ deployScript: "deploy",
28
+ previewScript: "preview",
29
+ };
30
+ export default config;