create-cloudflare 2.58.0 → 2.59.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.
Files changed (86) hide show
  1. package/dist/cli.js +360 -396
  2. package/package.json +6 -6
  3. package/templates/analog/c3.ts +39 -61
  4. package/templates/analog/templates/wrangler.jsonc +10 -3
  5. package/templates/angular/pages/templates/wrangler.jsonc +2 -2
  6. package/templates/angular/workers/templates/wrangler.jsonc +2 -2
  7. package/templates/astro/pages/templates/js/wrangler.jsonc +2 -2
  8. package/templates/astro/pages/templates/ts/wrangler.jsonc +2 -2
  9. package/templates/astro/workers/templates/js/wrangler.jsonc +2 -2
  10. package/templates/astro/workers/templates/ts/wrangler.jsonc +2 -2
  11. package/templates/common/js/package.json +1 -1
  12. package/templates/common/js/wrangler.jsonc +2 -2
  13. package/templates/common/ts/package.json +1 -1
  14. package/templates/common/ts/wrangler.jsonc +2 -2
  15. package/templates/docusaurus/workers/templates/wrangler.jsonc +2 -2
  16. package/templates/gatsby/workers/templates/wrangler.jsonc +2 -2
  17. package/templates/hello-world/c3.ts +0 -12
  18. package/templates/hello-world/js/package.json +1 -1
  19. package/templates/hello-world/js/wrangler.jsonc +2 -2
  20. package/templates/hello-world/py/package.json +1 -1
  21. package/templates/hello-world/py/pyproject.toml +1 -1
  22. package/templates/hello-world/py/wrangler.jsonc +2 -2
  23. package/templates/hello-world/ts/package.json +1 -1
  24. package/templates/hello-world/ts/wrangler.jsonc +2 -2
  25. package/templates/hello-world-assets-only/templates/package.json +1 -1
  26. package/templates/hello-world-assets-only/templates/wrangler.jsonc +2 -2
  27. package/templates/hello-world-durable-object/js/package.json +1 -1
  28. package/templates/hello-world-durable-object/js/wrangler.jsonc +2 -2
  29. package/templates/hello-world-durable-object/py/package.json +1 -1
  30. package/templates/hello-world-durable-object/py/pyproject.toml +1 -1
  31. package/templates/hello-world-durable-object/py/wrangler.jsonc +2 -2
  32. package/templates/hello-world-durable-object/ts/package.json +1 -1
  33. package/templates/hello-world-durable-object/ts/wrangler.jsonc +2 -2
  34. package/templates/hello-world-durable-object-with-assets/js/package.json +1 -1
  35. package/templates/hello-world-durable-object-with-assets/js/wrangler.jsonc +2 -2
  36. package/templates/hello-world-durable-object-with-assets/py/package.json +1 -1
  37. package/templates/hello-world-durable-object-with-assets/py/pyproject.toml +1 -1
  38. package/templates/hello-world-durable-object-with-assets/py/wrangler.jsonc +2 -2
  39. package/templates/hello-world-durable-object-with-assets/ts/package.json +1 -1
  40. package/templates/hello-world-durable-object-with-assets/ts/wrangler.jsonc +2 -2
  41. package/templates/hello-world-with-assets/js/package.json +1 -1
  42. package/templates/hello-world-with-assets/js/wrangler.jsonc +2 -2
  43. package/templates/hello-world-with-assets/py/package.json +1 -1
  44. package/templates/hello-world-with-assets/py/pyproject.toml +1 -1
  45. package/templates/hello-world-with-assets/py/wrangler.jsonc +2 -2
  46. package/templates/hello-world-with-assets/ts/package.json +1 -1
  47. package/templates/hello-world-with-assets/ts/wrangler.jsonc +2 -2
  48. package/templates/hello-world-workflows/js/package.json +1 -1
  49. package/templates/hello-world-workflows/js/wrangler.jsonc +2 -2
  50. package/templates/hello-world-workflows/ts/package.json +1 -1
  51. package/templates/hello-world-workflows/ts/wrangler.jsonc +2 -2
  52. package/templates/hono/pages/templates/wrangler.jsonc +2 -2
  53. package/templates/hono/workers/templates/wrangler.jsonc +2 -2
  54. package/templates/next/c3.ts +9 -22
  55. package/templates/nuxt/pages/templates/wrangler.jsonc +2 -2
  56. package/templates/nuxt/workers/templates/wrangler.jsonc +2 -2
  57. package/templates/openapi/ts/wrangler.jsonc +2 -2
  58. package/templates/pre-existing/js/package.json +1 -1
  59. package/templates/queues/js/package.json +1 -1
  60. package/templates/queues/js/wrangler.jsonc +2 -2
  61. package/templates/queues/ts/package.json +1 -1
  62. package/templates/queues/ts/wrangler.jsonc +2 -2
  63. package/templates/qwik/pages/templates/wrangler.jsonc +2 -2
  64. package/templates/qwik/workers/templates/wrangler.jsonc +2 -2
  65. package/templates/react/pages/templates/wrangler.jsonc +2 -2
  66. package/templates/react/workers/js/wrangler.jsonc +2 -2
  67. package/templates/react/workers/ts/wrangler.jsonc +2 -2
  68. package/templates/scheduled/js/package.json +1 -1
  69. package/templates/scheduled/js/wrangler.jsonc +2 -2
  70. package/templates/scheduled/ts/package.json +2 -2
  71. package/templates/scheduled/ts/wrangler.jsonc +2 -2
  72. package/templates/solid/templates/wrangler.jsonc +2 -2
  73. package/templates/svelte/pages/templates/wrangler.jsonc +2 -2
  74. package/templates/svelte/workers/templates/wrangler.jsonc +2 -2
  75. package/templates/vue/pages/templates/wrangler.jsonc +2 -2
  76. package/templates/vue/workers/js/wrangler.jsonc +2 -2
  77. package/templates/vue/workers/ts/wrangler.jsonc +2 -2
  78. package/templates/waku/wrangler.jsonc +2 -2
  79. package/templates/analog/snippets/devBindingsModule.ts +0 -7
  80. package/templates/analog/templates/env.d.ts +0 -13
  81. package/templates/analog/templates/src/dev-bindings.ts +0 -18
  82. package/templates/next/templates/.dev.vars +0 -2
  83. package/templates/next/templates/__dot__gitignore +0 -39
  84. package/templates/next/templates/open-next.config.ts +0 -9
  85. package/templates/next/templates/public/_headers +0 -3
  86. package/templates/next/templates/wrangler.jsonc +0 -13
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
3
  "main": "src/index.js",
