create-cloudflare 0.0.0-bd00dc82 → 0.0.0-bd2031bd
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 +830 -696
- package/package.json +4 -4
- package/templates/analog/c3.ts +134 -0
- package/templates/analog/snippets/devBindingsModule.ts +7 -0
- package/templates/analog/templates/env.d.ts +13 -0
- package/templates/analog/templates/src/dev-bindings.ts +18 -0
- package/templates/analog/templates/worker-configuration.d.ts +4 -0
- package/templates/analog/templates/wrangler.toml +78 -0
- package/templates/astro/c3.ts +3 -3
- package/templates/astro/templates/wrangler.toml +28 -2
- package/templates/common/js/wrangler.toml +4 -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 +4 -1
- package/templates/hello-world/js/package.json +2 -1
- package/templates/hello-world/js/test/index.spec.js +17 -17
- package/templates/hello-world/js/wrangler.toml +4 -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 +4 -1
- package/templates/hello-world-durable-object/js/wrangler.toml +4 -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 +4 -2
- package/templates/hello-world-python/py/wrangler.toml +97 -0
- package/templates/next/README.md +5 -5
- package/templates/next/c3.ts +3 -3
- package/templates/next/wrangler.toml +26 -1
- package/templates/nuxt/c3.ts +4 -4
- package/templates/nuxt/templates/worker-configuration.d.ts +1 -1
- package/templates/nuxt/templates/wrangler.toml +28 -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 +97 -0
- package/templates/pre-existing/js/wrangler.toml +1 -0
- package/templates/queues/js/wrangler.toml +4 -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 +4 -1
- package/templates/qwik/c3.ts +3 -3
- package/templates/qwik/templates/worker-configuration.d.ts +1 -1
- package/templates/qwik/templates/wrangler.toml +28 -2
- package/templates/remix/c3.ts +3 -3
- package/templates/remix/templates/worker-configuration.d.ts +1 -1
- package/templates/remix/templates/wrangler.toml +28 -2
- package/templates/scheduled/js/wrangler.toml +5 -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 +5 -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 +28 -2
- package/templates/svelte/ts/wrangler.toml +28 -2
|
@@ -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.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#:schema node_modules/wrangler/config-schema.json
|
|
1
2
|
name = "<TBD>"
|
|
2
3
|
main = "src/index.ts"
|
|
3
4
|
compatibility_date = "<TBD>"
|
|
@@ -9,8 +10,10 @@ compatibility_date = "<TBD>"
|
|
|
9
10
|
crons = ["* * * * *"] # * * * * * = run every minute
|
|
10
11
|
|
|
11
12
|
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
13
|
+
# Docs:
|
|
14
|
+
# - https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
|
|
12
15
|
# Note: Use secrets to store sensitive data.
|
|
13
|
-
#
|
|
16
|
+
# - https://developers.cloudflare.com/workers/configuration/secrets/
|
|
14
17
|
# [vars]
|
|
15
18
|
# MY_VARIABLE = "production_value"
|
|
16
19
|
|
|
@@ -100,4 +103,4 @@ crons = ["* * * * *"] # * * * * * = run every minute
|
|
|
100
103
|
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#vectorize-indexes
|
|
101
104
|
# [[vectorize]]
|
|
102
105
|
# binding = "MY_INDEX"
|
|
103
|
-
# 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,9 +1,13 @@
|
|
|
1
|
+
#:schema node_modules/wrangler/config-schema.json
|
|
1
2
|
name = "<TBD>"
|
|
2
3
|
compatibility_date = "<TBD>"
|
|
4
|
+
pages_build_output_dir = ".svelte-kit/cloudflare"
|
|
3
5
|
|
|
4
6
|
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
7
|
+
# Docs:
|
|
8
|
+
# - https://developers.cloudflare.com/pages/functions/bindings/#environment-variables
|
|
5
9
|
# Note: Use secrets to store sensitive data.
|
|
6
|
-
#
|
|
10
|
+
# - https://developers.cloudflare.com/pages/functions/bindings/#secrets
|
|
7
11
|
# [vars]
|
|
8
12
|
# MY_VARIABLE = "production_value"
|
|
9
13
|
|
|
@@ -49,4 +53,26 @@ compatibility_date = "<TBD>"
|
|
|
49
53
|
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#service-bindings
|
|
50
54
|
# [[services]]
|
|
51
55
|
# binding = "MY_SERVICE"
|
|
52
|
-
# 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>"
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
#:schema node_modules/wrangler/config-schema.json
|
|
1
2
|
name = "<TBD>"
|
|
2
3
|
compatibility_date = "<TBD>"
|
|
4
|
+
pages_build_output_dir = ".svelte-kit/cloudflare"
|
|
3
5
|
|
|
4
6
|
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
7
|
+
# Docs:
|
|
8
|
+
# - https://developers.cloudflare.com/pages/functions/bindings/#environment-variables
|
|
5
9
|
# Note: Use secrets to store sensitive data.
|
|
6
|
-
#
|
|
10
|
+
# - https://developers.cloudflare.com/pages/functions/bindings/#secrets
|
|
7
11
|
# [vars]
|
|
8
12
|
# MY_VARIABLE = "production_value"
|
|
9
13
|
|
|
@@ -49,4 +53,26 @@ compatibility_date = "<TBD>"
|
|
|
49
53
|
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#service-bindings
|
|
50
54
|
# [[services]]
|
|
51
55
|
# binding = "MY_SERVICE"
|
|
52
|
-
# 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>"
|