create-cloudflare 0.0.0-cddbaefe → 0.0.0-ce00a44c
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 +36329 -35742
- package/package.json +5 -3
- package/templates/angular/c3.ts +10 -9
- package/templates/astro/c3.ts +5 -13
- package/templates/astro/snippets/runtimeDeclaration.ts +2 -1
- package/templates/astro/templates/wrangler.toml +31 -28
- package/templates/common/js/.editorconfig +0 -1
- package/templates/common/js/wrangler.toml +69 -22
- package/templates/common/ts/.editorconfig +0 -1
- package/templates/common/ts/wrangler.toml +69 -22
- package/templates/docusaurus/c3.ts +5 -6
- package/templates/gatsby/c3.ts +7 -5
- package/templates/hello-world/js/.editorconfig +0 -1
- package/templates/hello-world/js/package.json +5 -2
- package/templates/hello-world/js/test/index.spec.js +20 -0
- package/templates/hello-world/js/vitest.config.js +11 -0
- package/templates/hello-world/js/wrangler.toml +70 -22
- package/templates/hello-world/ts/.editorconfig +0 -1
- package/templates/hello-world/ts/package.json +5 -2
- package/templates/hello-world/ts/test/index.spec.ts +25 -0
- package/templates/hello-world/ts/test/tsconfig.json +11 -0
- package/templates/hello-world/ts/tsconfig.json +3 -2
- package/templates/hello-world/ts/vitest.config.ts +11 -0
- package/templates/hello-world/ts/wrangler.toml +70 -22
- package/templates/hello-world-durable-object/js/.editorconfig +0 -1
- package/templates/hello-world-durable-object/js/wrangler.toml +70 -23
- package/templates/hello-world-durable-object/ts/.editorconfig +0 -1
- package/templates/hello-world-durable-object/ts/wrangler.toml +69 -21
- package/templates/hello-world-python/c3.ts +9 -0
- package/templates/hello-world-python/py/__dot__gitignore +68 -0
- package/templates/hello-world-python/py/package.json +13 -0
- package/templates/hello-world-python/py/src/entry.py +4 -0
- package/templates/hello-world-python/py/wrangler.toml +5 -0
- package/templates/hono/c3.ts +1 -1
- package/templates/next/README.md +11 -1
- package/templates/next/app/js/app/api/hello/route.js +1 -1
- package/templates/next/app/ts/app/api/hello/route.ts +1 -1
- package/templates/next/c3.ts +29 -19
- package/templates/next/env.d.ts +3 -5
- package/templates/next/pages/js/pages/api/hello.js +1 -1
- package/templates/next/pages/ts/pages/api/hello.ts +1 -1
- package/templates/next/wrangler.toml +30 -32
- package/templates/nuxt/c3.ts +7 -5
- package/templates/nuxt/templates/worker-configuration.d.ts +3 -2
- package/templates/nuxt/templates/wrangler.toml +31 -28
- package/templates/openapi/ts/wrangler.toml +1 -0
- package/templates/pre-existing/c3.ts +2 -2
- package/templates/pre-existing/js/.editorconfig +0 -1
- package/templates/pre-existing/js/wrangler.toml +1 -0
- package/templates/queues/js/.editorconfig +0 -1
- package/templates/queues/js/wrangler.toml +86 -2
- package/templates/queues/ts/.editorconfig +0 -1
- package/templates/queues/ts/wrangler.toml +86 -2
- package/templates/qwik/c3.ts +6 -5
- package/templates/qwik/templates/worker-configuration.d.ts +3 -2
- package/templates/qwik/templates/wrangler.toml +31 -28
- package/templates/react/c3.ts +7 -5
- package/templates/remix/c3.ts +3 -4
- package/templates/remix/templates/worker-configuration.d.ts +3 -2
- package/templates/remix/templates/wrangler.toml +31 -28
- package/templates/scheduled/js/.editorconfig +0 -1
- package/templates/scheduled/js/wrangler.toml +95 -0
- package/templates/scheduled/ts/.editorconfig +0 -1
- package/templates/scheduled/ts/wrangler.toml +95 -0
- package/templates/solid/c3.ts +7 -5
- package/templates/svelte/c3.ts +3 -2
- package/templates/svelte/js/wrangler.toml +31 -28
- package/templates/svelte/ts/wrangler.toml +31 -28
- package/templates/vue/c3.ts +7 -6
- package/templates/svelte/js/src/hooks.server.js +0 -25
- package/templates/svelte/ts/src/hooks.server.ts +0 -24
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
|
|
3
|
+
logs
|
|
4
|
+
_.log
|
|
5
|
+
npm-debug.log_
|
|
6
|
+
yarn-debug.log*
|
|
7
|
+
yarn-error.log*
|
|
8
|
+
lerna-debug.log*
|
|
9
|
+
.pnpm-debug.log*
|
|
10
|
+
|
|
11
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
12
|
+
|
|
13
|
+
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
|
|
14
|
+
|
|
15
|
+
# Runtime data
|
|
16
|
+
|
|
17
|
+
pids
|
|
18
|
+
_.pid
|
|
19
|
+
_.seed
|
|
20
|
+
\*.pid.lock
|
|
21
|
+
|
|
22
|
+
# Dependency directories
|
|
23
|
+
|
|
24
|
+
node_modules/
|
|
25
|
+
jspm_packages/
|
|
26
|
+
|
|
27
|
+
# TypeScript cache
|
|
28
|
+
|
|
29
|
+
\*.tsbuildinfo
|
|
30
|
+
|
|
31
|
+
# Optional npm cache directory
|
|
32
|
+
|
|
33
|
+
.npm
|
|
34
|
+
|
|
35
|
+
# Optional eslint cache
|
|
36
|
+
|
|
37
|
+
.eslintcache
|
|
38
|
+
|
|
39
|
+
# Optional stylelint cache
|
|
40
|
+
|
|
41
|
+
.stylelintcache
|
|
42
|
+
|
|
43
|
+
# Optional REPL history
|
|
44
|
+
|
|
45
|
+
.node_repl_history
|
|
46
|
+
|
|
47
|
+
# Output of 'npm pack'
|
|
48
|
+
|
|
49
|
+
\*.tgz
|
|
50
|
+
|
|
51
|
+
# dotenv environment variable files
|
|
52
|
+
|
|
53
|
+
.env
|
|
54
|
+
.env.development.local
|
|
55
|
+
.env.test.local
|
|
56
|
+
.env.production.local
|
|
57
|
+
.env.local
|
|
58
|
+
|
|
59
|
+
# public
|
|
60
|
+
|
|
61
|
+
# Stores VSCode versions used for testing VSCode extensions
|
|
62
|
+
|
|
63
|
+
.vscode-test
|
|
64
|
+
|
|
65
|
+
# wrangler project
|
|
66
|
+
|
|
67
|
+
.dev.vars
|
|
68
|
+
.wrangler/
|
package/templates/hono/c3.ts
CHANGED
package/templates/next/README.md
CHANGED
|
@@ -52,7 +52,17 @@ In order to enable the example:
|
|
|
52
52
|
```
|
|
53
53
|
# KV Example:
|
|
54
54
|
```
|
|
55
|
+
- If you're using TypeScript run the `build-cf-types` script to update the `env.d.ts` file:
|
|
56
|
+
```bash
|
|
57
|
+
npm run build-cf-types
|
|
58
|
+
# or
|
|
59
|
+
yarn build-cf-types
|
|
60
|
+
# or
|
|
61
|
+
pnpm build-cf-types
|
|
62
|
+
# or
|
|
63
|
+
bun build-cf-types
|
|
64
|
+
```
|
|
55
65
|
|
|
56
66
|
After doing this you can run the `dev` or `preview` script and visit the `/api/hello` route to see the example in action.
|
|
57
67
|
|
|
58
|
-
Finally, if you also want to see the example work in the deployed application make sure to add a `
|
|
68
|
+
Finally, if you also want to see the example work in the deployed application make sure to add a `MY_KV_NAMESPACE` binding to your Pages application in its [dashboard kv bindings settings section](https://dash.cloudflare.com/?to=/:account/pages/view/:pages-project/settings/functions#kv_namespace_bindings_section). After having configured it make sure to re-deploy your application.
|
|
@@ -12,7 +12,7 @@ export async function GET(request) {
|
|
|
12
12
|
// )
|
|
13
13
|
//
|
|
14
14
|
// KV Example:
|
|
15
|
-
// const myKv = getRequestContext().env.
|
|
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
18
|
// responseText += suffix
|
|
@@ -13,7 +13,7 @@ export async function GET(request: NextRequest) {
|
|
|
13
13
|
// )
|
|
14
14
|
//
|
|
15
15
|
// KV Example:
|
|
16
|
-
// const myKv = getRequestContext().env.
|
|
16
|
+
// const myKv = getRequestContext().env.MY_KV_NAMESPACE
|
|
17
17
|
// await myKv.put('suffix', ' from a KV store!')
|
|
18
18
|
// const suffix = await myKv.get('suffix')
|
|
19
19
|
// responseText += suffix
|
package/templates/next/c3.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { crash, updateStatus, warn } from "@cloudflare/cli";
|
|
|
3
3
|
import { processArgument } from "@cloudflare/cli/args";
|
|
4
4
|
import { brandColor, dim } from "@cloudflare/cli/colors";
|
|
5
5
|
import { spinner } from "@cloudflare/cli/interactive";
|
|
6
|
-
import {
|
|
6
|
+
import { runFrameworkGenerator } from "frameworks/index";
|
|
7
7
|
import {
|
|
8
8
|
copyFile,
|
|
9
9
|
probePaths,
|
|
@@ -14,7 +14,8 @@ import {
|
|
|
14
14
|
writeFile,
|
|
15
15
|
writeJSON,
|
|
16
16
|
} from "helpers/files";
|
|
17
|
-
import { detectPackageManager } from "helpers/
|
|
17
|
+
import { detectPackageManager } from "helpers/packageManagers";
|
|
18
|
+
import { installPackages } from "helpers/packages";
|
|
18
19
|
import { getTemplatePath } from "../../src/templates";
|
|
19
20
|
import type { TemplateConfig } from "../../src/templates";
|
|
20
21
|
import type { C3Args, C3Context } from "types";
|
|
@@ -26,10 +27,26 @@ const generate = async (ctx: C3Context) => {
|
|
|
26
27
|
|
|
27
28
|
await runFrameworkGenerator(ctx, [projectName]);
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const wranglerToml = readFile(join(getTemplatePath(ctx), "wrangler.toml"));
|
|
31
|
+
|
|
32
|
+
// Note: here we add `# KV Example:` to the toml file for the KV example, we don't actually
|
|
33
|
+
// include the comment in the template wrangler.toml file just so to keep it identical
|
|
34
|
+
// and consistent with that of all the other frameworks
|
|
35
|
+
// (instead of making it a special case which needs extra care)
|
|
36
|
+
const newTomlContent = wranglerToml.replace(
|
|
37
|
+
/#\s+\[\[kv_namespaces\]\]\n#\s+binding\s+=\s+"MY_KV_NAMESPACE"\n#\s+id\s+=\s+"[a-zA-Z0-9]+?"/,
|
|
38
|
+
($1) => `# KV Example:\n${$1}`
|
|
32
39
|
);
|
|
40
|
+
|
|
41
|
+
if (!/# KV Example/.test(newTomlContent)) {
|
|
42
|
+
// This should never happen to users, it is a check mostly so that
|
|
43
|
+
// if the toml file is changed in a way that breaks the "KV Example" addition
|
|
44
|
+
// the C3 Next.js e2e runs will fail with this
|
|
45
|
+
crash("Failed to properly generate the wrangler.toml file");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
writeFile(join(ctx.project.path, "wrangler.toml"), newTomlContent);
|
|
49
|
+
|
|
33
50
|
updateStatus("Created wrangler.toml file");
|
|
34
51
|
};
|
|
35
52
|
|
|
@@ -158,9 +175,6 @@ export default {
|
|
|
158
175
|
id: "next",
|
|
159
176
|
platform: "pages",
|
|
160
177
|
displayName: "Next",
|
|
161
|
-
devScript: "dev",
|
|
162
|
-
previewScript: "preview",
|
|
163
|
-
deployScript: "deploy",
|
|
164
178
|
generate,
|
|
165
179
|
configure,
|
|
166
180
|
copyFiles: {
|
|
@@ -194,7 +208,7 @@ export default {
|
|
|
194
208
|
},
|
|
195
209
|
},
|
|
196
210
|
},
|
|
197
|
-
transformPackageJson: async () => {
|
|
211
|
+
transformPackageJson: async (_, ctx) => {
|
|
198
212
|
const isNpm = npm === "npm";
|
|
199
213
|
const isBun = npm === "bun";
|
|
200
214
|
const isNpmOrBun = isNpm || isBun;
|
|
@@ -209,18 +223,14 @@ export default {
|
|
|
209
223
|
"pages:build": `${pmCommand} ${nextOnPagesCommand}`,
|
|
210
224
|
preview: `${pagesBuildRunCommand} && wrangler pages dev .vercel/output/static`,
|
|
211
225
|
deploy: `${pagesBuildRunCommand} && wrangler pages deploy .vercel/output/static`,
|
|
226
|
+
...(usesTypescript(ctx) && {
|
|
227
|
+
"build-cf-types": `wrangler types --env-interface CloudflareEnv env.d.ts`,
|
|
228
|
+
}),
|
|
212
229
|
},
|
|
213
230
|
};
|
|
214
231
|
},
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
"--eslint",
|
|
219
|
-
"--tailwind",
|
|
220
|
-
"--src-dir",
|
|
221
|
-
"--app",
|
|
222
|
-
"--import-alias",
|
|
223
|
-
"@/*",
|
|
224
|
-
],
|
|
232
|
+
devScript: "dev",
|
|
233
|
+
previewScript: "preview",
|
|
234
|
+
deployScript: "deploy",
|
|
225
235
|
compatibilityFlags: ["nodejs_compat"],
|
|
226
236
|
} as TemplateConfig;
|
package/templates/next/env.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
// Generated by Wrangler
|
|
2
|
+
// by running `wrangler types --env-interface CloudflareEnv env.d.ts`
|
|
3
|
+
|
|
1
4
|
interface CloudflareEnv {
|
|
2
|
-
// Add here the Cloudflare Bindings you want to have available in your application
|
|
3
|
-
// (for more details on Bindings see: https://developers.cloudflare.com/pages/functions/bindings/)
|
|
4
|
-
//
|
|
5
|
-
// KV Example:
|
|
6
|
-
// MY_KV: KVNamespace
|
|
7
5
|
}
|
|
@@ -14,7 +14,7 @@ export default async function handler(req) {
|
|
|
14
14
|
// )
|
|
15
15
|
//
|
|
16
16
|
// KV Example:
|
|
17
|
-
// const myKv = getRequestContext().env.
|
|
17
|
+
// const myKv = getRequestContext().env.MY_KV_NAMESPACE
|
|
18
18
|
// await myKv.put('suffix', ' from a KV store!')
|
|
19
19
|
// const suffix = await myKv.get('suffix')
|
|
20
20
|
// responseText += suffix
|
|
@@ -15,7 +15,7 @@ export default async function handler(req: NextRequest) {
|
|
|
15
15
|
// )
|
|
16
16
|
//
|
|
17
17
|
// KV Example:
|
|
18
|
-
// const myKv = getRequestContext().env.
|
|
18
|
+
// const myKv = getRequestContext().env.MY_KV_NAMESPACE
|
|
19
19
|
// await myKv.put('suffix', ' from a KV store!')
|
|
20
20
|
// const suffix = await myKv.get('suffix')
|
|
21
21
|
// responseText += suffix
|
|
@@ -1,57 +1,55 @@
|
|
|
1
|
+
#:schema node_modules/wrangler/config-schema.json
|
|
1
2
|
name = "<TBD>"
|
|
2
3
|
compatibility_date = "<TBD>"
|
|
3
|
-
|
|
4
4
|
compatibility_flags = ["nodejs_compat"]
|
|
5
5
|
|
|
6
6
|
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
7
7
|
# Note: Use secrets to store sensitive data.
|
|
8
|
-
# Docs: https://developers.cloudflare.com/
|
|
8
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#environment-variables
|
|
9
9
|
# [vars]
|
|
10
10
|
# MY_VARIABLE = "production_value"
|
|
11
11
|
|
|
12
|
+
# Bind the Workers AI model catalog. Run machine learning models, powered by serverless GPUs, on Cloudflare’s global network
|
|
13
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#workers-ai
|
|
14
|
+
# [ai]
|
|
15
|
+
# binding = "AI"
|
|
16
|
+
|
|
17
|
+
# Bind a D1 database. D1 is Cloudflare’s native serverless SQL database.
|
|
18
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#d1-databases
|
|
19
|
+
# [[d1_databases]]
|
|
20
|
+
# binding = "MY_DB"
|
|
21
|
+
# database_name = "my-database"
|
|
22
|
+
# database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
23
|
+
|
|
24
|
+
# Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
|
|
25
|
+
# Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
|
|
26
|
+
# Docs: https://developers.cloudflare.com/workers/runtime-apis/durable-objects
|
|
27
|
+
# [[durable_objects.bindings]]
|
|
28
|
+
# name = "MY_DURABLE_OBJECT"
|
|
29
|
+
# class_name = "MyDurableObject"
|
|
30
|
+
# script_name = 'my-durable-object'
|
|
31
|
+
|
|
12
32
|
# Bind a KV Namespace. Use KV as persistent storage for small key-value pairs.
|
|
13
|
-
# Docs: https://developers.cloudflare.com/
|
|
33
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#kv-namespaces
|
|
14
34
|
# [[kv_namespaces]]
|
|
15
35
|
# binding = "MY_KV_NAMESPACE"
|
|
16
36
|
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
17
37
|
|
|
18
|
-
# Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
|
|
19
|
-
# Docs: https://developers.cloudflare.com/r2/api/workers/workers-api-usage/
|
|
20
|
-
# [[r2_buckets]]
|
|
21
|
-
# binding = "MY_BUCKET"
|
|
22
|
-
# bucket_name = "my-bucket"
|
|
23
|
-
|
|
24
38
|
# Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
|
|
25
|
-
# Docs: https://developers.cloudflare.com/
|
|
39
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#queue-producers
|
|
26
40
|
# [[queues.producers]]
|
|
27
41
|
# binding = "MY_QUEUE"
|
|
28
42
|
# queue = "my-queue"
|
|
29
43
|
|
|
30
|
-
# Bind
|
|
31
|
-
# Docs: https://developers.cloudflare.com/
|
|
32
|
-
# [[
|
|
33
|
-
#
|
|
44
|
+
# Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
|
|
45
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#r2-buckets
|
|
46
|
+
# [[r2_buckets]]
|
|
47
|
+
# binding = "MY_BUCKET"
|
|
48
|
+
# bucket_name = "my-bucket"
|
|
34
49
|
|
|
35
50
|
# Bind another Worker service. Use this binding to call another Worker without network overhead.
|
|
36
|
-
# Docs: https://developers.cloudflare.com/
|
|
51
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#service-bindings
|
|
37
52
|
# [[services]]
|
|
38
53
|
# binding = "MY_SERVICE"
|
|
39
54
|
# service = "my-service"
|
|
40
55
|
|
|
41
|
-
# Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
|
|
42
|
-
# Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
|
|
43
|
-
# Docs: https://developers.cloudflare.com/workers/runtime-apis/durable-objects
|
|
44
|
-
# [[durable_objects.bindings]]
|
|
45
|
-
# name = "MY_DURABLE_OBJECT"
|
|
46
|
-
# class_name = "MyDurableObject"
|
|
47
|
-
|
|
48
|
-
# Durable Object migrations.
|
|
49
|
-
# Docs: https://developers.cloudflare.com/workers/learning/using-durable-objects#configure-durable-object-classes-with-migrations
|
|
50
|
-
# [[migrations]]
|
|
51
|
-
# tag = "v1"
|
|
52
|
-
# new_classes = ["MyDurableObject"]
|
|
53
|
-
|
|
54
|
-
# KV Example:
|
|
55
|
-
# [[kv_namespaces]]
|
|
56
|
-
# binding = "MY_KV"
|
|
57
|
-
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
package/templates/nuxt/c3.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { logRaw } from "@cloudflare/cli";
|
|
2
2
|
import { brandColor, dim } from "@cloudflare/cli/colors";
|
|
3
3
|
import { spinner } from "@cloudflare/cli/interactive";
|
|
4
|
+
import { runFrameworkGenerator } from "frameworks/index";
|
|
4
5
|
import { transformFile } from "helpers/codemod";
|
|
5
|
-
import {
|
|
6
|
+
import { getLatestTypesEntrypoint } from "helpers/compatDate";
|
|
6
7
|
import { readFile, writeFile } from "helpers/files";
|
|
7
|
-
import { detectPackageManager } from "helpers/
|
|
8
|
+
import { detectPackageManager } from "helpers/packageManagers";
|
|
9
|
+
import { installPackages } from "helpers/packages";
|
|
8
10
|
import * as recast from "recast";
|
|
9
|
-
import { getLatestTypesEntrypoint } from "../../src/workers";
|
|
10
11
|
import type { TemplateConfig } from "../../src/templates";
|
|
11
12
|
import type { C3Context } from "types";
|
|
12
13
|
|
|
@@ -117,8 +118,6 @@ const config: TemplateConfig = {
|
|
|
117
118
|
copyFiles: {
|
|
118
119
|
path: "./templates",
|
|
119
120
|
},
|
|
120
|
-
devScript: "dev",
|
|
121
|
-
deployScript: "deploy",
|
|
122
121
|
generate,
|
|
123
122
|
configure,
|
|
124
123
|
transformPackageJson: async () => ({
|
|
@@ -128,5 +127,8 @@ const config: TemplateConfig = {
|
|
|
128
127
|
"build-cf-types": `wrangler types`,
|
|
129
128
|
},
|
|
130
129
|
}),
|
|
130
|
+
devScript: "dev",
|
|
131
|
+
deployScript: "deploy",
|
|
132
|
+
previewScript: "preview",
|
|
131
133
|
};
|
|
132
134
|
export default config;
|
|
@@ -1,50 +1,53 @@
|
|
|
1
|
+
#:schema node_modules/wrangler/config-schema.json
|
|
1
2
|
name = "<TBD>"
|
|
2
3
|
compatibility_date = "<TBD>"
|
|
3
4
|
|
|
4
5
|
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
5
6
|
# Note: Use secrets to store sensitive data.
|
|
6
|
-
# Docs: https://developers.cloudflare.com/
|
|
7
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#environment-variables
|
|
7
8
|
# [vars]
|
|
8
9
|
# MY_VARIABLE = "production_value"
|
|
9
10
|
|
|
11
|
+
# Bind the Workers AI model catalog. Run machine learning models, powered by serverless GPUs, on Cloudflare’s global network
|
|
12
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#workers-ai
|
|
13
|
+
# [ai]
|
|
14
|
+
# binding = "AI"
|
|
15
|
+
|
|
16
|
+
# Bind a D1 database. D1 is Cloudflare’s native serverless SQL database.
|
|
17
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#d1-databases
|
|
18
|
+
# [[d1_databases]]
|
|
19
|
+
# binding = "MY_DB"
|
|
20
|
+
# database_name = "my-database"
|
|
21
|
+
# database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
22
|
+
|
|
23
|
+
# Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
|
|
24
|
+
# Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
|
|
25
|
+
# Docs: https://developers.cloudflare.com/workers/runtime-apis/durable-objects
|
|
26
|
+
# [[durable_objects.bindings]]
|
|
27
|
+
# name = "MY_DURABLE_OBJECT"
|
|
28
|
+
# class_name = "MyDurableObject"
|
|
29
|
+
# script_name = 'my-durable-object'
|
|
30
|
+
|
|
10
31
|
# Bind a KV Namespace. Use KV as persistent storage for small key-value pairs.
|
|
11
|
-
# Docs: https://developers.cloudflare.com/
|
|
32
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#kv-namespaces
|
|
12
33
|
# [[kv_namespaces]]
|
|
13
34
|
# binding = "MY_KV_NAMESPACE"
|
|
14
35
|
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
15
36
|
|
|
16
|
-
# Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
|
|
17
|
-
# Docs: https://developers.cloudflare.com/r2/api/workers/workers-api-usage/
|
|
18
|
-
# [[r2_buckets]]
|
|
19
|
-
# binding = "MY_BUCKET"
|
|
20
|
-
# bucket_name = "my-bucket"
|
|
21
|
-
|
|
22
37
|
# Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
|
|
23
|
-
# Docs: https://developers.cloudflare.com/
|
|
38
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#queue-producers
|
|
24
39
|
# [[queues.producers]]
|
|
25
40
|
# binding = "MY_QUEUE"
|
|
26
41
|
# queue = "my-queue"
|
|
27
42
|
|
|
28
|
-
# Bind
|
|
29
|
-
# Docs: https://developers.cloudflare.com/
|
|
30
|
-
# [[
|
|
31
|
-
#
|
|
43
|
+
# Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
|
|
44
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#r2-buckets
|
|
45
|
+
# [[r2_buckets]]
|
|
46
|
+
# binding = "MY_BUCKET"
|
|
47
|
+
# bucket_name = "my-bucket"
|
|
32
48
|
|
|
33
49
|
# Bind another Worker service. Use this binding to call another Worker without network overhead.
|
|
34
|
-
# Docs: https://developers.cloudflare.com/
|
|
50
|
+
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#service-bindings
|
|
35
51
|
# [[services]]
|
|
36
52
|
# binding = "MY_SERVICE"
|
|
37
|
-
# service = "my-service"
|
|
38
|
-
|
|
39
|
-
# Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
|
|
40
|
-
# Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
|
|
41
|
-
# Docs: https://developers.cloudflare.com/workers/runtime-apis/durable-objects
|
|
42
|
-
# [[durable_objects.bindings]]
|
|
43
|
-
# name = "MY_DURABLE_OBJECT"
|
|
44
|
-
# class_name = "MyDurableObject"
|
|
45
|
-
|
|
46
|
-
# Durable Object migrations.
|
|
47
|
-
# Docs: https://developers.cloudflare.com/workers/learning/using-durable-objects#configure-durable-object-classes-with-migrations
|
|
48
|
-
# [[migrations]]
|
|
49
|
-
# tag = "v1"
|
|
50
|
-
# new_classes = ["MyDurableObject"]
|
|
53
|
+
# service = "my-service"
|
|
@@ -4,8 +4,8 @@ import { join } from "path";
|
|
|
4
4
|
import { processArgument } from "@cloudflare/cli/args";
|
|
5
5
|
import { brandColor, dim } from "@cloudflare/cli/colors";
|
|
6
6
|
import { runCommand } from "helpers/command";
|
|
7
|
-
import { detectPackageManager } from "helpers/
|
|
8
|
-
import { chooseAccount } from "../../src/
|
|
7
|
+
import { detectPackageManager } from "helpers/packageManagers";
|
|
8
|
+
import { chooseAccount } from "../../src/wrangler/accounts";
|
|
9
9
|
import type { C3Context } from "types";
|
|
10
10
|
|
|
11
11
|
export async function copyExistingWorkerFiles(ctx: C3Context) {
|
|
@@ -1,15 +1,81 @@
|
|
|
1
|
+
#:schema node_modules/wrangler/config-schema.json
|
|
1
2
|
name = "<TBD>"
|
|
2
3
|
main = "src/index.js"
|
|
3
4
|
compatibility_date = "<TBD>"
|
|
4
5
|
|
|
6
|
+
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
7
|
+
# Note: Use secrets to store sensitive data.
|
|
8
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
|
|
9
|
+
# [vars]
|
|
10
|
+
# MY_VARIABLE = "production_value"
|
|
11
|
+
|
|
12
|
+
# Bind the Workers AI model catalog. Run machine learning models, powered by serverless GPUs, on Cloudflare’s global network
|
|
13
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#workers-ai
|
|
14
|
+
# [ai]
|
|
15
|
+
# binding = "AI"
|
|
16
|
+
|
|
17
|
+
# Bind an Analytics Engine dataset. Use Analytics Engine to write analytics within your Pages Function.
|
|
18
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#analytics-engine-datasets
|
|
19
|
+
# [[analytics_engine_datasets]]
|
|
20
|
+
# binding = "MY_DATASET"
|
|
21
|
+
|
|
22
|
+
# Bind a headless browser instance running on Cloudflare's global network.
|
|
23
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#browser-rendering
|
|
24
|
+
# [browser]
|
|
25
|
+
# binding = "MY_BROWSER"
|
|
26
|
+
|
|
27
|
+
# Bind a D1 database. D1 is Cloudflare’s native serverless SQL database.
|
|
28
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#d1-databases
|
|
29
|
+
# [[d1_databases]]
|
|
30
|
+
# binding = "MY_DB"
|
|
31
|
+
# database_name = "my-database"
|
|
32
|
+
# database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
33
|
+
|
|
34
|
+
# Bind a dispatch namespace. Use Workers for Platforms to deploy serverless functions programmatically on behalf of your customers.
|
|
35
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#dispatch-namespace-bindings-workers-for-platforms
|
|
36
|
+
# [[dispatch_namespaces]]
|
|
37
|
+
# binding = "MY_DISPATCHER"
|
|
38
|
+
# namespace = "my-namespace"
|
|
39
|
+
|
|
40
|
+
# Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
|
|
41
|
+
# Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
|
|
42
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
|
|
43
|
+
# [[durable_objects.bindings]]
|
|
44
|
+
# name = "MY_DURABLE_OBJECT"
|
|
45
|
+
# class_name = "MyDurableObject"
|
|
46
|
+
|
|
47
|
+
# Durable Object migrations.
|
|
48
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#migrations
|
|
49
|
+
# [[migrations]]
|
|
50
|
+
# tag = "v1"
|
|
51
|
+
# new_classes = ["MyDurableObject"]
|
|
52
|
+
|
|
53
|
+
# Bind a Hyperdrive configuration. Use to accelerate access to your existing databases from Cloudflare Workers.
|
|
54
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#hyperdrive
|
|
55
|
+
# [[hyperdrive]]
|
|
56
|
+
# binding = "MY_HYPERDRIVE"
|
|
57
|
+
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
58
|
+
|
|
59
|
+
# Bind a KV Namespace. Use KV as persistent storage for small key-value pairs.
|
|
60
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#kv-namespaces
|
|
61
|
+
# [[kv_namespaces]]
|
|
62
|
+
# binding = "MY_KV_NAMESPACE"
|
|
63
|
+
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
64
|
+
|
|
65
|
+
# Bind an mTLS certificate. Use to present a client certificate when communicating with another service.
|
|
66
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#mtls-certificates
|
|
67
|
+
# [[mtls_certificates]]
|
|
68
|
+
# binding = "MY_CERTIFICATE"
|
|
69
|
+
# certificate_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
70
|
+
|
|
5
71
|
# Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
|
|
6
|
-
# Docs: https://developers.cloudflare.com/queues
|
|
72
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#queues
|
|
7
73
|
[[queues.producers]]
|
|
8
74
|
binding = "MY_QUEUE"
|
|
9
75
|
queue = "my-queue"
|
|
10
76
|
|
|
11
77
|
# Bind a Queue consumer. Queue Consumers can retrieve tasks scheduled by Producers to act on them.
|
|
12
|
-
# Docs: https://developers.cloudflare.com/queues
|
|
78
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#queues
|
|
13
79
|
[[queues.consumers]]
|
|
14
80
|
queue = "my-queue"
|
|
15
81
|
# Optional: Configure batching and retries: https://developers.cloudflare.com/queues/learning/batching-retries/
|
|
@@ -17,3 +83,21 @@ queue = "my-queue"
|
|
|
17
83
|
# max_batch_timeout = 30
|
|
18
84
|
# max_retries = 10
|
|
19
85
|
# dead_letter_queue = "my-queue-dlq"
|
|
86
|
+
|
|
87
|
+
# Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
|
|
88
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#r2-buckets
|
|
89
|
+
# [[r2_buckets]]
|
|
90
|
+
# binding = "MY_BUCKET"
|
|
91
|
+
# bucket_name = "my-bucket"
|
|
92
|
+
|
|
93
|
+
# Bind another Worker service. Use this binding to call another Worker without network overhead.
|
|
94
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings
|
|
95
|
+
# [[services]]
|
|
96
|
+
# binding = "MY_SERVICE"
|
|
97
|
+
# service = "my-service"
|
|
98
|
+
|
|
99
|
+
# Bind a Vectorize index. Use to store and query vector embeddings for semantic search, classification and other vector search use-cases.
|
|
100
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#vectorize-indexes
|
|
101
|
+
# [[vectorize]]
|
|
102
|
+
# binding = "MY_INDEX"
|
|
103
|
+
# index_name = "my-index"
|