create-cloudflare 0.0.0-dfacbd46a → 0.0.0-dfea523ea
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 +56 -34
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/templates/angular/pages/c3.ts +1 -0
- package/templates/astro/pages/c3.ts +1 -0
- package/templates/astro/workers/templates/ts/wrangler.jsonc +1 -1
- package/templates/docusaurus/pages/c3.ts +1 -0
- package/templates/gatsby/pages/c3.ts +1 -0
- package/templates/hello-world-assets-only/c3.ts +2 -2
- package/templates/hello-world-with-assets/c3.ts +3 -2
- package/templates/hono/pages/c3.ts +1 -0
- package/templates/next/pages/c3.ts +1 -0
- package/templates/next/workers/c3.ts +4 -4
- package/templates/next/workers/templates/open-next.config.ts +5 -2
- package/templates/next/workers/templates/wrangler.jsonc +1 -1
- package/templates/nuxt/pages/c3.ts +1 -0
- package/templates/pre-existing/c3.ts +1 -1
- package/templates/qwik/pages/c3.ts +1 -0
- package/templates/react/pages/c3.ts +1 -0
- package/templates/react/workers/js/src/App.jsx +1 -1
- package/templates/react/workers/js/{api → worker}/index.js +1 -1
- package/templates/react/workers/js/wrangler.jsonc +2 -2
- package/templates/react/workers/ts/src/App.tsx +1 -1
- package/templates/react/workers/ts/tsconfig.worker.json +1 -1
- package/templates/react/workers/ts/{api → worker}/index.ts +2 -3
- package/templates/react/workers/ts/wrangler.jsonc +2 -2
- package/templates/remix/pages/c3.ts +1 -0
- package/templates/scheduled/ts/src/index.ts +7 -0
- package/templates/svelte/pages/c3.ts +1 -0
- package/templates/vue/pages/c3.ts +1 -0
- package/templates/vue/workers/js/server/index.js +2 -2
- package/templates/vue/workers/js/wrangler.jsonc +0 -1
- package/templates/vue/workers/ts/server/index.ts +2 -3
- package/templates/vue/workers/ts/wrangler.jsonc +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-cloudflare",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-dfea523ea",
|
|
4
4
|
"description": "A CLI for creating and deploying new applications to Cloudflare.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@babel/parser": "^7.21.3",
|
|
31
31
|
"@babel/types": "^7.21.4",
|
|
32
32
|
"@clack/prompts": "^0.6.3",
|
|
33
|
-
"@cloudflare/workers-types": "^4.
|
|
33
|
+
"@cloudflare/workers-types": "^4.20250410.0",
|
|
34
34
|
"@iarna/toml": "^3.0.0",
|
|
35
35
|
"@types/command-exists": "^1.2.0",
|
|
36
36
|
"@types/cross-spawn": "^6.0.2",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"degit": "^2.8.4",
|
|
53
53
|
"dns2": "^2.1.0",
|
|
54
54
|
"dotenv": "^16.0.0",
|
|
55
|
-
"esbuild": "0.
|
|
55
|
+
"esbuild": "0.25.2",
|
|
56
56
|
"execa": "^7.1.1",
|
|
57
57
|
"glob": "^10.3.3",
|
|
58
58
|
"haikunator": "^2.1.2",
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
"wrap-ansi": "^9.0.0",
|
|
71
71
|
"xdg-app-paths": "^8.3.0",
|
|
72
72
|
"yargs": "^17.7.2",
|
|
73
|
-
"@cloudflare/cli": "1.1.1",
|
|
74
73
|
"@cloudflare/eslint-config-worker": "1.1.0",
|
|
75
74
|
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
76
|
-
"
|
|
77
|
-
"
|
|
75
|
+
"@cloudflare/vite-plugin": "0.0.0-dfea523ea",
|
|
76
|
+
"wrangler": "0.0.0-dfea523ea",
|
|
77
|
+
"@cloudflare/cli": "1.1.1",
|
|
78
78
|
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
79
79
|
},
|
|
80
80
|
"engines": {
|
|
@@ -4,9 +4,9 @@ const config: TemplateConfig = {
|
|
|
4
4
|
configVersion: 1,
|
|
5
5
|
id: "hello-world-assets-only",
|
|
6
6
|
path: "templates/hello-world-assets-only",
|
|
7
|
-
displayName: "
|
|
7
|
+
displayName: "Static site",
|
|
8
8
|
description:
|
|
9
|
-
"For static sites
|
|
9
|
+
"For static sites or when using your own backend. Uses Workers Static Assets.",
|
|
10
10
|
platform: "workers",
|
|
11
11
|
copyFiles: {
|
|
12
12
|
path: "./templates",
|
|
@@ -4,8 +4,9 @@ const config: TemplateConfig = {
|
|
|
4
4
|
configVersion: 1,
|
|
5
5
|
id: "hello-world-with-assets",
|
|
6
6
|
path: "templates/hello-world-with-assets",
|
|
7
|
-
displayName: "
|
|
8
|
-
description:
|
|
7
|
+
displayName: "SSR / full-stack app",
|
|
8
|
+
description:
|
|
9
|
+
"For sites with a backend API, or server-side rendering (SSR). Uses Static Assets with a Worker.",
|
|
9
10
|
platform: "workers",
|
|
10
11
|
copyFiles: {
|
|
11
12
|
variants: {
|
|
@@ -12,7 +12,7 @@ const generate = async (ctx: C3Context) => {
|
|
|
12
12
|
|
|
13
13
|
const configure = async (ctx: C3Context) => {
|
|
14
14
|
const packages = [
|
|
15
|
-
"@opennextjs/cloudflare
|
|
15
|
+
"@opennextjs/cloudflare@~1.0.0-beta.0 || ^1.0.0",
|
|
16
16
|
"@cloudflare/workers-types",
|
|
17
17
|
];
|
|
18
18
|
await installPackages(packages, {
|
|
@@ -51,7 +51,7 @@ export default {
|
|
|
51
51
|
configVersion: 1,
|
|
52
52
|
id: "next",
|
|
53
53
|
frameworkCli: "create-next-app",
|
|
54
|
-
frameworkCliPinnedVersion: "~15.2.
|
|
54
|
+
frameworkCliPinnedVersion: "~15.2.4",
|
|
55
55
|
platform: "workers",
|
|
56
56
|
displayName: "Next.js (using Node.js compat + Workers Assets)",
|
|
57
57
|
path: "templates/next/workers",
|
|
@@ -62,8 +62,8 @@ export default {
|
|
|
62
62
|
configure,
|
|
63
63
|
transformPackageJson: async () => ({
|
|
64
64
|
scripts: {
|
|
65
|
-
deploy: `opennextjs-cloudflare &&
|
|
66
|
-
preview: `opennextjs-cloudflare &&
|
|
65
|
+
deploy: `opennextjs-cloudflare build && opennextjs-cloudflare deploy`,
|
|
66
|
+
preview: `opennextjs-cloudflare build && opennextjs-cloudflare preview`,
|
|
67
67
|
"cf-typegen": `wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts`,
|
|
68
68
|
},
|
|
69
69
|
}),
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { defineCloudflareConfig } from "@opennextjs/cloudflare";
|
|
2
|
-
import kvIncrementalCache from "@opennextjs/cloudflare/kv-cache";
|
|
3
2
|
|
|
4
3
|
export default defineCloudflareConfig({
|
|
5
|
-
|
|
4
|
+
// Uncomment to enable R2 cache,
|
|
5
|
+
// It should be imported as:
|
|
6
|
+
// `import r2IncrementalCache from "@opennextjs/cloudflare/overrides/incremental-cache/r2-incremental-cache";`
|
|
7
|
+
// See https://opennext.js.org/cloudflare/caching for more details
|
|
8
|
+
// incrementalCache: r2IncrementalCache,
|
|
6
9
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "<TBD>",
|
|
3
|
-
"main": "
|
|
3
|
+
"main": "worker/index.js",
|
|
4
4
|
"compatibility_date": "<TBD>",
|
|
5
|
-
"assets": { "not_found_handling": "single-page-application"
|
|
5
|
+
"assets": { "not_found_handling": "single-page-application" },
|
|
6
6
|
"observability": {
|
|
7
7
|
"enabled": true
|
|
8
8
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
fetch(request
|
|
2
|
+
fetch(request) {
|
|
3
3
|
const url = new URL(request.url);
|
|
4
4
|
|
|
5
5
|
if (url.pathname.startsWith("/api/")) {
|
|
@@ -7,7 +7,6 @@ export default {
|
|
|
7
7
|
name: "Cloudflare",
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
return env.ASSETS.fetch(request);
|
|
10
|
+
return new Response(null, { status: 404 });
|
|
12
11
|
},
|
|
13
12
|
} satisfies ExportedHandler<Env>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "<TBD>",
|
|
3
|
-
"main": "
|
|
3
|
+
"main": "worker/index.ts",
|
|
4
4
|
"compatibility_date": "<TBD>",
|
|
5
|
-
"assets": { "not_found_handling": "single-page-application"
|
|
5
|
+
"assets": { "not_found_handling": "single-page-application" },
|
|
6
6
|
"observability": {
|
|
7
7
|
"enabled": true
|
|
8
8
|
}
|
|
@@ -16,6 +16,13 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
export default {
|
|
19
|
+
async fetch(req) {
|
|
20
|
+
const url = new URL(req.url);
|
|
21
|
+
url.pathname = '/__scheduled';
|
|
22
|
+
url.searchParams.append('cron', '* * * * *');
|
|
23
|
+
return new Response(`To test the scheduled handler, ensure you have used the "--test-scheduled" then try running "curl ${url.href}".`);
|
|
24
|
+
},
|
|
25
|
+
|
|
19
26
|
// The scheduled handler is invoked at the interval set in our wrangler.jsonc's
|
|
20
27
|
// [[triggers]] configuration.
|
|
21
28
|
async scheduled(event, env, ctx): Promise<void> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
fetch(request
|
|
2
|
+
fetch(request) {
|
|
3
3
|
const url = new URL(request.url);
|
|
4
4
|
|
|
5
5
|
if (url.pathname.startsWith("/api/")) {
|
|
@@ -8,6 +8,6 @@ export default {
|
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
return
|
|
11
|
+
return new Response(null, { status: 404 });
|
|
12
12
|
},
|
|
13
13
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
fetch(request
|
|
2
|
+
fetch(request) {
|
|
3
3
|
const url = new URL(request.url);
|
|
4
4
|
|
|
5
5
|
if (url.pathname.startsWith("/api/")) {
|
|
@@ -7,7 +7,6 @@ export default {
|
|
|
7
7
|
name: "Cloudflare",
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
return env.ASSETS.fetch(request);
|
|
10
|
+
return new Response(null, { status: 404 });
|
|
12
11
|
},
|
|
13
12
|
} satisfies ExportedHandler<Env>;
|