create-cloudflare 0.0.0-4e69fb6f0 → 0.0.0-4e7345e13

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.
Files changed (127) hide show
  1. package/dist/cli.js +246 -209
  2. package/dist/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +8 -8
  4. package/templates/analog/c3.ts +0 -24
  5. package/templates/analog/templates/env.d.ts +1 -1
  6. package/templates/angular/pages/c3.ts +3 -3
  7. package/templates/angular/pages/templates/wrangler.jsonc +5 -0
  8. package/templates/angular/workers/c3.ts +1 -0
  9. package/templates/astro/workers/templates/js/wrangler.jsonc +2 -1
  10. package/templates/astro/workers/templates/ts/wrangler.jsonc +2 -1
  11. package/templates/common/ts/tsconfig.json +0 -3
  12. package/templates/docusaurus/pages/c3.ts +1 -0
  13. package/templates/docusaurus/workers/c3.ts +1 -0
  14. package/templates/gatsby/pages/c3.ts +1 -0
  15. package/templates/gatsby/workers/c3.ts +1 -0
  16. package/templates/hello-world/js/package.json +1 -1
  17. package/templates/hello-world/py/README.md +2 -2
  18. package/templates/hello-world/py/pyproject.toml +1 -1
  19. package/templates/hello-world/py/src/entry.py +3 -2
  20. package/templates/hello-world/ts/package.json +1 -1
  21. package/templates/hello-world/ts/test/index.spec.ts +0 -1
  22. package/templates/hello-world/ts/test/tsconfig.json +1 -1
  23. package/templates/hello-world/ts/tsconfig.json +0 -2
  24. package/templates/hello-world-assets-only/c3.ts +2 -2
  25. package/templates/hello-world-assets-only/templates/public/index.html +1 -0
  26. package/templates/hello-world-assets-only/templates/wrangler.jsonc +1 -0
  27. package/templates/hello-world-durable-object/c3.ts +3 -0
  28. package/templates/hello-world-durable-object/py/.python-version +1 -0
  29. package/templates/hello-world-durable-object/py/README.md +23 -0
  30. package/templates/hello-world-durable-object/py/__dot__gitignore +68 -0
  31. package/templates/hello-world-durable-object/py/package.json +13 -0
  32. package/templates/hello-world-durable-object/py/pyproject.toml +9 -0
  33. package/templates/hello-world-durable-object/py/src/entry.py +66 -0
  34. package/templates/hello-world-durable-object/py/uv.lock +22 -0
  35. package/templates/hello-world-durable-object/py/wrangler.jsonc +27 -0
  36. package/templates/hello-world-durable-object/ts/tsconfig.json +0 -2
  37. package/templates/hello-world-durable-object-with-assets/c3.ts +3 -0
  38. package/templates/hello-world-durable-object-with-assets/js/public/index.html +1 -0
  39. package/templates/hello-world-durable-object-with-assets/js/wrangler.jsonc +1 -1
  40. package/templates/hello-world-durable-object-with-assets/py/.python-version +1 -0
  41. package/templates/hello-world-durable-object-with-assets/py/README.md +23 -0
  42. package/templates/hello-world-durable-object-with-assets/py/__dot__gitignore +68 -0
  43. package/templates/hello-world-durable-object-with-assets/py/package.json +13 -0
  44. package/templates/hello-world-durable-object-with-assets/py/public/index.html +20 -0
  45. package/templates/hello-world-durable-object-with-assets/py/pyproject.toml +9 -0
  46. package/templates/hello-world-durable-object-with-assets/py/src/entry.py +66 -0
  47. package/templates/hello-world-durable-object-with-assets/py/uv.lock +22 -0
  48. package/templates/hello-world-durable-object-with-assets/py/wrangler.jsonc +31 -0
  49. package/templates/hello-world-durable-object-with-assets/ts/public/index.html +1 -0
  50. package/templates/hello-world-durable-object-with-assets/ts/tsconfig.json +0 -2
  51. package/templates/hello-world-durable-object-with-assets/ts/wrangler.jsonc +1 -1
  52. package/templates/hello-world-with-assets/c3.ts +3 -2
  53. package/templates/hello-world-with-assets/js/package.json +1 -1
  54. package/templates/hello-world-with-assets/js/public/index.html +1 -0
  55. package/templates/hello-world-with-assets/js/wrangler.jsonc +3 -2
  56. package/templates/hello-world-with-assets/py/.python-version +1 -0
  57. package/templates/hello-world-with-assets/py/README.md +23 -0
  58. package/templates/hello-world-with-assets/py/public/index.html +1 -0
  59. package/templates/hello-world-with-assets/py/pyproject.toml +9 -0
  60. package/templates/hello-world-with-assets/py/src/entry.py +9 -7
  61. package/templates/hello-world-with-assets/py/uv.lock +22 -0
  62. package/templates/hello-world-with-assets/py/wrangler.jsonc +1 -1
  63. package/templates/hello-world-with-assets/ts/package.json +1 -1
  64. package/templates/hello-world-with-assets/ts/public/index.html +1 -0
  65. package/templates/hello-world-with-assets/ts/test/tsconfig.json +1 -1
  66. package/templates/hello-world-with-assets/ts/tsconfig.json +0 -2
  67. package/templates/hello-world-with-assets/ts/wrangler.jsonc +2 -2
  68. package/templates/hono/pages/c3.ts +4 -1
  69. package/templates/hono/workers/c3.ts +3 -1
  70. package/templates/next/pages/c3.ts +6 -10
  71. package/templates/next/workers/c3.ts +8 -11
  72. package/templates/next/workers/templates/open-next.config.ts +5 -2
  73. package/templates/next/workers/templates/wrangler.jsonc +2 -1
  74. package/templates/nuxt/pages/c3.ts +2 -26
  75. package/templates/nuxt/pages/templates/env.d.ts +1 -1
  76. package/templates/nuxt/workers/c3.ts +2 -26
  77. package/templates/nuxt/workers/templates/env.d.ts +1 -1
  78. package/templates/openapi/ts/__dot__gitignore +1 -0
  79. package/templates/openapi/ts/package.json +7 -6
  80. package/templates/openapi/ts/src/endpoints/taskCreate.ts +2 -2
  81. package/templates/openapi/ts/src/endpoints/taskDelete.ts +2 -2
  82. package/templates/openapi/ts/src/endpoints/taskFetch.ts +2 -2
  83. package/templates/openapi/ts/src/endpoints/taskList.ts +2 -2
  84. package/templates/openapi/ts/src/index.ts +4 -1
  85. package/templates/openapi/ts/src/types.ts +3 -0
  86. package/templates/openapi/ts/tsconfig.json +18 -21
  87. package/templates/pre-existing/c3.ts +1 -1
  88. package/templates/queues/ts/tsconfig.json +0 -2
  89. package/templates/qwik/pages/c3.ts +1 -0
  90. package/templates/qwik/workers/c3.ts +3 -4
  91. package/templates/qwik/workers/templates/wrangler.jsonc +2 -1
  92. package/templates/react/pages/c3.ts +4 -2
  93. package/templates/react/pages/templates/wrangler.jsonc +5 -0
  94. package/templates/react/workers/c3.ts +1 -1
  95. package/templates/react/workers/ts/tsconfig.worker.json +2 -2
  96. package/templates/react-router/c3.ts +0 -12
  97. package/templates/remix/pages/c3.ts +1 -0
  98. package/templates/remix/pages/templates/worker-configuration.d.ts +1 -1
  99. package/templates/remix/workers/c3.ts +1 -0
  100. package/templates/remix/workers/templates/wrangler.toml +1 -1
  101. package/templates/scheduled/ts/tsconfig.json +0 -2
  102. package/templates/solid/c3.ts +1 -0
  103. package/templates/svelte/pages/c3.ts +3 -3
  104. package/templates/svelte/workers/c3.ts +3 -3
  105. package/templates/vue/pages/c3.ts +5 -3
  106. package/templates/vue/pages/templates/wrangler.jsonc +5 -0
  107. package/templates/vue/workers/ts/tsconfig.worker.json +1 -1
  108. package/templates-experimental/solid/c3.ts +1 -1
  109. package/templates/analog/templates/worker-configuration.d.ts +0 -4
  110. package/templates/astro/workers/templates/ts/worker-configuration.d.ts +0 -4
  111. package/templates/common/ts/worker-configuration.d.ts +0 -4
  112. package/templates/hello-world/ts/worker-configuration.d.ts +0 -8
  113. package/templates/hello-world-durable-object/ts/worker-configuration.d.ts +0 -7
  114. package/templates/hello-world-durable-object-with-assets/ts/worker-configuration.d.ts +0 -8
  115. package/templates/hello-world-with-assets/ts/worker-configuration.d.ts +0 -7
  116. package/templates/hono/pages/templates/worker-configuration.d.ts +0 -4
  117. package/templates/hono/workers/templates/worker-configuration.d.ts +0 -4
  118. package/templates/next/pages/env.d.ts +0 -5
  119. package/templates/next/workers/templates/cloudflare-env.d.ts +0 -5
  120. package/templates/nuxt/pages/templates/worker-configuration.d.ts +0 -4
  121. package/templates/nuxt/workers/templates/worker-configuration.d.ts +0 -4
  122. package/templates/openapi/ts/worker-configuration.d.ts +0 -4
  123. package/templates/queues/ts/worker-configuration.d.ts +0 -5
  124. package/templates/react/workers/ts/worker-configuration.d.ts +0 -5
  125. package/templates/react-router/templates/worker-configuration.d.ts +0 -8
  126. package/templates/scheduled/ts/worker-configuration.d.ts +0 -4
  127. package/templates/vue/workers/ts/worker-configuration.d.ts +0 -6
