create-cloudflare 2.19.0 → 2.20.1
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/dist/cli.js +26 -24
- package/package.json +3 -3
- package/templates/analog/c3.ts +1 -1
- package/templates/analog/templates/worker-configuration.d.ts +1 -1
- package/templates/astro/c3.ts +3 -3
- package/templates/astro/templates/wrangler.toml +27 -2
- package/templates/common/js/wrangler.toml +3 -1
- package/templates/common/ts/package.json +2 -1
- package/templates/common/ts/src/index.ts +3 -0
- package/templates/common/ts/worker-configuration.d.ts +2 -14
- package/templates/common/ts/wrangler.toml +3 -1
- package/templates/hello-world/js/test/index.spec.js +17 -17
- package/templates/hello-world/js/wrangler.toml +3 -1
- package/templates/hello-world/ts/package.json +2 -1
- package/templates/hello-world/ts/src/index.ts +3 -17
- package/templates/hello-world/ts/test/index.spec.ts +17 -17
- package/templates/hello-world/ts/worker-configuration.d.ts +4 -0
- package/templates/hello-world/ts/wrangler.toml +3 -1
- package/templates/hello-world-durable-object/js/wrangler.toml +3 -1
- package/templates/hello-world-durable-object/ts/package.json +2 -1
- package/templates/hello-world-durable-object/ts/src/index.ts +3 -20
- package/templates/hello-world-durable-object/ts/worker-configuration.d.ts +6 -0
- package/templates/hello-world-durable-object/ts/wrangler.toml +3 -2
- package/templates/hello-world-python/py/wrangler.toml +3 -1
- package/templates/next/README.md +5 -5
- package/templates/next/c3.ts +3 -3
- package/templates/next/wrangler.toml +25 -1
- package/templates/nuxt/c3.ts +3 -3
- package/templates/nuxt/templates/worker-configuration.d.ts +1 -1
- package/templates/nuxt/templates/wrangler.toml +27 -2
- package/templates/openapi/ts/package.json +2 -1
- package/templates/openapi/ts/worker-configuration.d.ts +4 -0
- package/templates/openapi/ts/wrangler.toml +96 -0
- package/templates/queues/js/wrangler.toml +3 -1
- package/templates/queues/ts/package.json +2 -1
- package/templates/queues/ts/src/index.ts +3 -5
- package/templates/queues/ts/worker-configuration.d.ts +5 -0
- package/templates/queues/ts/wrangler.toml +3 -1
- package/templates/qwik/c3.ts +3 -3
- package/templates/qwik/templates/worker-configuration.d.ts +1 -1
- package/templates/qwik/templates/wrangler.toml +27 -2
- package/templates/remix/c3.ts +3 -3
- package/templates/remix/templates/worker-configuration.d.ts +1 -1
- package/templates/remix/templates/wrangler.toml +27 -2
- package/templates/scheduled/js/wrangler.toml +4 -2
- package/templates/scheduled/ts/package.json +2 -1
- package/templates/scheduled/ts/src/index.ts +3 -20
- package/templates/scheduled/ts/worker-configuration.d.ts +4 -0
- package/templates/scheduled/ts/wrangler.toml +4 -2
- package/templates/solid/c3.ts +5 -3
- package/templates/solid/templates/wrangler.toml +77 -0
- package/templates/svelte/c3.ts +3 -3
- package/templates/svelte/js/wrangler.toml +27 -2
- package/templates/svelte/ts/wrangler.toml +27 -2
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
#:schema node_modules/wrangler/config-schema.json
|
|
2
2
|
name = "<TBD>"
|
|
3
3
|
compatibility_date = "<TBD>"
|
|
4
|
+
pages_build_output_dir = "./dist"
|
|
4
5
|
|
|
5
6
|
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
7
|
+
# Docs:
|
|
8
|
+
# - https://developers.cloudflare.com/pages/functions/bindings/#environment-variables
|
|
6
9
|
# Note: Use secrets to store sensitive data.
|
|
7
|
-
#
|
|
10
|
+
# - https://developers.cloudflare.com/pages/functions/bindings/#secrets
|
|
8
11
|
# [vars]
|
|
9
12
|
# MY_VARIABLE = "production_value"
|
|
10
13
|
|
|
@@ -50,4 +53,26 @@ compatibility_date = "<TBD>"
|
|
|
50
53
|
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#service-bindings
|
|
51
54
|
# [[services]]
|
|
52
55
|
# binding = "MY_SERVICE"
|
|
53
|
-
# service = "my-service"
|
|
56
|
+
# service = "my-service"
|
|
57
|
+
|
|
58
|
+
# To use different bindings for preview and production environments, follow the examples below.
|
|
59
|
+
# When using environment-specific overrides for bindings, ALL bindings must be specified on a per-environment basis.
|
|
60
|
+
# Docs: https://developers.cloudflare.com/pages/functions/wrangler-configuration#environment-specific-overrides
|
|
61
|
+
|
|
62
|
+
######## PREVIEW environment config ########
|
|
63
|
+
|
|
64
|
+
# [env.preview.vars]
|
|
65
|
+
# API_KEY = "xyz789"
|
|
66
|
+
|
|
67
|
+
# [[env.preview.kv_namespaces]]
|
|
68
|
+
# binding = "MY_KV_NAMESPACE"
|
|
69
|
+
# id = "<PREVIEW_NAMESPACE_ID>"
|
|
70
|
+
|
|
71
|
+
######## PRODUCTION environment config ########
|
|
72
|
+
|
|
73
|
+
# [env.production.vars]
|
|
74
|
+
# API_KEY = "abc123"
|
|
75
|
+
|
|
76
|
+
# [[env.production.kv_namespaces]]
|
|
77
|
+
# binding = "MY_KV_NAMESPACE"
|
|
78
|
+
# id = "<PRODUCTION_NAMESPACE_ID>"
|
|
@@ -2,3 +2,99 @@
|
|
|
2
2
|
name = "<TBD>"
|
|
3
3
|
main = "src/index.ts"
|
|
4
4
|
compatibility_date = "<TBD>"
|
|
5
|
+
|
|
6
|
+
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
7
|
+
# Docs:
|
|
8
|
+
# - https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
|
|
9
|
+
# Note: Use secrets to store sensitive data.
|
|
10
|
+
# - https://developers.cloudflare.com/workers/configuration/secrets/
|
|
11
|
+
# [vars]
|
|
12
|
+
# MY_VARIABLE = "production_value"
|
|
13
|
+
|
|
14
|
+
# Bind the Workers AI model catalog. Run machine learning models, powered by serverless GPUs, on Cloudflare’s global network
|
|
15
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#workers-ai
|
|
16
|
+
# [ai]
|
|
17
|
+
# binding = "AI"
|
|
18
|
+
|
|
19
|
+
# Bind an Analytics Engine dataset. Use Analytics Engine to write analytics within your Pages Function.
|
|
20
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#analytics-engine-datasets
|
|
21
|
+
# [[analytics_engine_datasets]]
|
|
22
|
+
# binding = "MY_DATASET"
|
|
23
|
+
|
|
24
|
+
# Bind a headless browser instance running on Cloudflare's global network.
|
|
25
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#browser-rendering
|
|
26
|
+
# [browser]
|
|
27
|
+
# binding = "MY_BROWSER"
|
|
28
|
+
|
|
29
|
+
# Bind a D1 database. D1 is Cloudflare’s native serverless SQL database.
|
|
30
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#d1-databases
|
|
31
|
+
# [[d1_databases]]
|
|
32
|
+
# binding = "MY_DB"
|
|
33
|
+
# database_name = "my-database"
|
|
34
|
+
# database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
35
|
+
|
|
36
|
+
# Bind a dispatch namespace. Use Workers for Platforms to deploy serverless functions programmatically on behalf of your customers.
|
|
37
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#dispatch-namespace-bindings-workers-for-platforms
|
|
38
|
+
# [[dispatch_namespaces]]
|
|
39
|
+
# binding = "MY_DISPATCHER"
|
|
40
|
+
# namespace = "my-namespace"
|
|
41
|
+
|
|
42
|
+
# Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
|
|
43
|
+
# Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
|
|
44
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
|
|
45
|
+
# [[durable_objects.bindings]]
|
|
46
|
+
# name = "MY_DURABLE_OBJECT"
|
|
47
|
+
# class_name = "MyDurableObject"
|
|
48
|
+
|
|
49
|
+
# Durable Object migrations.
|
|
50
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#migrations
|
|
51
|
+
# [[migrations]]
|
|
52
|
+
# tag = "v1"
|
|
53
|
+
# new_classes = ["MyDurableObject"]
|
|
54
|
+
|
|
55
|
+
# Bind a Hyperdrive configuration. Use to accelerate access to your existing databases from Cloudflare Workers.
|
|
56
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#hyperdrive
|
|
57
|
+
# [[hyperdrive]]
|
|
58
|
+
# binding = "MY_HYPERDRIVE"
|
|
59
|
+
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
60
|
+
|
|
61
|
+
# Bind a KV Namespace. Use KV as persistent storage for small key-value pairs.
|
|
62
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#kv-namespaces
|
|
63
|
+
# [[kv_namespaces]]
|
|
64
|
+
# binding = "MY_KV_NAMESPACE"
|
|
65
|
+
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
66
|
+
|
|
67
|
+
# Bind an mTLS certificate. Use to present a client certificate when communicating with another service.
|
|
68
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#mtls-certificates
|
|
69
|
+
# [[mtls_certificates]]
|
|
70
|
+
# binding = "MY_CERTIFICATE"
|
|
71
|
+
# certificate_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
72
|
+
|
|
73
|
+
# Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
|
|
74
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#queues
|
|
75
|
+
# [[queues.producers]]
|
|
76
|
+
# binding = "MY_QUEUE"
|
|
77
|
+
# queue = "my-queue"
|
|
78
|
+
|
|
79
|
+
# Bind a Queue consumer. Queue Consumers can retrieve tasks scheduled by Producers to act on them.
|
|
80
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#queues
|
|
81
|
+
# [[queues.consumers]]
|
|
82
|
+
# queue = "my-queue"
|
|
83
|
+
|
|
84
|
+
# Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
|
|
85
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#r2-buckets
|
|
86
|
+
# [[r2_buckets]]
|
|
87
|
+
# binding = "MY_BUCKET"
|
|
88
|
+
# bucket_name = "my-bucket"
|
|
89
|
+
|
|
90
|
+
# Bind another Worker service. Use this binding to call another Worker without network overhead.
|
|
91
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings
|
|
92
|
+
# [[services]]
|
|
93
|
+
# binding = "MY_SERVICE"
|
|
94
|
+
# service = "my-service"
|
|
95
|
+
|
|
96
|
+
# Bind a Vectorize index. Use to store and query vector embeddings for semantic search, classification and other vector search use-cases.
|
|
97
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#vectorize-indexes
|
|
98
|
+
# [[vectorize]]
|
|
99
|
+
# binding = "MY_INDEX"
|
|
100
|
+
# index_name = "my-index"
|
|
@@ -4,8 +4,10 @@ main = "src/index.js"
|
|
|
4
4
|
compatibility_date = "<TBD>"
|
|
5
5
|
|
|
6
6
|
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
7
|
+
# Docs:
|
|
8
|
+
# - https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
|
|
7
9
|
# Note: Use secrets to store sensitive data.
|
|
8
|
-
#
|
|
10
|
+
# - https://developers.cloudflare.com/workers/configuration/secrets/
|
|
9
11
|
# [vars]
|
|
10
12
|
# MY_VARIABLE = "production_value"
|
|
11
13
|
|
|
@@ -8,14 +8,12 @@
|
|
|
8
8
|
* - Open a browser tab at http://localhost:8787/ to see your worker in action
|
|
9
9
|
* - Run `npm run deploy` to publish your worker
|
|
10
10
|
*
|
|
11
|
+
* Bind resources to your worker in `wrangler.toml`. After adding bindings, a type definition for the
|
|
12
|
+
* `Env` object can be regenerated with `npm run cf-typegen`.
|
|
13
|
+
*
|
|
11
14
|
* Learn more at https://developers.cloudflare.com/workers/
|
|
12
15
|
*/
|
|
13
16
|
|
|
14
|
-
export interface Env {
|
|
15
|
-
// Example binding to a Queue. Learn more at https://developers.cloudflare.com/queues/javascript-apis/
|
|
16
|
-
MY_QUEUE: Queue;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
17
|
export default {
|
|
20
18
|
// Our fetch handler is invoked on a HTTP request: we can send a message to a queue
|
|
21
19
|
// during (or after) a request.
|
|
@@ -4,8 +4,10 @@ main = "src/index.ts"
|
|
|
4
4
|
compatibility_date = "<TBD>"
|
|
5
5
|
|
|
6
6
|
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
7
|
+
# Docs:
|
|
8
|
+
# - https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
|
|
7
9
|
# Note: Use secrets to store sensitive data.
|
|
8
|
-
#
|
|
10
|
+
# - https://developers.cloudflare.com/workers/configuration/secrets/
|
|
9
11
|
# [vars]
|
|
10
12
|
# MY_VARIABLE = "production_value"
|
|
11
13
|
|
package/templates/qwik/c3.ts
CHANGED
|
@@ -134,9 +134,9 @@ const config: TemplateConfig = {
|
|
|
134
134
|
configure,
|
|
135
135
|
transformPackageJson: async () => ({
|
|
136
136
|
scripts: {
|
|
137
|
-
deploy: `${npm} run build && wrangler pages deploy
|
|
138
|
-
preview: `${npm} run build && wrangler pages dev
|
|
139
|
-
"
|
|
137
|
+
deploy: `${npm} run build && wrangler pages deploy`,
|
|
138
|
+
preview: `${npm} run build && wrangler pages dev`,
|
|
139
|
+
"cf-typegen": `wrangler types`,
|
|
140
140
|
},
|
|
141
141
|
}),
|
|
142
142
|
devScript: "dev",
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
#:schema node_modules/wrangler/config-schema.json
|
|
2
2
|
name = "<TBD>"
|
|
3
3
|
compatibility_date = "<TBD>"
|
|
4
|
+
pages_build_output_dir = "./dist"
|
|
4
5
|
|
|
5
6
|
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
7
|
+
# Docs:
|
|
8
|
+
# - https://developers.cloudflare.com/pages/functions/bindings/#environment-variables
|
|
6
9
|
# Note: Use secrets to store sensitive data.
|
|
7
|
-
#
|
|
10
|
+
# - https://developers.cloudflare.com/pages/functions/bindings/#secrets
|
|
8
11
|
# [vars]
|
|
9
12
|
# MY_VARIABLE = "production_value"
|
|
10
13
|
|
|
@@ -50,4 +53,26 @@ compatibility_date = "<TBD>"
|
|
|
50
53
|
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#service-bindings
|
|
51
54
|
# [[services]]
|
|
52
55
|
# binding = "MY_SERVICE"
|
|
53
|
-
# service = "my-service"
|
|
56
|
+
# service = "my-service"
|
|
57
|
+
|
|
58
|
+
# To use different bindings for preview and production environments, follow the examples below.
|
|
59
|
+
# When using environment-specific overrides for bindings, ALL bindings must be specified on a per-environment basis.
|
|
60
|
+
# Docs: https://developers.cloudflare.com/pages/functions/wrangler-configuration#environment-specific-overrides
|
|
61
|
+
|
|
62
|
+
######## PREVIEW environment config ########
|
|
63
|
+
|
|
64
|
+
# [env.preview.vars]
|
|
65
|
+
# API_KEY = "xyz789"
|
|
66
|
+
|
|
67
|
+
# [[env.preview.kv_namespaces]]
|
|
68
|
+
# binding = "MY_KV_NAMESPACE"
|
|
69
|
+
# id = "<PREVIEW_NAMESPACE_ID>"
|
|
70
|
+
|
|
71
|
+
######## PRODUCTION environment config ########
|
|
72
|
+
|
|
73
|
+
# [env.production.vars]
|
|
74
|
+
# API_KEY = "abc123"
|
|
75
|
+
|
|
76
|
+
# [[env.production.kv_namespaces]]
|
|
77
|
+
# binding = "MY_KV_NAMESPACE"
|
|
78
|
+
# id = "<PRODUCTION_NAMESPACE_ID>"
|
package/templates/remix/c3.ts
CHANGED
|
@@ -54,9 +54,9 @@ const config: TemplateConfig = {
|
|
|
54
54
|
configure,
|
|
55
55
|
transformPackageJson: async () => ({
|
|
56
56
|
scripts: {
|
|
57
|
-
deploy: `${npm} run build && wrangler pages deploy
|
|
58
|
-
preview: `${npm} run build && wrangler pages dev
|
|
59
|
-
"
|
|
57
|
+
deploy: `${npm} run build && wrangler pages deploy`,
|
|
58
|
+
preview: `${npm} run build && wrangler pages dev`,
|
|
59
|
+
"cf-typegen": `wrangler types`,
|
|
60
60
|
},
|
|
61
61
|
}),
|
|
62
62
|
devScript: "dev",
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
#:schema node_modules/wrangler/config-schema.json
|
|
2
2
|
name = "<TBD>"
|
|
3
3
|
compatibility_date = "<TBD>"
|
|
4
|
+
pages_build_output_dir = "./build/client"
|
|
4
5
|
|
|
5
6
|
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
7
|
+
# Docs:
|
|
8
|
+
# - https://developers.cloudflare.com/pages/functions/bindings/#environment-variables
|
|
6
9
|
# Note: Use secrets to store sensitive data.
|
|
7
|
-
#
|
|
10
|
+
# - https://developers.cloudflare.com/pages/functions/bindings/#secrets
|
|
8
11
|
# [vars]
|
|
9
12
|
# MY_VARIABLE = "production_value"
|
|
10
13
|
|
|
@@ -50,4 +53,26 @@ compatibility_date = "<TBD>"
|
|
|
50
53
|
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#service-bindings
|
|
51
54
|
# [[services]]
|
|
52
55
|
# binding = "MY_SERVICE"
|
|
53
|
-
# service = "my-service"
|
|
56
|
+
# service = "my-service"
|
|
57
|
+
|
|
58
|
+
# To use different bindings for preview and production environments, follow the examples below.
|
|
59
|
+
# When using environment-specific overrides for bindings, ALL bindings must be specified on a per-environment basis.
|
|
60
|
+
# Docs: https://developers.cloudflare.com/pages/functions/wrangler-configuration#environment-specific-overrides
|
|
61
|
+
|
|
62
|
+
######## PREVIEW environment config ########
|
|
63
|
+
|
|
64
|
+
# [env.preview.vars]
|
|
65
|
+
# API_KEY = "xyz789"
|
|
66
|
+
|
|
67
|
+
# [[env.preview.kv_namespaces]]
|
|
68
|
+
# binding = "MY_KV_NAMESPACE"
|
|
69
|
+
# id = "<PREVIEW_NAMESPACE_ID>"
|
|
70
|
+
|
|
71
|
+
######## PRODUCTION environment config ########
|
|
72
|
+
|
|
73
|
+
# [env.production.vars]
|
|
74
|
+
# API_KEY = "abc123"
|
|
75
|
+
|
|
76
|
+
# [[env.production.kv_namespaces]]
|
|
77
|
+
# binding = "MY_KV_NAMESPACE"
|
|
78
|
+
# id = "<PRODUCTION_NAMESPACE_ID>"
|
|
@@ -10,8 +10,10 @@ compatibility_date = "<TBD>"
|
|
|
10
10
|
crons = ["* * * * *"] # * * * * * = run every minute
|
|
11
11
|
|
|
12
12
|
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
13
|
+
# Docs:
|
|
14
|
+
# - https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
|
|
13
15
|
# Note: Use secrets to store sensitive data.
|
|
14
|
-
#
|
|
16
|
+
# - https://developers.cloudflare.com/workers/configuration/secrets/
|
|
15
17
|
# [vars]
|
|
16
18
|
# MY_VARIABLE = "production_value"
|
|
17
19
|
|
|
@@ -101,4 +103,4 @@ crons = ["* * * * *"] # * * * * * = run every minute
|
|
|
101
103
|
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#vectorize-indexes
|
|
102
104
|
# [[vectorize]]
|
|
103
105
|
# binding = "MY_INDEX"
|
|
104
|
-
# index_name = "my-index"
|
|
106
|
+
# index_name = "my-index"
|
|
@@ -9,29 +9,12 @@
|
|
|
9
9
|
* - Open a browser tab at http://localhost:8787/ to see your worker in action
|
|
10
10
|
* - Run `npm run deploy` to publish your worker
|
|
11
11
|
*
|
|
12
|
+
* Bind resources to your worker in `wrangler.toml`. After adding bindings, a type definition for the
|
|
13
|
+
* `Env` object can be regenerated with `npm run cf-typegen`.
|
|
14
|
+
*
|
|
12
15
|
* Learn more at https://developers.cloudflare.com/workers/
|
|
13
16
|
*/
|
|
14
17
|
|
|
15
|
-
export interface Env {
|
|
16
|
-
// Example binding to KV. Learn more at https://developers.cloudflare.com/workers/runtime-apis/kv/
|
|
17
|
-
// MY_KV_NAMESPACE: KVNamespace;
|
|
18
|
-
//
|
|
19
|
-
// Example binding to Durable Object. Learn more at https://developers.cloudflare.com/workers/runtime-apis/durable-objects/
|
|
20
|
-
// MY_DURABLE_OBJECT: DurableObjectNamespace;
|
|
21
|
-
//
|
|
22
|
-
// Example binding to R2. Learn more at https://developers.cloudflare.com/workers/runtime-apis/r2/
|
|
23
|
-
// MY_BUCKET: R2Bucket;
|
|
24
|
-
//
|
|
25
|
-
// Example binding to a Service. Learn more at https://developers.cloudflare.com/workers/runtime-apis/service-bindings/
|
|
26
|
-
// MY_SERVICE: Fetcher;
|
|
27
|
-
//
|
|
28
|
-
// Example binding to a Queue. Learn more at https://developers.cloudflare.com/queues/javascript-apis/
|
|
29
|
-
// MY_QUEUE: Queue;
|
|
30
|
-
//
|
|
31
|
-
// Example binding to a D1 Database. Learn more at https://developers.cloudflare.com/workers/platform/bindings/#d1-database-bindings
|
|
32
|
-
// DB: D1Database
|
|
33
|
-
}
|
|
34
|
-
|
|
35
18
|
export default {
|
|
36
19
|
// The scheduled handler is invoked at the interval set in our wrangler.toml's
|
|
37
20
|
// [[triggers]] configuration.
|
|
@@ -10,8 +10,10 @@ compatibility_date = "<TBD>"
|
|
|
10
10
|
crons = ["* * * * *"] # * * * * * = run every minute
|
|
11
11
|
|
|
12
12
|
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
13
|
+
# Docs:
|
|
14
|
+
# - https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
|
|
13
15
|
# Note: Use secrets to store sensitive data.
|
|
14
|
-
#
|
|
16
|
+
# - https://developers.cloudflare.com/workers/configuration/secrets/
|
|
15
17
|
# [vars]
|
|
16
18
|
# MY_VARIABLE = "production_value"
|
|
17
19
|
|
|
@@ -101,4 +103,4 @@ crons = ["* * * * *"] # * * * * * = run every minute
|
|
|
101
103
|
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#vectorize-indexes
|
|
102
104
|
# [[vectorize]]
|
|
103
105
|
# binding = "MY_INDEX"
|
|
104
|
-
# index_name = "my-index"
|
|
106
|
+
# index_name = "my-index"
|
package/templates/solid/c3.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { logRaw, updateStatus } from "@cloudflare/cli";
|
|
|
2
2
|
import { blue } from "@cloudflare/cli/colors";
|
|
3
3
|
import { runFrameworkGenerator } from "frameworks/index";
|
|
4
4
|
import { transformFile } from "helpers/codemod";
|
|
5
|
-
import { compatDateFlag } from "helpers/compatDate";
|
|
6
5
|
import { usesTypescript } from "helpers/files";
|
|
7
6
|
import { detectPackageManager } from "helpers/packageManagers";
|
|
8
7
|
import * as recast from "recast";
|
|
@@ -66,12 +65,15 @@ const config: TemplateConfig = {
|
|
|
66
65
|
id: "solid",
|
|
67
66
|
displayName: "Solid",
|
|
68
67
|
platform: "pages",
|
|
68
|
+
copyFiles: {
|
|
69
|
+
path: "./templates",
|
|
70
|
+
},
|
|
69
71
|
generate,
|
|
70
72
|
configure,
|
|
71
73
|
transformPackageJson: async () => ({
|
|
72
74
|
scripts: {
|
|
73
|
-
preview: `${npm} run build && npx wrangler pages dev
|
|
74
|
-
deploy: `${npm} run build && wrangler pages deploy
|
|
75
|
+
preview: `${npm} run build && npx wrangler pages dev`,
|
|
76
|
+
deploy: `${npm} run build && wrangler pages deploy`,
|
|
75
77
|
},
|
|
76
78
|
}),
|
|
77
79
|
compatibilityFlags: ["nodejs_compat"],
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#:schema node_modules/wrangler/config-schema.json
|
|
2
|
+
name = "<TBD>"
|
|
3
|
+
compatibility_date = "<TBD>"
|
|
4
|
+
compatibility_flags = ["nodejs_compat"]
|
|
5
|
+
pages_build_output_dir = "./dist"
|
|
6
|
+
|
|
7
|
+
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
8
|
+
# Note: Use secrets to store sensitive data.
|
|
9
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#environment-variables
|
|
10
|
+
# [vars]
|
|
11
|
+
# MY_VARIABLE = "production_value"
|
|
12
|
+
|
|
13
|
+
# Bind the Workers AI model catalog. Run machine learning models, powered by serverless GPUs, on Cloudflare’s global network
|
|
14
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#workers-ai
|
|
15
|
+
# [ai]
|
|
16
|
+
# binding = "AI"
|
|
17
|
+
|
|
18
|
+
# Bind a D1 database. D1 is Cloudflare’s native serverless SQL database.
|
|
19
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#d1-databases
|
|
20
|
+
# [[d1_databases]]
|
|
21
|
+
# binding = "MY_DB"
|
|
22
|
+
# database_name = "my-database"
|
|
23
|
+
# database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
24
|
+
|
|
25
|
+
# Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
|
|
26
|
+
# Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
|
|
27
|
+
# Docs: https://developers.cloudflare.com/workers/runtime-apis/durable-objects
|
|
28
|
+
# [[durable_objects.bindings]]
|
|
29
|
+
# name = "MY_DURABLE_OBJECT"
|
|
30
|
+
# class_name = "MyDurableObject"
|
|
31
|
+
# script_name = 'my-durable-object'
|
|
32
|
+
|
|
33
|
+
# Bind a KV Namespace. Use KV as persistent storage for small key-value pairs.
|
|
34
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#kv-namespaces
|
|
35
|
+
# [[kv_namespaces]]
|
|
36
|
+
# binding = "MY_KV_NAMESPACE"
|
|
37
|
+
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
38
|
+
|
|
39
|
+
# Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
|
|
40
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#queue-producers
|
|
41
|
+
# [[queues.producers]]
|
|
42
|
+
# binding = "MY_QUEUE"
|
|
43
|
+
# queue = "my-queue"
|
|
44
|
+
|
|
45
|
+
# Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
|
|
46
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#r2-buckets
|
|
47
|
+
# [[r2_buckets]]
|
|
48
|
+
# binding = "MY_BUCKET"
|
|
49
|
+
# bucket_name = "my-bucket"
|
|
50
|
+
|
|
51
|
+
# Bind another Worker service. Use this binding to call another Worker without network overhead.
|
|
52
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#service-bindings
|
|
53
|
+
# [[services]]
|
|
54
|
+
# binding = "MY_SERVICE"
|
|
55
|
+
# service = "my-service"
|
|
56
|
+
|
|
57
|
+
# To use different bindings for preview and production environments, follow the examples below.
|
|
58
|
+
# When using environment-specific overrides for bindings, ALL bindings must be specified on a per-environment basis.
|
|
59
|
+
# Docs: https://developers.cloudflare.com/pages/functions/wrangler-configuration#environment-specific-overrides
|
|
60
|
+
|
|
61
|
+
######## PREVIEW environment config ########
|
|
62
|
+
|
|
63
|
+
# [env.preview.vars]
|
|
64
|
+
# API_KEY = "xyz789"
|
|
65
|
+
|
|
66
|
+
# [[env.preview.kv_namespaces]]
|
|
67
|
+
# binding = "MY_KV_NAMESPACE"
|
|
68
|
+
# id = "<PREVIEW_NAMESPACE_ID>"
|
|
69
|
+
|
|
70
|
+
######## PRODUCTION environment config ########
|
|
71
|
+
|
|
72
|
+
# [env.production.vars]
|
|
73
|
+
# API_KEY = "abc123"
|
|
74
|
+
|
|
75
|
+
# [[env.production.kv_namespaces]]
|
|
76
|
+
# binding = "MY_KV_NAMESPACE"
|
|
77
|
+
# id = "<PRODUCTION_NAMESPACE_ID>"
|
package/templates/svelte/c3.ts
CHANGED
|
@@ -109,15 +109,15 @@ const config: TemplateConfig = {
|
|
|
109
109
|
configure,
|
|
110
110
|
transformPackageJson: async (original: PackageJson, ctx: C3Context) => {
|
|
111
111
|
let scripts: Record<string, string> = {
|
|
112
|
-
preview: `${npm} run build && wrangler pages dev
|
|
113
|
-
deploy: `${npm} run build && wrangler pages deploy
|
|
112
|
+
preview: `${npm} run build && wrangler pages dev`,
|
|
113
|
+
deploy: `${npm} run build && wrangler pages deploy`,
|
|
114
114
|
};
|
|
115
115
|
|
|
116
116
|
if (usesTypescript(ctx)) {
|
|
117
117
|
const mv = platform() === "win32" ? "move" : "mv";
|
|
118
118
|
scripts = {
|
|
119
119
|
...scripts,
|
|
120
|
-
"
|
|
120
|
+
"cf-typegen": `wrangler types && ${mv} worker-configuration.d.ts src/`,
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
#:schema node_modules/wrangler/config-schema.json
|
|
2
2
|
name = "<TBD>"
|
|
3
3
|
compatibility_date = "<TBD>"
|
|
4
|
+
pages_build_output_dir = ".svelte-kit/cloudflare"
|
|
4
5
|
|
|
5
6
|
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
7
|
+
# Docs:
|
|
8
|
+
# - https://developers.cloudflare.com/pages/functions/bindings/#environment-variables
|
|
6
9
|
# Note: Use secrets to store sensitive data.
|
|
7
|
-
#
|
|
10
|
+
# - https://developers.cloudflare.com/pages/functions/bindings/#secrets
|
|
8
11
|
# [vars]
|
|
9
12
|
# MY_VARIABLE = "production_value"
|
|
10
13
|
|
|
@@ -50,4 +53,26 @@ compatibility_date = "<TBD>"
|
|
|
50
53
|
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#service-bindings
|
|
51
54
|
# [[services]]
|
|
52
55
|
# binding = "MY_SERVICE"
|
|
53
|
-
# service = "my-service"
|
|
56
|
+
# service = "my-service"
|
|
57
|
+
|
|
58
|
+
# To use different bindings for preview and production environments, follow the examples below.
|
|
59
|
+
# When using environment-specific overrides for bindings, ALL bindings must be specified on a per-environment basis.
|
|
60
|
+
# Docs: https://developers.cloudflare.com/pages/functions/wrangler-configuration#environment-specific-overrides
|
|
61
|
+
|
|
62
|
+
######## PREVIEW environment config ########
|
|
63
|
+
|
|
64
|
+
# [env.preview.vars]
|
|
65
|
+
# API_KEY = "xyz789"
|
|
66
|
+
|
|
67
|
+
# [[env.preview.kv_namespaces]]
|
|
68
|
+
# binding = "MY_KV_NAMESPACE"
|
|
69
|
+
# id = "<PREVIEW_NAMESPACE_ID>"
|
|
70
|
+
|
|
71
|
+
######## PRODUCTION environment config ########
|
|
72
|
+
|
|
73
|
+
# [env.production.vars]
|
|
74
|
+
# API_KEY = "abc123"
|
|
75
|
+
|
|
76
|
+
# [[env.production.kv_namespaces]]
|
|
77
|
+
# binding = "MY_KV_NAMESPACE"
|
|
78
|
+
# id = "<PRODUCTION_NAMESPACE_ID>"
|