create-cloudflare 0.0.0-b41c4edc → 0.0.0-b4ea661e
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 +810 -585
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +10 -10
- package/templates/analog/c3.ts +4 -4
- package/templates/analog/templates/wrangler.toml +7 -0
- package/templates/angular/c3.ts +2 -2
- package/templates/astro/c3.ts +3 -3
- package/templates/astro/templates/wrangler.toml +7 -0
- package/templates/common/js/wrangler.toml +7 -0
- package/templates/common/ts/src/ab-test.ts +2 -2
- package/templates/common/ts/src/index.ts +2 -2
- package/templates/common/ts/src/proxy.ts +2 -2
- package/templates/common/ts/src/redirect.ts +2 -2
- package/templates/common/ts/wrangler.toml +7 -0
- package/templates/hello-world/js/vitest.config.js +8 -8
- package/templates/hello-world/js/wrangler.toml +7 -0
- package/templates/hello-world/ts/src/index.ts +2 -2
- package/templates/hello-world/ts/test/tsconfig.json +6 -9
- package/templates/hello-world/ts/vitest.config.ts +8 -8
- package/templates/hello-world/ts/wrangler.toml +7 -0
- package/templates/hello-world-durable-object/c3.ts +1 -1
- package/templates/hello-world-durable-object/js/src/index.js +1 -1
- package/templates/hello-world-durable-object/js/wrangler.toml +8 -1
- package/templates/hello-world-durable-object/ts/src/index.ts +3 -3
- package/templates/hello-world-durable-object/ts/wrangler.toml +9 -2
- package/templates/hello-world-python/py/wrangler.toml +7 -0
- package/templates/hono/c3.ts +53 -0
- package/templates/hono/snippets/appDeclaration.ts +1 -0
- package/templates/hono/snippets/bindingsType.ts +3 -0
- package/templates/hono/templates/worker-configuration.d.ts +4 -0
- package/templates/hono/templates/wrangler.toml +107 -0
- package/templates/next/c3.ts +8 -6
- package/templates/next/wrangler.toml +7 -0
- package/templates/nuxt/c3.ts +8 -9
- package/templates/nuxt/templates/wrangler.toml +7 -0
- package/templates/openapi/ts/src/index.ts +1 -1
- package/templates/openapi/ts/wrangler.toml +7 -0
- package/templates/pre-existing/c3.ts +5 -5
- package/templates/queues/js/wrangler.toml +7 -0
- package/templates/queues/ts/src/index.ts +3 -3
- package/templates/queues/ts/wrangler.toml +7 -0
- package/templates/qwik/c3.ts +3 -3
- package/templates/qwik/templates/wrangler.toml +7 -0
- package/templates/remix/templates/wrangler.toml +7 -0
- package/templates/scheduled/js/package.json +2 -2
- package/templates/scheduled/js/src/index.js +8 -1
- package/templates/scheduled/js/wrangler.toml +7 -0
- package/templates/scheduled/ts/package.json +2 -2
- package/templates/scheduled/ts/src/index.ts +3 -3
- package/templates/scheduled/ts/wrangler.toml +7 -0
- package/templates/solid/c3.ts +11 -9
- package/templates/solid/templates/wrangler.toml +7 -0
- package/templates/svelte/c3.ts +6 -6
- package/templates/svelte/js/wrangler.toml +7 -0
- package/templates/svelte/ts/wrangler.toml +7 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* https://developers.cloudflare.com/workers/platform/triggers/cron-triggers/
|
|
7
7
|
*
|
|
8
8
|
* - Run `npm run dev` in your terminal to start a development server
|
|
9
|
-
* -
|
|
9
|
+
* - Run `curl "http://localhost:8787/__scheduled?cron=*+*+*+*+*"` to see your worker in action
|
|
10
10
|
* - Run `npm run deploy` to publish your worker
|
|
11
11
|
*
|
|
12
12
|
* Bind resources to your worker in `wrangler.toml`. After adding bindings, a type definition for the
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
export default {
|
|
19
19
|
// The scheduled handler is invoked at the interval set in our wrangler.toml's
|
|
20
20
|
// [[triggers]] configuration.
|
|
21
|
-
async scheduled(event
|
|
21
|
+
async scheduled(event, env, ctx): Promise<void> {
|
|
22
22
|
// A Cron Trigger can make requests to other endpoints on the Internet,
|
|
23
23
|
// publish to a Queue, query a D1 Database, and much more.
|
|
24
24
|
//
|
|
@@ -30,4 +30,4 @@ export default {
|
|
|
30
30
|
// In this template, we'll just log the result:
|
|
31
31
|
console.log(`trigger fired at ${event.cron}: ${wasSuccessful}`);
|
|
32
32
|
},
|
|
33
|
-
}
|
|
33
|
+
} satisfies ExportedHandler<Env>;
|
|
@@ -9,6 +9,13 @@ compatibility_date = "<TBD>"
|
|
|
9
9
|
[triggers]
|
|
10
10
|
crons = ["* * * * *"] # * * * * * = run every minute
|
|
11
11
|
|
|
12
|
+
# Automatically place your workloads in an optimal location to minimize latency.
|
|
13
|
+
# If you are running back-end logic in a Worker, running it closer to your back-end infrastructure
|
|
14
|
+
# rather than the end user may result in better performance.
|
|
15
|
+
# Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement
|
|
16
|
+
# [placement]
|
|
17
|
+
# mode = "smart"
|
|
18
|
+
|
|
12
19
|
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
13
20
|
# Docs:
|
|
14
21
|
# - https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
|
package/templates/solid/c3.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { logRaw, updateStatus } from "@cloudflare/cli";
|
|
2
2
|
import { blue } from "@cloudflare/cli/colors";
|
|
3
3
|
import { runFrameworkGenerator } from "frameworks/index";
|
|
4
|
-
import { transformFile } from "helpers/codemod";
|
|
4
|
+
import { mergeObjectProperties, transformFile } from "helpers/codemod";
|
|
5
5
|
import { usesTypescript } from "helpers/files";
|
|
6
6
|
import { detectPackageManager } from "helpers/packageManagers";
|
|
7
7
|
import * as recast from "recast";
|
|
@@ -32,28 +32,30 @@ const configure = async (ctx: C3Context) => {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const b = recast.types.builders;
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
|
|
36
|
+
mergeObjectProperties(
|
|
37
|
+
n.node.arguments[0] as recast.types.namedTypes.ObjectExpression,
|
|
38
|
+
[
|
|
37
39
|
b.objectProperty(
|
|
38
40
|
b.identifier("server"),
|
|
39
41
|
b.objectExpression([
|
|
40
42
|
b.objectProperty(
|
|
41
43
|
b.identifier("preset"),
|
|
42
|
-
b.stringLiteral("cloudflare-pages")
|
|
44
|
+
b.stringLiteral("cloudflare-pages"),
|
|
43
45
|
),
|
|
44
46
|
b.objectProperty(
|
|
45
47
|
b.identifier("rollupConfig"),
|
|
46
48
|
b.objectExpression([
|
|
47
49
|
b.objectProperty(
|
|
48
50
|
b.identifier("external"),
|
|
49
|
-
b.arrayExpression([b.stringLiteral("node:async_hooks")])
|
|
51
|
+
b.arrayExpression([b.stringLiteral("node:async_hooks")]),
|
|
50
52
|
),
|
|
51
|
-
])
|
|
53
|
+
]),
|
|
52
54
|
),
|
|
53
|
-
])
|
|
55
|
+
]),
|
|
54
56
|
),
|
|
55
|
-
]
|
|
56
|
-
|
|
57
|
+
],
|
|
58
|
+
);
|
|
57
59
|
|
|
58
60
|
return false;
|
|
59
61
|
},
|
|
@@ -4,6 +4,13 @@ compatibility_date = "<TBD>"
|
|
|
4
4
|
compatibility_flags = ["nodejs_compat"]
|
|
5
5
|
pages_build_output_dir = "./dist"
|
|
6
6
|
|
|
7
|
+
# Automatically place your workloads in an optimal location to minimize latency.
|
|
8
|
+
# If you are running back-end logic in a Pages Function, running it closer to your back-end infrastructure
|
|
9
|
+
# rather than the end user may result in better performance.
|
|
10
|
+
# Docs: https://developers.cloudflare.com/pages/functions/smart-placement/#smart-placement
|
|
11
|
+
# [placement]
|
|
12
|
+
# mode = "smart"
|
|
13
|
+
|
|
7
14
|
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
8
15
|
# Note: Use secrets to store sensitive data.
|
|
9
16
|
# Docs: https://developers.cloudflare.com/pages/functions/bindings/#environment-variables
|
package/templates/svelte/c3.ts
CHANGED
|
@@ -69,21 +69,21 @@ const updateTypeDefinitions = (ctx: C3Context) => {
|
|
|
69
69
|
b.tsInterfaceBody([
|
|
70
70
|
b.tsPropertySignature(
|
|
71
71
|
b.identifier("env"),
|
|
72
|
-
b.tsTypeAnnotation(b.tsTypeReference(b.identifier("Env")))
|
|
72
|
+
b.tsTypeAnnotation(b.tsTypeReference(b.identifier("Env"))),
|
|
73
73
|
),
|
|
74
74
|
b.tsPropertySignature(
|
|
75
75
|
b.identifier("cf"),
|
|
76
76
|
b.tsTypeAnnotation(
|
|
77
|
-
b.tsTypeReference(b.identifier("CfProperties"))
|
|
78
|
-
)
|
|
77
|
+
b.tsTypeReference(b.identifier("CfProperties")),
|
|
78
|
+
),
|
|
79
79
|
),
|
|
80
80
|
b.tsPropertySignature(
|
|
81
81
|
b.identifier("ctx"),
|
|
82
82
|
b.tsTypeAnnotation(
|
|
83
|
-
b.tsTypeReference(b.identifier("ExecutionContext"))
|
|
84
|
-
)
|
|
83
|
+
b.tsTypeReference(b.identifier("ExecutionContext")),
|
|
84
|
+
),
|
|
85
85
|
),
|
|
86
|
-
])
|
|
86
|
+
]),
|
|
87
87
|
);
|
|
88
88
|
|
|
89
89
|
moduleBlock.body.unshift(platformInterface);
|
|
@@ -3,6 +3,13 @@ name = "<TBD>"
|
|
|
3
3
|
compatibility_date = "<TBD>"
|
|
4
4
|
pages_build_output_dir = ".svelte-kit/cloudflare"
|
|
5
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
|
+
|
|
6
13
|
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
7
14
|
# Docs:
|
|
8
15
|
# - https://developers.cloudflare.com/pages/functions/bindings/#environment-variables
|
|
@@ -3,6 +3,13 @@ name = "<TBD>"
|
|
|
3
3
|
compatibility_date = "<TBD>"
|
|
4
4
|
pages_build_output_dir = ".svelte-kit/cloudflare"
|
|
5
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
|
+
|
|
6
13
|
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
7
14
|
# Docs:
|
|
8
15
|
# - https://developers.cloudflare.com/pages/functions/bindings/#environment-variables
|