@@ -3,8 +3,7 @@ import { brandColor, dim } from "@cloudflare/cli/colors";
3
3
  import { spinner } from "@cloudflare/cli/interactive";
4
4
  import { runFrameworkGenerator } from "frameworks/index";
5
5
  import { mergeObjectProperties, transformFile } from "helpers/codemod";
6
- import { getLatestTypesEntrypoint } from "helpers/compatDate";
7
- import { readFile, writeFile } from "helpers/files";
6
+ import { writeFile } from "helpers/files";
8
7
  import { detectPackageManager } from "helpers/packageManagers";
9
8
  import { installPackages } from "helpers/packages";
10
9
  import * as recast from "recast";
@@ -30,7 +29,7 @@ const generate = async (ctx: C3Context) => {
30
29
  logRaw(""); // newline
31
30
  };
32
31
 
33
- const configure = async (ctx: C3Context) => {
32
+ const configure = async () => {
34
33
  const packages = ["nitro-cloudflare-dev"];
35
34
 
36
35
  // When using pnpm, explicitly add h3 package so the H3Event type declaration can be updated.
@@ -45,29 +44,6 @@ const configure = async (ctx: C3Context) => {
45
44
  doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`,
46
45
  });
47
46
  updateNuxtConfig();
48
-
49
- updateEnvTypes(ctx);
50
- };
51
-
52
- const updateEnvTypes = (ctx: C3Context) => {
53
- const filepath = "env.d.ts";
54
-
55
- const s = spinner();
56
- s.start(`Updating ${filepath}`);
57
-
58
- let file = readFile(filepath);
59
-
60
- let typesEntrypoint = `@cloudflare/workers-types`;
61
- const latestEntrypoint = getLatestTypesEntrypoint(ctx);
62
- if (latestEntrypoint) {
63
- typesEntrypoint += `/${latestEntrypoint}`;
64
- }
65
-
66
- // Replace placeholder with actual types entrypoint
67
- file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
68
- writeFile("env.d.ts", file);
69
-
70
- s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
71
47
  };
72
48
 
73
49
  const updateNuxtConfig = () => {
@@ -1,4 +1,4 @@
1
- /// <reference types="WORKERS_TYPES_ENTRYPOINT" />
1
+ /// <reference types="./worker-configuration.d.ts" />
2
2
 
3
3
  declare module "h3" {
4
4
  interface H3EventContext {
@@ -3,8 +3,7 @@ import { brandColor, dim } from "@cloudflare/cli/colors";
3
3
  import { spinner } from "@cloudflare/cli/interactive";
4
4
  import { runFrameworkGenerator } from "frameworks/index";
5
5
  import { mergeObjectProperties, transformFile } from "helpers/codemod";
6
- import { getLatestTypesEntrypoint } from "helpers/compatDate";
7
- import { readFile, writeFile } from "helpers/files";
6
+ import { writeFile } from "helpers/files";
8
7
  import { detectPackageManager } from "helpers/packageManagers";
9
8
  import { installPackages } from "helpers/packages";
10
9
  import * as recast from "recast";
@@ -30,7 +29,7 @@ const generate = async (ctx: C3Context) => {
30
29
  logRaw(""); // newline
31
30
  };
32
31
 
33
- const configure = async (ctx: C3Context) => {
32
+ const configure = async () => {
34
33
  const packages = ["nitro-cloudflare-dev", "nitropack"];
35
34
 
36
35
  // When using pnpm, explicitly add h3 package so the H3Event type declaration can be updated.
@@ -45,29 +44,6 @@ const configure = async (ctx: C3Context) => {
45
44
  doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`,
46
45
  });
47
46
  updateNuxtConfig();
48
-
49
- updateEnvTypes(ctx);
50
- };
51
-
52
- const updateEnvTypes = (ctx: C3Context) => {
53
- const filepath = "env.d.ts";
54
-
55
- const s = spinner();
56
- s.start(`Updating ${filepath}`);
57
-
58
- let file = readFile(filepath);
59
-
60
- let typesEntrypoint = `@cloudflare/workers-types`;
61
- const latestEntrypoint = getLatestTypesEntrypoint(ctx);
62
- if (latestEntrypoint) {
63
- typesEntrypoint += `/${latestEntrypoint}`;
64
- }
65
-
66
- // Replace placeholder with actual types entrypoint
67
- file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
68
- writeFile("env.d.ts", file);
69
-
70
- s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
71
47
  };
