create-cloudflare 2.33.4 → 2.35.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.33.4",
3
+ "version": "2.35.0",
4
4
  "description": "A CLI for creating and deploying new applications to Cloudflare.",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -69,13 +69,14 @@
69
69
  "@cloudflare/cli": "1.1.1",
70
70
  "@cloudflare/workers-tsconfig": "0.0.0",
71
71
  "@cloudflare/eslint-config-worker": "1.1.0",
72
- "wrangler": "3.94.0"
72
+ "wrangler": "3.96.0"
73
73
  },
74
74
  "engines": {
75
75
  "node": ">=18.14.1"
76
76
  },
77
77
  "workers-sdk": {
78
- "prerelease": true
78
+ "prerelease": true,
79
+ "type": "cli"
79
80
  },
80
81
  "volta": {
81
82
  "extends": "../../package.json"
@@ -46,7 +46,7 @@ In order to enable the example:
46
46
  ```ts
47
47
  // KV Example:
48
48
  ```
49
- and uncomment the commented lines below it.
49
+ and uncomment the commented lines below it (also uncomment the relevant imports).
50
50
  - Do the same in the `wrangler.toml` file, where
51
51
  the comment is:
52
52
  ```
@@ -1,9 +1,9 @@
1
- import { getRequestContext } from '@cloudflare/next-on-pages'
1
+ // import { getRequestContext } from '@cloudflare/next-on-pages'
2
2
 
3
3
  export const runtime = 'edge'
4
4
 
5
- export async function GET(request) {
6
- let responseText = 'Hello World'
5
+ export async function GET() {
6
+ const responseText = 'Hello World'
7
7
 
8
8
  // In the edge runtime you can use Bindings that are available in your application
9
9
  // (for more details see:
@@ -15,7 +15,7 @@ export async function GET(request) {
15
15
  // const myKv = getRequestContext().env.MY_KV_NAMESPACE
16
16
  // await myKv.put('suffix', ' from a KV store!')
17
17
  // const suffix = await myKv.get('suffix')
18
- // responseText += suffix
18
+ // return new Response(responseText + suffix)
19
19
 
20
20
  return new Response(responseText)
21
21
  }
@@ -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'
3
2
 
4
3
  export const runtime = 'edge'
5
4
 
6
- export async function GET(request: NextRequest) {
7
- let responseText = 'Hello World'
5
+ export async function GET() {
6
+ const responseText = 'Hello World'
8
7
 
9
8
  // In the edge runtime you can use Bindings that are available in your application
10
9
  // (for more details see:
@@ -16,7 +15,7 @@ export async function GET(request: NextRequest) {
16
15
  // const myKv = getRequestContext().env.MY_KV_NAMESPACE
17
16
  // await myKv.put('suffix', ' from a KV store!')
18
17
  // const suffix = await myKv.get('suffix')
19
- // responseText += suffix
18
+ // return new Response(responseText + suffix)
20
19
 
21
20
  return new Response(responseText)
22
21
  }
@@ -49,10 +49,10 @@ const generate = async (ctx: C3Context) => {
49
49
  updateStatus("Created wrangler.toml file");
50
50
  };
51
51
 
52
- const updateNextConfig = () => {
52
+ const updateNextConfig = (usesTs: boolean) => {
53
53
  const s = spinner();
54
54
 
55
- const configFile = "next.config.mjs";
55
+ const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
56
56
  s.start(`Updating \`${configFile}\``);
57
57
 
58
58
  const configContent = readFile(configFile);
@@ -107,7 +107,7 @@ const configure = async (ctx: C3Context) => {
107
107
  await writeEslintrc(ctx);
108
108
  }
109
109
 
110
- updateNextConfig();
110
+ updateNextConfig(usesTs);
111
111
 