4
- "compatibility_date": "<TBD>",
4
+ "compatibility_date": "<COMPATIBILITY_DATE>",
5
5
 
6
6
  "observability": {
7
7
  "enabled": true,
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<PACKAGE_NAME>",
3
3
  "version": "0.0.0",
4
4
  "private": true,
5
5
  "scripts": {
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
3
  "main": "src/index.ts",
4
- "compatibility_date": "<TBD>",
4
+ "compatibility_date": "<COMPATIBILITY_DATE>",
5
5
 
6
6
  "observability": {
7
7
  "enabled": true,
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "<TBD>",
3
- "compatibility_date": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
+ "compatibility_date": "<COMPATIBILITY_DATE>",
4
4
  "pages_build_output_dir": "./dist",
5
5
  "observability": {
6
6
  "enabled": true
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
3
  "main": "src/index.ts",
4
- "compatibility_date": "<TBD>",
4
+ "compatibility_date": "<COMPATIBILITY_DATE>",
5
5
  "assets": {
6
6
  "binding": "ASSETS",
7
7
  "directory": "./public"
@@ -1,19 +1,16 @@
1
- import { runFrameworkGenerator } from "frameworks/index";
1
+ import { downloadRemoteTemplate, updatePackageName } from "../../src/templates";
2
2
  import type { TemplateConfig } from "../../src/templates";
3
3
  import type { C3Context } from "types";
4
4
 
5
5
  const generate = async (ctx: C3Context) => {
6
- // Disable Turbopack as it is not currently compatible with the Cloudflare adapter
7
- await runFrameworkGenerator(ctx, [
8
- ctx.project.name,
9
- "--no-turbopack",
10
- "--skip-install",
11
- // We are using the Cloudflare template for Next.js projects
12
- // This is a template maintained by Cloudflare that based on a standard Next.js starter project,
13
- // and has already been configured to work with Cloudflare Workers
14
- "--example",
15
- "https://github.com/opennextjs/opennextjs-cloudflare/tree/main/create-cloudflare/next",
16
- ]);
6
+ const repoUrl =
7
+ "https://github.com/opennextjs/opennextjs-cloudflare/tree/main/create-cloudflare/next";
8
+
9
+ await downloadRemoteTemplate(repoUrl, {
10
+ intoFolder: ctx.project.path,
11
+ });
12
+
13
+ await updatePackageName(ctx);
17
14
  };
18
15
 
19
16
  const envInterfaceName = "CloudflareEnv";
@@ -24,17 +21,7 @@ export default {
24
21
  frameworkCli: "create-next-app",
25
22
  platform: "workers",
26
23
  displayName: "Next.js",
27
- copyFiles: {
28
- path: "./templates",
29
- },
30
24
  generate,
31
- transformPackageJson: async () => ({
32
- scripts: {
33
- deploy: `opennextjs-cloudflare build && opennextjs-cloudflare deploy`,
34
- preview: `opennextjs-cloudflare build && opennextjs-cloudflare preview`,
35
- "cf-typegen": `wrangler types --env-interface ${envInterfaceName} ${typesPath}`,
36
- },
37
- }),
38
25
  devScript: "dev",
39
26
  previewScript: "preview",
40
27
  deployScript: "deploy",
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "<TBD>",
3
- "compatibility_date": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
+ "compatibility_date": "<COMPATIBILITY_DATE>",
4
4
  "pages_build_output_dir": "./dist"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
3
  "main": "./.output/server/index.mjs",
4
- "compatibility_date": "<TBD>",
4
+ "compatibility_date": "<COMPATIBILITY_DATE>",
5
5
  "assets": {
6
6
  "binding": "ASSETS",
7
7
  "directory": "./.output/public/"
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
3
  "main": "src/index.ts",
4
- "compatibility_date": "<TBD>",
4
+ "compatibility_date": "<COMPATIBILITY_DATE>",
5
5
  "observability": {
6
6
  "enabled": true
7
7
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<PACKAGE_NAME>",
3
3
  "version": "0.0.0",
4
4
  "private": true,
5
5
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<PACKAGE_NAME>",
3
3
  "version": "0.0.0",
4
4
  "private": true,
5
5
  "scripts": {
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
3
  "main": "src/index.js",
4
- "compatibility_date": "<TBD>",
4
+ "compatibility_date": "<COMPATIBILITY_DATE>",
5
5
  "observability": {
6
6
  "enabled": true
7
7
  },
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<PACKAGE_NAME>",
3
3
  "version": "0.0.0",
4
4
  "private": true,
5
5
  "scripts": {
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
3
  "main": "src/index.ts",
4
- "compatibility_date": "<TBD>",
4
+ "compatibility_date": "<COMPATIBILITY_DATE>",
5
5
  "observability": {
6
6
  "enabled": true
7
7
  },
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "<TBD>",
3
- "compatibility_date": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
+ "compatibility_date": "<COMPATIBILITY_DATE>",
4
4
  "compatibility_flags": [
5
5
  "nodejs_compat"
6
6
  ],
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
3
  "main": "./dist/_worker.js",
4
- "compatibility_date": "<TBD>",
4
+ "compatibility_date": "<COMPATIBILITY_DATE>",
5
5
  "compatibility_flags": [
6
6
  "nodejs_compat",
7
7
  "global_fetch_strictly_public"
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "<TBD>",
3
- "compatibility_date": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
+ "compatibility_date": "<COMPATIBILITY_DATE>",
4
4
  "pages_build_output_dir": "./dist"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
3
  "main": "worker/index.js",
4
- "compatibility_date": "<TBD>",
4
+ "compatibility_date": "<COMPATIBILITY_DATE>",
5
5
  "assets": { "not_found_handling": "single-page-application" },
6
6
  "observability": {
7
7
  "enabled": true
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
3
  "main": "worker/index.ts",
4
- "compatibility_date": "<TBD>",
4
+ "compatibility_date": "<COMPATIBILITY_DATE>",
5
5
  "assets": { "not_found_handling": "single-page-application" },
6
6
  "observability": {
7
7
  "enabled": true
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<PACKAGE_NAME>",
3
3
  "version": "0.0.0",
4
4
  "private": true,
5
5
  "scripts": {
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
3
  "main": "src/index.js",
4
- "compatibility_date": "<TBD>",
4
+ "compatibility_date": "<COMPATIBILITY_DATE>",
5
5
  "observability": {
6
6
  "enabled": true
7
7
  },
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<PACKAGE_NAME>",
3
3
  "version": "0.0.0",
4
4
  "private": true,
5
5
  "scripts": {
@@ -12,4 +12,4 @@
12
12
  "typescript": "^5.5.2",
13
13
  "wrangler": "^3.101.0"
14
14
  }
15
- }
15
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
3
  "main": "src/index.ts",
4
- "compatibility_date": "<TBD>",
4
+ "compatibility_date": "<COMPATIBILITY_DATE>",
5
5
  "observability": {
6
6
  "enabled": true
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
3
  "main": "./.output/server/index.mjs",
4
- "compatibility_date": "<TBD>",
4
+ "compatibility_date": "<COMPATIBILITY_DATE>",
5
5
  "compatibility_flags": [
6
6
  "nodejs_compat"
7
7
  ],
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "<TBD>",
3
- "compatibility_date": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
+ "compatibility_date": "<COMPATIBILITY_DATE>",
4
4
  "compatibility_flags": ["nodejs_als"],
5
5
  "pages_build_output_dir": ".svelte-kit/cloudflare"
6
6
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
3
  "main": ".svelte-kit/cloudflare/_worker.js",
4
- "compatibility_date": "<TBD>",
4
+ "compatibility_date": "<COMPATIBILITY_DATE>",
5
5
  "compatibility_flags": ["nodejs_als"],
6
6
  "assets": {
7
7
  "binding": "ASSETS",
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "<TBD>",
3
- "compatibility_date": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
+ "compatibility_date": "<COMPATIBILITY_DATE>",
4
4
  "pages_build_output_dir": "./dist"
5
5
  }
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "<TBD>",
3
- "compatibility_date": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
+ "compatibility_date": "<COMPATIBILITY_DATE>",
4
4
  "main": "server/index.js",
5
5
  "assets": {
6
6
  "not_found_handling": "single-page-application",
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "<TBD>",
3
- "compatibility_date": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
+ "compatibility_date": "<COMPATIBILITY_DATE>",
4
4
  "main": "server/index.ts",
5
5
  "assets": {
6
6
  "not_found_handling": "single-page-application",
@@ -1,8 +1,8 @@
1
1
  {
2
- "name": "<TBD>",
2
+ "name": "<WORKER_NAME>",
3
3
  "main": "./dist/worker/serve-cloudflare.js",
4
4
  // https://developers.cloudflare.com/workers/platform/compatibility-dates
5
- "compatibility_date": "<TBD>",
5
+ "compatibility_date": "<COMPATIBILITY_DATE>",
6
6
  // nodejs_als is required for Waku server-side request context
7
7
  // It can be removed if only building static pages
8
8
  "compatibility_flags": ["nodejs_als"],
@@ -1,7 +0,0 @@
1
- import { Nitro } from 'nitropack';
2
-
3
- const devBindingsModule = async (nitro: Nitro) => {
4
- if (nitro.options.dev) {
5
- nitro.options.plugins.push('./src/dev-bindings.ts');
6
- }
7
- };
@@ -1,13 +0,0 @@
1
- /// <reference types="./worker-configuration.d.ts" />
2
-
3
- declare module "h3" {
4
- interface H3EventContext {
5
- cf: CfProperties;
6
- cloudflare: {
7
- env: Env;
8
- context: ExecutionContext;
9
- };
10
- }
11
- }
12
-
13
- export {};
@@ -1,18 +0,0 @@
1
- import { NitroApp } from 'nitropack';
2
- import { defineNitroPlugin } from 'nitropack/dist/runtime/plugin';
3
-
4
- export default defineNitroPlugin((nitroApp: NitroApp) => {
5
- nitroApp.hooks.hook('request', async (event) => {
6
- const _pkg = 'wrangler'; // Bypass bundling!
7
- const { getPlatformProxy } = (await import(
8
- _pkg
9
- )) as typeof import('wrangler');
10
- const platform = await getPlatformProxy();
11
-
12
- event.context.cf = platform['cf'];
13
- event.context.cloudflare = {
14
- env: platform['env'] as unknown as Env,
15
- context: platform['ctx'],
16
- };
17
- });
18
- });
@@ -1,2 +0,0 @@
1
- # Load .env.development* files when running `wrangler dev`
2
- NEXTJS_ENV=development
@@ -1,39 +0,0 @@
1
- # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
-
3
- # dependencies
4
- /node_modules
5
- /.pnp
6
- .pnp.js
7
- .yarn/install-state.gz
8
-
9
- # testing
10
- /coverage
11
-
12
- # next.js
13
- /.next/
14
- /out/
15
-
16
- # production
17
- /build
18
-
19
- # misc
20
- .DS_Store
21
- *.pem
22
-
23
- # debug
24
- npm-debug.log*
25
- yarn-debug.log*
26
- yarn-error.log*
27
-
28
- # local env files
29
- .env*.local
30
-
31
- # vercel
32
- .vercel
33
-
34
- # typescript
35
- *.tsbuildinfo
36
- next-env.d.ts
37
-
38
- # OpenNext
39
- /.open-next
@@ -1,9 +0,0 @@
1
- import { defineCloudflareConfig } from "@opennextjs/cloudflare";
2
-
3
- export default defineCloudflareConfig({
4
- // Uncomment to enable R2 cache,
5
- // It should be imported as:
6
- // `import r2IncrementalCache from "@opennextjs/cloudflare/overrides/incremental-cache/r2-incremental-cache";`
7
- // See https://opennext.js.org/cloudflare/caching for more details
8
- // incrementalCache: r2IncrementalCache,
9
- });
@@ -1,3 +0,0 @@
1
- # https://developers.cloudflare.com/workers/static-assets/headers
2
- /_next/static/*
3
- Cache-Control: public,max-age=31536000,immutable
@@ -1,13 +0,0 @@
1
- {
2
- "name": "<app-name>",
3
- "main": ".open-next/worker.js",
4
- "compatibility_date": "2025-03-01",
5
- "compatibility_flags": [
6
- "nodejs_compat",
7
- "global_fetch_strictly_public"
8
- ],
9
- "assets": {
10
- "binding": "ASSETS",
11
- "directory": ".open-next/assets"
12
- }
13
- }