72
48
 
73
49
  const updateNuxtConfig = () => {
@@ -1,4 +1,4 @@
1
- /// <reference types="WORKERS_TYPES_ENTRYPOINT" />
1
+ /// <reference types="./worker-configuration.d.ts" />
2
2
 
3
3
  declare module "h3" {
4
4
  interface H3EventContext {
@@ -169,3 +169,4 @@ dist
169
169
  # wrangler project
170
170
 
171
171
  .dev.vars
172
+ .wrangler/
@@ -9,13 +9,14 @@
9
9
  "cf-typegen": "wrangler types"
10
10
  },
11
11
  "dependencies": {
12
- "chanfana": "^2.0.2",
13
- "zod": "^3.23.8",
14
- "hono": "^4.4.7"
12
+ "chanfana": "^2.6.3",
13
+ "hono": "^4.6.20",
14
+ "zod": "^3.24.1"
15
15
  },
16
16
  "devDependencies": {
17
- "@types/node": "20.8.3",
18
- "@types/service-worker-mock": "^2.0.1",
19
- "wrangler": "^3.101.0"
17
+ "@cloudflare/workers-types": "^4.20250129.0",
18
+ "@types/node": "22.13.0",
19
+ "@types/service-worker-mock": "^2.0.4",
20
+ "wrangler": "^3.107.2"
20
21
  }
21
22
  }
@@ -1,6 +1,6 @@
1
1
  import { Bool, OpenAPIRoute } from "chanfana";
2
2
  import { z } from "zod";
3
- import { Task } from "../types";
3
+ import { type AppContext, Task } from "../types";
4
4
 
5
5
  export class TaskCreate extends OpenAPIRoute {
6
6
  schema = {
@@ -34,7 +34,7 @@ export class TaskCreate extends OpenAPIRoute {
34
34
  },
35
35
  };
36
36
 
37
- async handle(c) {
37
+ async handle(c: AppContext) {
38
38
  // Get validated data
39
39
  const data = await this.getValidatedData<typeof this.schema>();
40
40
 
@@ -1,6 +1,6 @@
1
1
  import { Bool, OpenAPIRoute, Str } from "chanfana";
2
2
  import { z } from "zod";
3
- import { Task } from "../types";
3
+ import { type AppContext, Task } from "../types";
4
4
 
5
5
  export class TaskDelete extends OpenAPIRoute {
6
6
  schema = {
@@ -30,7 +30,7 @@ export class TaskDelete extends OpenAPIRoute {
30
30
  },
31
31
  };
32
32
 
33
- async handle(c) {
33
+ async handle(c: AppContext) {
34
34
  // Get validated data
35
35
  const data = await this.getValidatedData<typeof this.schema>();
36
36
 
@@ -1,6 +1,6 @@
1
1
  import { Bool, OpenAPIRoute, Str } from "chanfana";
2
2
  import { z } from "zod";
3
- import { Task } from "../types";
3
+ import { type AppContext, Task } from "../types";
4
4
 
5
5
  export class TaskFetch extends OpenAPIRoute {
6
6
  schema = {
@@ -43,7 +43,7 @@ export class TaskFetch extends OpenAPIRoute {
43
43
  },
44
44
  };
45
45
 
46
- async handle(c) {
46
+ async handle(c: AppContext) {
47
47
  // Get validated data
48
48
  const data = await this.getValidatedData<typeof this.schema>();
49
49
 
@@ -1,6 +1,6 @@
1
1
  import { Bool, Num, OpenAPIRoute } from "chanfana";
2
2
  import { z } from "zod";
3
- import { Task } from "../types";
3
+ import { type AppContext, Task } from "../types";
4
4
 
5
5
  export class TaskList extends OpenAPIRoute {
6
6
  schema = {
@@ -37,7 +37,7 @@ export class TaskList extends OpenAPIRoute {
37
37
  },
38
38
  };
39
39
 
40
- async handle(c) {
40
+ async handle(c: AppContext) {
41
41
  // Get validated data
42
42
  const data = await this.getValidatedData<typeof this.schema>();
43
43
 
@@ -6,7 +6,7 @@ import { TaskFetch } from "./endpoints/taskFetch";
6
6
  import { TaskList } from "./endpoints/taskList";
7
7
 
8
8
  // Start a Hono app
9
- const app = new Hono();
9
+ const app = new Hono<{ Bindings: Env }>();
10
10
 
11
11
  // Setup OpenAPI registry
12
12
  const openapi = fromHono(app, {
@@ -19,5 +19,8 @@ openapi.post("/api/tasks", TaskCreate);
19
19
  openapi.get("/api/tasks/:taskSlug", TaskFetch);
20
20
  openapi.delete("/api/tasks/:taskSlug", TaskDelete);
21
21
 
22
+ // You may also register routes for non OpenAPI directly on Hono
23
+ // app.get('/test', (c) => c.text('Hono!'))
24
+
22
25
  // Export the Hono app
23
26
  export default app;
@@ -1,6 +1,9 @@
1
1
  import { DateTime, Str } from "chanfana";
2
+ import type { Context } from "hono";
2
3
  import { z } from "zod";
3
4
 
5
+ export type AppContext = Context<{ Bindings: Env }>;
6
+
4
7
  export const Task = z.object({
5
8
  name: Str({ example: "lorem" }),
6
9
  slug: Str(),
@@ -1,32 +1,29 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "allowJs": true,
4
- "allowSyntheticDefaultImports": true,
5
- "baseUrl": "src",
6
- "declaration": true,
7
- "sourceMap": true,
3
+ /* Base Options: */
8
4
  "esModuleInterop": true,
9
- "inlineSourceMap": false,
10
- "lib": ["esnext"],
11
- "listEmittedFiles": false,
12
- "listFiles": false,
13
- "moduleResolution": "node",
14
- "noFallthroughCasesInSwitch": true,
15
- "pretty": true,
16
- "resolveJsonModule": true,
17
- "rootDir": ".",
18
5
  "skipLibCheck": true,
19
- "strict": false,
20
- "traceResolution": false,
21
- "outDir": "",
22
- "target": "esnext",
23
- "module": "esnext",
6
+ "target": "es2022",
7
+ "verbatimModuleSyntax": false,
8
+ "allowJs": true,
9
+ "resolveJsonModule": true,
10
+ "moduleDetection": "force",
11
+ /* Strictness */
12
+ "noImplicitAny": false,
13
+ "noImplicitThis": true,
14
+ "strictNullChecks": false,
15
+ "strict": true,
16
+ "noUncheckedIndexedAccess": true,
17
+ /* If NOT transpiling with TypeScript: */
18
+ "moduleResolution": "Bundler",
19
+ "module": "es2022",
20
+ "noEmit": true,
21
+ "lib": ["es2022"],
24
22
  "types": [
25
23
  "@types/node",
26
24
  "@types/service-worker-mock",
27
- "@cloudflare/workers-types"
28
25
  ]
29
26
  },
30
27
  "exclude": ["node_modules", "dist", "tests"],
31
- "include": ["src", "scripts"]
28
+ "include": ["src", "worker-configuration.d.ts"]
32
29
  }
@@ -32,7 +32,7 @@ export async function copyExistingWorkerFiles(ctx: C3Context) {
32
32
  await runCommand(
33
33
  [
34
34
  ...dlx,
35
- "wrangler@3",
35
+ "wrangler@latest",
36
36
  "init",
37
37
  "--from-dash",
38
38
  ctx.args.existingScript,
@@ -13,8 +13,6 @@
13
13
  "module": "es2022",
14
14
  /* Specify how TypeScript looks up a file from a given module specifier. */
15
15
  "moduleResolution": "node",
16
- /* Specify type package names to be included without being referenced in a source file. */
17
- "types": ["@cloudflare/workers-types"],
18
16
  /* Enable importing .json files */
19
17
  "resolveJsonModule": true,
20
18
 
@@ -146,5 +146,6 @@ const config: TemplateConfig = {
146
146
  devScript: "dev",
147
147
  deployScript: "deploy",
148
148
  previewScript: "preview",
149
+ workersTypes: "installed",
149
150
  };
150
151
  export default config;
@@ -1,4 +1,4 @@
1
- import { crash, endSection } from "@cloudflare/cli";
1
+ import { endSection } from "@cloudflare/cli";
2
2
  import { brandColor } from "@cloudflare/cli/colors";
3
3
  import { spinner } from "@cloudflare/cli/interactive";
4
4
  import { runFrameworkGenerator } from "frameworks/index";
@@ -24,8 +24,6 @@ const configure = async (ctx: C3Context) => {
24
24
  await runCommand(cmd);
25
25
 
26
26
  // Remove the extraneous Pages files
27
- removeFile("./public/_headers");
28
- removeFile("./public/_redirects");
29
27
  removeFile("./public/_routes.json");
30
28
 
31
29
  addBindingsProxy(ctx);
@@ -81,7 +79,7 @@ const addBindingsProxy = (ctx: C3Context) => {
81
79
  }
82
80
 
83
81
  if (configArgument.type !== "ObjectExpression") {
84
- crash("Failed to update `vite.config.ts`");
82
+ throw new Error("Failed to update `vite.config.ts`");
85
83
  }
86
84
 
87
85
  // Add the `platform` object to the object
@@ -150,5 +148,6 @@ const config: TemplateConfig = {
150
148
  devScript: "dev",
151
149
  deployScript: "deploy",
152
150
  previewScript: "preview",
151
+ workersTypes: "installed",
153
152
  };
154
153
  export default config;
@@ -3,7 +3,8 @@
3
3
  "main": "./dist/_worker.js",
4
4
  "compatibility_date": "<TBD>",
5
5
  "compatibility_flags": [
6
- "nodejs_compat"
6
+ "nodejs_compat",
7
+ "global_fetch_strictly_public"
7
8
  ],
8
9
  "assets": {
9
10
  "binding": "ASSET",
@@ -49,11 +49,13 @@ const config: TemplateConfig = {
49
49
  platform: "pages",
50
50
  hidden: true,
51
51
  path: "templates/react/pages",
52
+ copyFiles: { path: "./templates" },
52
53
  generate,
53
54
  transformPackageJson: async () => ({
54
55
  scripts: {
55
- deploy: `${npm} run build && wrangler pages deploy ./dist`,
56
- preview: `${npm} run build && wrangler pages dev ./dist`,
56
+ deploy: `${npm} run build && wrangler pages deploy`,
57
+ preview: `${npm} run build && wrangler pages dev`,
58
+ "cf-typegen": `wrangler types`,
57
59
  },
58
60
  }),
59
61
  devScript: "dev",
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "<TBD>",
3
+ "compatibility_date": "<TBD>",
4
+ "pages_build_output_dir": "./dist"
5
+ }
@@ -36,7 +36,7 @@ const configure = async (ctx: C3Context) => {
36
36
  doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`,
37
37
  });
38
38
 
39
- await transformViteConfig(ctx);
39
+ transformViteConfig(ctx);
40
40
 
41
41
  if (usesTypescript(ctx)) {
42
42
  updateTsconfigJson();
@@ -2,7 +2,7 @@
2
2
  "extends": "./tsconfig.node.json",
3
3
  "compilerOptions": {
4
4
  "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.worker.tsbuildinfo",
5
- "types": ["@cloudflare/workers-types/2023-07-01", "./worker-configuration.d.ts", "vite/client"],
5
+ "types": ["./worker-configuration.d.ts", "vite/client"],
6
6
  },
7
- "include": ["worker"],
7
+ "include": ["./worker-configuration.d.ts", "./worker"]
8
8
  }
@@ -19,24 +19,12 @@ const generate = async (ctx: C3Context) => {
19
19
  logRaw(""); // newline
20
20
  };
21
21
 
22
- // TODO: Uncomment this once @react-router/dev updates its peer dependency to Wrangler v4
23
- // const configure = async () => {
24
- // await installPackages(["wrangler@latest"], {
25
- // dev: true,
26
- // startText: "Updating the Wrangler version",
27
- // doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`,
28
- // });
29
- // };
30
-
31
22
  const config: TemplateConfig = {
32
23
  configVersion: 1,
33
24
  id: "react-router",
34
25
  platform: "workers",
35
26
  frameworkCli: "create-react-router",
36
27
  displayName: "React Router (formerly Remix)",
37
- copyFiles: {
38
- path: "./templates",
39
- },
40
28
  generate,
41
29
  // configure,
42
30
  transformPackageJson: async () => ({
@@ -65,5 +65,6 @@ const config: TemplateConfig = {
65
65
  devScript: "dev",
66
66
  deployScript: "deploy",
67
67
  previewScript: "preview",
68
+ workersTypes: "installed",
68
69
  };
69
70
  export default config;
@@ -1,4 +1,4 @@
1
1
  // Generated by Wrangler
2
- // After adding bindings to `wrangler.jsonc`, regenerate this interface via `npm run cf-typegen`
2
+ // After adding bindings to `wrangler.toml`, regenerate this interface via `npm run cf-typegen`
3
3
  interface Env {
4
4
  }
@@ -48,5 +48,6 @@ const config: TemplateConfig = {
48
48
  devScript: "dev",
49
49
  deployScript: "deploy",
50
50
  previewScript: "preview",
51
+ workersTypes: "installed",
51
52
  };
52
53
  export default config;
@@ -8,4 +8,4 @@ assets = { directory = "./build/client" }
8
8
  # Docs: https://developers.cloudflare.com/workers/observability/logs/workers-logs/
9
9
  # Configuration: https://developers.cloudflare.com/workers/observability/logs/workers-logs/#enable-workers-logs
10
10
  [observability]
11
- enabled = true
11
+ enabled = true
@@ -13,8 +13,6 @@
13
13
  "module": "es2022",
14
14
  /* Specify how TypeScript looks up a file from a given module specifier. */
15
15
  "moduleResolution": "node",
16
- /* Specify type package names to be included without being referenced in a source file. */
17
- "types": ["@cloudflare/workers-types"],
18
16
  /* Enable importing .json files */
19
17
  "resolveJsonModule": true,
20
18
 
@@ -77,6 +77,7 @@ const config: TemplateConfig = {
77
77
  scripts: {
78
78
  preview: `${npm} run build && npx wrangler pages dev`,
79
79
  deploy: `${npm} run build && wrangler pages deploy`,
80
+ "cf-typegen": `wrangler types`,
80
81
  },
81
82
  }),
82
83
  compatibilityFlags: ["nodejs_compat"],
@@ -1,5 +1,4 @@
1
1
  import { existsSync } from "node:fs";
2
- import { platform } from "node:os";
3
2
  import { logRaw, updateStatus } from "@cloudflare/cli";
4
3
  import { blue, brandColor, dim } from "@cloudflare/cli/colors";
5
4
  import { runFrameworkGenerator } from "frameworks/index";
@@ -124,6 +123,7 @@ const updateTypeDefinitions = (ctx: C3Context) => {
124
123
  });
125
124
  };
126
125
 
126
+ const typesPath = "src/worker-configuration.d.ts";
127
127
  const config: TemplateConfig = {
128
128
  configVersion: 1,
129
129
  id: "svelte",
@@ -144,10 +144,9 @@ const config: TemplateConfig = {
144
144
  };
145
145
 
146
146
  if (usesTypescript(ctx)) {
147
- const mv = platform() === "win32" ? "move" : "mv";
148
147
  scripts = {
149
148
  ...scripts,
150
- "cf-typegen": `wrangler types && ${mv} worker-configuration.d.ts src/`,
149
+ "cf-typegen": `wrangler types ${typesPath}`,
151
150
  };
152
151
  }
153
152
 
@@ -156,5 +155,6 @@ const config: TemplateConfig = {
156
155
  devScript: "dev",
157
156
  deployScript: "deploy",
158
157
  previewScript: "preview",
158
+ typesPath,
159
159
  };
160
160
  export default config;
@@ -1,4 +1,3 @@
1
- import { platform } from "node:os";
2
1
  import { logRaw, updateStatus } from "@cloudflare/cli";
3
2
  import { blue, brandColor, dim } from "@cloudflare/cli/colors";
4
3
  import { runFrameworkGenerator } from "frameworks/index";
@@ -94,6 +93,7 @@ const updateTypeDefinitions = (ctx: C3Context) => {
94
93
  });
95
94
  };
96
95
 
96
+ const typesPath = "./src/worker-configuration.d.ts";
97
97
  const config: TemplateConfig = {
98
98
  configVersion: 1,
99
99
  id: "svelte",
@@ -113,10 +113,9 @@ const config: TemplateConfig = {
113
113
  };
114
114
 
115
115
  if (usesTypescript(ctx)) {
116
- const mv = platform() === "win32" ? "move" : "mv";
117
116
  scripts = {
118
117
  ...scripts,
119
- "cf-typegen": `wrangler types && ${mv} worker-configuration.d.ts src/`,
118
+ "cf-typegen": `wrangler types ${typesPath}`,
120
119
  };
121
120
  }
122
121
 
@@ -125,5 +124,6 @@ const config: TemplateConfig = {
125
124
  devScript: "dev",
126
125
  deployScript: "deploy",
127
126
  previewScript: "preview",
127
+ typesPath,
128
128
  };
129
129
  export default config;
@@ -16,12 +16,14 @@ const config: TemplateConfig = {
16
16
  displayName: "Vue",
17
17
  platform: "pages",
18
18
  hidden: true,
19
- path: "templates/pages/vue",
19
+ path: "templates/vue/pages",
20
+ copyFiles: { path: "./templates" },
20
21
  generate,
21
22
  transformPackageJson: async () => ({
22
23
  scripts: {
23
- deploy: `${npm} run build && wrangler pages deploy ./dist`,
24
- preview: `${npm} run build && wrangler pages dev ./dist`,
24
+ deploy: `${npm} run build && wrangler pages deploy`,
25
+ preview: `${npm} run build && wrangler pages dev`,
26
+ "cf-typegen": `wrangler types`,
25
27
  },
26
28
  }),
27
29
  devScript: "dev",
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "<TBD>",
3
+ "compatibility_date": "<TBD>",
4
+ "pages_build_output_dir": "./dist"
5
+ }
@@ -2,7 +2,7 @@
2
2
  "extends": "./tsconfig.node.json",
3
3
  "compilerOptions": {
4
4
  "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.worker.tsbuildinfo",
5
- "types": ["@cloudflare/workers-types/2023-07-01", "./worker-configuration.d.ts","vite/client"],
5
+ "types": [ "./worker-configuration.d.ts","vite/client"],
6
6
  },
7
7
  "include": ["server"],
8
8
  }
@@ -84,9 +84,9 @@ const config: TemplateConfig = {
84
84
  scripts: {
85
85
  preview: `${npm} run build && npx wrangler dev`,
86
86
  deploy: `${npm} run build && wrangler deploy`,
87
+ "cf-typegen": `wrangler types`,
87
88
  },
88
89
  }),
89
- compatibilityFlags: ["nodejs_compat"],
90
90
  devScript: "dev",
91
91
  deployScript: "deploy",
92
92
  previewScript: "preview",
@@ -1,4 +0,0 @@
1
- // Generated by Wrangler
2
- // After adding bindings to `wrangler.jsonc`, regenerate this interface via `npm run cf-typegen`
3
- interface Env {
4
- }
@@ -1,4 +0,0 @@
1
- // Generated by Wrangler
2
- // After adding bindings to `wrangler.jsonc`, regenerate this interface via `npm run cf-typegen`
3
- interface Env {
4
- }
@@ -1,4 +0,0 @@
1
- // Generated by Wrangler
2
- // After adding bindings to `wrangler.jsonc`, regenerate this interface via `npm run cf-typegen`
3
- interface Env {
4
- }
@@ -1,8 +0,0 @@
1
- // Generated by Wrangler by running `wrangler types --include-runtime=false` (hash: 2905fd8e181cd2f4083a615fa51f1913)
2
- // After adding bindings to `wrangler.jsonc`, regenerate this interface via `npm run cf-typegen`
3
- declare namespace Cloudflare {
4
- // eslint-disable-next-line @typescript-eslint/no-empty-interface,@typescript-eslint/no-empty-object-type
5
- interface Env {
6
- }
7
- }
8
- interface Env extends Cloudflare.Env {}
@@ -1,7 +0,0 @@
1
- // Generated by Wrangler by running `wrangler types --include-runtime=false` (hash: 4c81d17e8de07f650cddf73ce751ba8d)
2
- declare namespace Cloudflare {
3
- interface Env {
4
- MY_DURABLE_OBJECT: DurableObjectNamespace<import("./src/index").MyDurableObject>;
5
- }
6
- }
7
- interface Env extends Cloudflare.Env {}
@@ -1,8 +0,0 @@
1
- // Generated by Wrangler by running `wrangler types --include-runtime=false` (hash: 24be54e90498ce3774054fcb8bb2bc1a)
2
- declare namespace Cloudflare {
3
- interface Env {
4
- MY_DURABLE_OBJECT: DurableObjectNamespace<import("./src/index").MyDurableObject>;
5
- ASSETS: Fetcher;
6
- }
7
- }
8
- interface Env extends Cloudflare.Env {}
@@ -1,7 +0,0 @@
1
- // Generated by Wrangler by running `wrangler types --include-runtime=false` (hash: 187132f48ddf0f604882ba8213fe386f)
2
- declare namespace Cloudflare {
3
- interface Env {
4
- ASSETS: Fetcher;
5
- }
6
- }
7
- interface Env extends Cloudflare.Env {}