112
112
  copyFile(
113
113
  join(getTemplatePath(ctx), "README.md"),
@@ -131,10 +131,7 @@ const config: TemplateConfig = {
131
131
  displayName: "SvelteKit",
132
132
  platform: "pages",
133
133
  copyFiles: {
134
- variants: {
135
- js: { path: "./js" },
136
- ts: { path: "./ts" },
137
- },
134
+ path: "./templates",
138
135
  },
139
136
  generate,
140
137
  configure,
@@ -30,6 +30,10 @@ export default {
30
30
  configVersion: 1,
31
31
  id: "next",
32
32
  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",
33
37
  platform: "workers",
34
38
  displayName: "Next (using Node.js compat + Workers Assets)",
35
39
  path: "templates-experimental/next",
@@ -101,10 +101,7 @@ const config: TemplateConfig = {
101
101
  displayName: "SvelteKit",
102
102
  platform: "workers",
103
103
  copyFiles: {
104
- variants: {
105
- js: { path: "./js" },
106
- ts: { path: "./ts" },
107
- },
104
+ path: "./templates",
108
105
  },
109
106
  path: "templates-experimental/svelte",
110
107
  generate,
@@ -1,85 +0,0 @@
1
- #:schema node_modules/wrangler/config-schema.json
2
- name = "<TBD>"
3
- compatibility_date = "<TBD>"
4
- pages_build_output_dir = ".svelte-kit/cloudflare"
5
-
6
- # Automatically place your workloads in an optimal location to minimize latency.
7
- # If you are running back-end logic in a Pages Function, running it closer to your back-end infrastructure
8
- # rather than the end user may result in better performance.
9
- # Docs: https://developers.cloudflare.com/pages/functions/smart-placement/#smart-placement
10
- # [placement]
11
- # mode = "smart"
12
-
13
- # Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
14
- # Docs:
15
- # - https://developers.cloudflare.com/pages/functions/bindings/#environment-variables
16
- # Note: Use secrets to store sensitive data.
17
- # - https://developers.cloudflare.com/pages/functions/bindings/#secrets
18
- # [vars]
19
- # MY_VARIABLE = "production_value"
20
-
21
- # Bind the Workers AI model catalog. Run machine learning models, powered by serverless GPUs, on Cloudflare’s global network
22
- # Docs: https://developers.cloudflare.com/pages/functions/bindings/#workers-ai
23
- # [ai]
24
- # binding = "AI"
25
-
26
- # Bind a D1 database. D1 is Cloudflare’s native serverless SQL database.
27
- # Docs: https://developers.cloudflare.com/pages/functions/bindings/#d1-databases
28
- # [[d1_databases]]
29
- # binding = "MY_DB"
30
- # database_name = "my-database"
31
- # database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
32
-
33
- # Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
34
- # Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
35
- # Docs: https://developers.cloudflare.com/workers/runtime-apis/durable-objects
36
- # [[durable_objects.bindings]]
37
- # name = "MY_DURABLE_OBJECT"
38
- # class_name = "MyDurableObject"
39
- # script_name = 'my-durable-object'
40
-
41
- # Bind a KV Namespace. Use KV as persistent storage for small key-value pairs.
42
- # Docs: https://developers.cloudflare.com/pages/functions/bindings/#kv-namespaces
43
- # [[kv_namespaces]]
44
- # binding = "MY_KV_NAMESPACE"
45
- # id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
46
-
47
- # Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
48
- # Docs: https://developers.cloudflare.com/pages/functions/bindings/#queue-producers
49
- # [[queues.producers]]
50
- # binding = "MY_QUEUE"
51
- # queue = "my-queue"
52
-
53
- # Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
54
- # Docs: https://developers.cloudflare.com/pages/functions/bindings/#r2-buckets
55
- # [[r2_buckets]]
56
- # binding = "MY_BUCKET"
57
- # bucket_name = "my-bucket"
58
-
59
- # Bind another Worker service. Use this binding to call another Worker without network overhead.
60
- # Docs: https://developers.cloudflare.com/pages/functions/bindings/#service-bindings
61
- # [[services]]
62
- # binding = "MY_SERVICE"
63
- # service = "my-service"
64
-
65
- # To use different bindings for preview and production environments, follow the examples below.
66
- # When using environment-specific overrides for bindings, ALL bindings must be specified on a per-environment basis.
67
- # Docs: https://developers.cloudflare.com/pages/functions/wrangler-configuration#environment-specific-overrides
68
-
69
- ######## PREVIEW environment config ########
70
-
71
- # [env.preview.vars]
72
- # API_KEY = "xyz789"
73
-
74
- # [[env.preview.kv_namespaces]]
75
- # binding = "MY_KV_NAMESPACE"
76
- # id = "<PREVIEW_NAMESPACE_ID>"
77
-
78
- ######## PRODUCTION environment config ########
79
-
80
- # [env.production.vars]
81
- # API_KEY = "abc123"
82
-
83
- # [[env.production.kv_namespaces]]
84
- # binding = "MY_KV_NAMESPACE"
85
- # id = "<PRODUCTION_NAMESPACE_ID>"
@@ -1,4 +0,0 @@
1
- _worker.js
2
- _routes.json
3
- _headers
4
- _redirects
@@ -1,11 +0,0 @@
1
- #:schema node_modules/wrangler/config-schema.json
2
- name = "<TBD>"
3
- compatibility_date = "<TBD>"
4
- main = ".svelte-kit/cloudflare/_worker.js"
5
- assets = { directory = ".svelte-kit/cloudflare", binding = "ASSETS" }
6
-
7
- # Workers Logs
8
- # Docs: https://developers.cloudflare.com/workers/observability/logs/workers-logs/
9
- # Configuration: https://developers.cloudflare.com/workers/observability/logs/workers-logs/#enable-workers-logs
10
- [observability]
11
- enabled = true