create-cloudflare 0.0.0-4e69fb6f0 → 0.0.0-4e7345e13
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 +246 -209
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/templates/analog/c3.ts +0 -24
- package/templates/analog/templates/env.d.ts +1 -1
- package/templates/angular/pages/c3.ts +3 -3
- package/templates/angular/pages/templates/wrangler.jsonc +5 -0
- package/templates/angular/workers/c3.ts +1 -0
- package/templates/astro/workers/templates/js/wrangler.jsonc +2 -1
- package/templates/astro/workers/templates/ts/wrangler.jsonc +2 -1
- package/templates/common/ts/tsconfig.json +0 -3
- package/templates/docusaurus/pages/c3.ts +1 -0
- package/templates/docusaurus/workers/c3.ts +1 -0
- package/templates/gatsby/pages/c3.ts +1 -0
- package/templates/gatsby/workers/c3.ts +1 -0
- package/templates/hello-world/js/package.json +1 -1
- package/templates/hello-world/py/README.md +2 -2
- package/templates/hello-world/py/pyproject.toml +1 -1
- package/templates/hello-world/py/src/entry.py +3 -2
- package/templates/hello-world/ts/package.json +1 -1
- package/templates/hello-world/ts/test/index.spec.ts +0 -1
- package/templates/hello-world/ts/test/tsconfig.json +1 -1
- package/templates/hello-world/ts/tsconfig.json +0 -2
- package/templates/hello-world-assets-only/c3.ts +2 -2
- package/templates/hello-world-assets-only/templates/public/index.html +1 -0
- package/templates/hello-world-assets-only/templates/wrangler.jsonc +1 -0
- package/templates/hello-world-durable-object/c3.ts +3 -0
- package/templates/hello-world-durable-object/py/.python-version +1 -0
- package/templates/hello-world-durable-object/py/README.md +23 -0
- package/templates/hello-world-durable-object/py/__dot__gitignore +68 -0
- package/templates/hello-world-durable-object/py/package.json +13 -0
- package/templates/hello-world-durable-object/py/pyproject.toml +9 -0
- package/templates/hello-world-durable-object/py/src/entry.py +66 -0
- package/templates/hello-world-durable-object/py/uv.lock +22 -0
- package/templates/hello-world-durable-object/py/wrangler.jsonc +27 -0
- package/templates/hello-world-durable-object/ts/tsconfig.json +0 -2
- package/templates/hello-world-durable-object-with-assets/c3.ts +3 -0
- package/templates/hello-world-durable-object-with-assets/js/public/index.html +1 -0
- package/templates/hello-world-durable-object-with-assets/js/wrangler.jsonc +1 -1
- package/templates/hello-world-durable-object-with-assets/py/.python-version +1 -0
- package/templates/hello-world-durable-object-with-assets/py/README.md +23 -0
- package/templates/hello-world-durable-object-with-assets/py/__dot__gitignore +68 -0
- package/templates/hello-world-durable-object-with-assets/py/package.json +13 -0
- package/templates/hello-world-durable-object-with-assets/py/public/index.html +20 -0
- package/templates/hello-world-durable-object-with-assets/py/pyproject.toml +9 -0
- package/templates/hello-world-durable-object-with-assets/py/src/entry.py +66 -0
- package/templates/hello-world-durable-object-with-assets/py/uv.lock +22 -0
- package/templates/hello-world-durable-object-with-assets/py/wrangler.jsonc +31 -0
- package/templates/hello-world-durable-object-with-assets/ts/public/index.html +1 -0
- package/templates/hello-world-durable-object-with-assets/ts/tsconfig.json +0 -2
- package/templates/hello-world-durable-object-with-assets/ts/wrangler.jsonc +1 -1
- package/templates/hello-world-with-assets/c3.ts +3 -2
- package/templates/hello-world-with-assets/js/package.json +1 -1
- package/templates/hello-world-with-assets/js/public/index.html +1 -0
- package/templates/hello-world-with-assets/js/wrangler.jsonc +3 -2
- package/templates/hello-world-with-assets/py/.python-version +1 -0
- package/templates/hello-world-with-assets/py/README.md +23 -0
- package/templates/hello-world-with-assets/py/public/index.html +1 -0
- package/templates/hello-world-with-assets/py/pyproject.toml +9 -0
- package/templates/hello-world-with-assets/py/src/entry.py +9 -7
- package/templates/hello-world-with-assets/py/uv.lock +22 -0
- package/templates/hello-world-with-assets/py/wrangler.jsonc +1 -1
- package/templates/hello-world-with-assets/ts/package.json +1 -1
- package/templates/hello-world-with-assets/ts/public/index.html +1 -0
- package/templates/hello-world-with-assets/ts/test/tsconfig.json +1 -1
- package/templates/hello-world-with-assets/ts/tsconfig.json +0 -2
- package/templates/hello-world-with-assets/ts/wrangler.jsonc +2 -2
- package/templates/hono/pages/c3.ts +4 -1
- package/templates/hono/workers/c3.ts +3 -1
- package/templates/next/pages/c3.ts +6 -10
- package/templates/next/workers/c3.ts +8 -11
- package/templates/next/workers/templates/open-next.config.ts +5 -2
- package/templates/next/workers/templates/wrangler.jsonc +2 -1
- package/templates/nuxt/pages/c3.ts +2 -26
- package/templates/nuxt/pages/templates/env.d.ts +1 -1
- package/templates/nuxt/workers/c3.ts +2 -26
- package/templates/nuxt/workers/templates/env.d.ts +1 -1
- package/templates/openapi/ts/__dot__gitignore +1 -0
- package/templates/openapi/ts/package.json +7 -6
- package/templates/openapi/ts/src/endpoints/taskCreate.ts +2 -2
- package/templates/openapi/ts/src/endpoints/taskDelete.ts +2 -2
- package/templates/openapi/ts/src/endpoints/taskFetch.ts +2 -2
- package/templates/openapi/ts/src/endpoints/taskList.ts +2 -2
- package/templates/openapi/ts/src/index.ts +4 -1
- package/templates/openapi/ts/src/types.ts +3 -0
- package/templates/openapi/ts/tsconfig.json +18 -21
- package/templates/pre-existing/c3.ts +1 -1
- package/templates/queues/ts/tsconfig.json +0 -2
- package/templates/qwik/pages/c3.ts +1 -0
- package/templates/qwik/workers/c3.ts +3 -4
- package/templates/qwik/workers/templates/wrangler.jsonc +2 -1
- package/templates/react/pages/c3.ts +4 -2
- package/templates/react/pages/templates/wrangler.jsonc +5 -0
- package/templates/react/workers/c3.ts +1 -1
- package/templates/react/workers/ts/tsconfig.worker.json +2 -2
- package/templates/react-router/c3.ts +0 -12
- package/templates/remix/pages/c3.ts +1 -0
- package/templates/remix/pages/templates/worker-configuration.d.ts +1 -1
- package/templates/remix/workers/c3.ts +1 -0
- package/templates/remix/workers/templates/wrangler.toml +1 -1
- package/templates/scheduled/ts/tsconfig.json +0 -2
- package/templates/solid/c3.ts +1 -0
- package/templates/svelte/pages/c3.ts +3 -3
- package/templates/svelte/workers/c3.ts +3 -3
- package/templates/vue/pages/c3.ts +5 -3
- package/templates/vue/pages/templates/wrangler.jsonc +5 -0
- package/templates/vue/workers/ts/tsconfig.worker.json +1 -1
- package/templates-experimental/solid/c3.ts +1 -1
- package/templates/analog/templates/worker-configuration.d.ts +0 -4
- package/templates/astro/workers/templates/ts/worker-configuration.d.ts +0 -4
- package/templates/common/ts/worker-configuration.d.ts +0 -4
- package/templates/hello-world/ts/worker-configuration.d.ts +0 -8
- package/templates/hello-world-durable-object/ts/worker-configuration.d.ts +0 -7
- package/templates/hello-world-durable-object-with-assets/ts/worker-configuration.d.ts +0 -8
- package/templates/hello-world-with-assets/ts/worker-configuration.d.ts +0 -7
- package/templates/hono/pages/templates/worker-configuration.d.ts +0 -4
- package/templates/hono/workers/templates/worker-configuration.d.ts +0 -4
- package/templates/next/pages/env.d.ts +0 -5
- package/templates/next/workers/templates/cloudflare-env.d.ts +0 -5
- package/templates/nuxt/pages/templates/worker-configuration.d.ts +0 -4
- package/templates/nuxt/workers/templates/worker-configuration.d.ts +0 -4
- package/templates/openapi/ts/worker-configuration.d.ts +0 -4
- package/templates/queues/ts/worker-configuration.d.ts +0 -5
- package/templates/react/workers/ts/worker-configuration.d.ts +0 -5
- package/templates/react-router/templates/worker-configuration.d.ts +0 -8
- package/templates/scheduled/ts/worker-configuration.d.ts +0 -4
- package/templates/vue/workers/ts/worker-configuration.d.ts +0 -6
|
@@ -3,8 +3,7 @@ import { brandColor, dim } from "@cloudflare/cli/colors";
|
|
|
3
3
|
import { spinner } from "@cloudflare/cli/interactive";
|
|
4
4
|
import { runFrameworkGenerator } from "frameworks/index";
|
|
5
5
|
import { mergeObjectProperties, transformFile } from "helpers/codemod";
|
|
6
|
-
import {
|
|
7
|
-
import { readFile, writeFile } from "helpers/files";
|
|
6
|
+
import { writeFile } from "helpers/files";
|
|
8
7
|
import { detectPackageManager } from "helpers/packageManagers";
|
|
9
8
|
import { installPackages } from "helpers/packages";
|
|
10
9
|
import * as recast from "recast";
|
|
@@ -30,7 +29,7 @@ const generate = async (ctx: C3Context) => {
|
|
|
30
29
|
logRaw(""); // newline
|
|
31
30
|
};
|
|
32
31
|
|
|
33
|
-
const configure = async (
|
|
32
|
+
const configure = async () => {
|
|
34
33
|
const packages = ["nitro-cloudflare-dev"];
|
|
35
34
|
|
|
36
35
|
// When using pnpm, explicitly add h3 package so the H3Event type declaration can be updated.
|
|
@@ -45,29 +44,6 @@ const configure = async (ctx: C3Context) => {
|
|
|
45
44
|
doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`,
|
|
46
45
|
});
|
|
47
46
|
updateNuxtConfig();
|
|
48
|
-
|
|
49
|
-
updateEnvTypes(ctx);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const updateEnvTypes = (ctx: C3Context) => {
|
|
53
|
-
const filepath = "env.d.ts";
|
|
54
|
-
|
|
55
|
-
const s = spinner();
|
|
56
|
-
s.start(`Updating ${filepath}`);
|
|
57
|
-
|
|
58
|
-
let file = readFile(filepath);
|
|
59
|
-
|
|
60
|
-
let typesEntrypoint = `@cloudflare/workers-types`;
|
|
61
|
-
const latestEntrypoint = getLatestTypesEntrypoint(ctx);
|
|
62
|
-
if (latestEntrypoint) {
|
|
63
|
-
typesEntrypoint += `/${latestEntrypoint}`;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Replace placeholder with actual types entrypoint
|
|
67
|
-
file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
|
|
68
|
-
writeFile("env.d.ts", file);
|
|
69
|
-
|
|
70
|
-
s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
|
|
71
47
|
};
|
|
72
48
|
|
|
73
49
|
const updateNuxtConfig = () => {
|
|
@@ -3,8 +3,7 @@ import { brandColor, dim } from "@cloudflare/cli/colors";
|
|
|
3
3
|
import { spinner } from "@cloudflare/cli/interactive";
|
|
4
4
|
import { runFrameworkGenerator } from "frameworks/index";
|
|
5
5
|
import { mergeObjectProperties, transformFile } from "helpers/codemod";
|
|
6
|
-
import {
|
|
7
|
-
import { readFile, writeFile } from "helpers/files";
|
|
6
|
+
import { writeFile } from "helpers/files";
|
|
8
7
|
import { detectPackageManager } from "helpers/packageManagers";
|
|
9
8
|
import { installPackages } from "helpers/packages";
|
|
10
9
|
import * as recast from "recast";
|
|
@@ -30,7 +29,7 @@ const generate = async (ctx: C3Context) => {
|
|
|
30
29
|
logRaw(""); // newline
|
|
31
30
|
};
|
|
32
31
|
|
|
33
|
-
const configure = async (
|
|
32
|
+
const configure = async () => {
|
|
34
33
|
const packages = ["nitro-cloudflare-dev", "nitropack"];
|
|
35
34
|
|
|
36
35
|
// When using pnpm, explicitly add h3 package so the H3Event type declaration can be updated.
|
|
@@ -45,29 +44,6 @@ const configure = async (ctx: C3Context) => {
|
|
|
45
44
|
doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`,
|
|
46
45
|
});
|
|
47
46
|
updateNuxtConfig();
|
|
48
|
-
|
|
49
|
-
updateEnvTypes(ctx);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const updateEnvTypes = (ctx: C3Context) => {
|
|
53
|
-
const filepath = "env.d.ts";
|
|
54
|
-
|
|
55
|
-
const s = spinner();
|
|
56
|
-
s.start(`Updating ${filepath}`);
|
|
57
|
-
|
|
58
|
-
let file = readFile(filepath);
|
|
59
|
-
|
|
60
|
-
let typesEntrypoint = `@cloudflare/workers-types`;
|
|
61
|
-
const latestEntrypoint = getLatestTypesEntrypoint(ctx);
|
|
62
|
-
if (latestEntrypoint) {
|
|
63
|
-
typesEntrypoint += `/${latestEntrypoint}`;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Replace placeholder with actual types entrypoint
|
|
67
|
-
file = file.replace("WORKERS_TYPES_ENTRYPOINT", typesEntrypoint);
|
|
68
|
-
writeFile("env.d.ts", file);
|
|
69
|
-
|
|
70
|
-
s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
|
|
71
47
|
};
|
|
72
48
|
|
|
73
49
|
const updateNuxtConfig = () => {
|
|
@@ -9,13 +9,14 @@
|
|
|
9
9
|
"cf-typegen": "wrangler types"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"chanfana": "^2.
|
|
13
|
-
"
|
|
14
|
-
"
|
|
12
|
+
"chanfana": "^2.6.3",
|
|
13
|
+
"hono": "^4.6.20",
|
|
14
|
+
"zod": "^3.24.1"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@types
|
|
18
|
-
"@types/
|
|
19
|
-
"
|
|
17
|
+
"@cloudflare/workers-types": "^4.20250129.0",
|
|
18
|
+
"@types/node": "22.13.0",
|
|
19
|
+
"@types/service-worker-mock": "^2.0.4",
|
|
20
|
+
"wrangler": "^3.107.2"
|
|
20
21
|
}
|
|
21
22
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Bool, OpenAPIRoute } from "chanfana";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { Task } from "../types";
|
|
3
|
+
import { type AppContext, Task } from "../types";
|
|
4
4
|
|
|
5
5
|
export class TaskCreate extends OpenAPIRoute {
|
|
6
6
|
schema = {
|
|
@@ -34,7 +34,7 @@ export class TaskCreate extends OpenAPIRoute {
|
|
|
34
34
|
},
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
async handle(c) {
|
|
37
|
+
async handle(c: AppContext) {
|
|
38
38
|
// Get validated data
|
|
39
39
|
const data = await this.getValidatedData<typeof this.schema>();
|
|
40
40
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Bool, OpenAPIRoute, Str } from "chanfana";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { Task } from "../types";
|
|
3
|
+
import { type AppContext, Task } from "../types";
|
|
4
4
|
|
|
5
5
|
export class TaskDelete extends OpenAPIRoute {
|
|
6
6
|
schema = {
|
|
@@ -30,7 +30,7 @@ export class TaskDelete extends OpenAPIRoute {
|
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
async handle(c) {
|
|
33
|
+
async handle(c: AppContext) {
|
|
34
34
|
// Get validated data
|
|
35
35
|
const data = await this.getValidatedData<typeof this.schema>();
|
|
36
36
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Bool, OpenAPIRoute, Str } from "chanfana";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { Task } from "../types";
|
|
3
|
+
import { type AppContext, Task } from "../types";
|
|
4
4
|
|
|
5
5
|
export class TaskFetch extends OpenAPIRoute {
|
|
6
6
|
schema = {
|
|
@@ -43,7 +43,7 @@ export class TaskFetch extends OpenAPIRoute {
|
|
|
43
43
|
},
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
async handle(c) {
|
|
46
|
+
async handle(c: AppContext) {
|
|
47
47
|
// Get validated data
|
|
48
48
|
const data = await this.getValidatedData<typeof this.schema>();
|
|
49
49
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Bool, Num, OpenAPIRoute } from "chanfana";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { Task } from "../types";
|
|
3
|
+
import { type AppContext, Task } from "../types";
|
|
4
4
|
|
|
5
5
|
export class TaskList extends OpenAPIRoute {
|
|
6
6
|
schema = {
|
|
@@ -37,7 +37,7 @@ export class TaskList extends OpenAPIRoute {
|
|
|
37
37
|
},
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
async handle(c) {
|
|
40
|
+
async handle(c: AppContext) {
|
|
41
41
|
// Get validated data
|
|
42
42
|
const data = await this.getValidatedData<typeof this.schema>();
|
|
43
43
|
|
|
@@ -6,7 +6,7 @@ import { TaskFetch } from "./endpoints/taskFetch";
|
|
|
6
6
|
import { TaskList } from "./endpoints/taskList";
|
|
7
7
|
|
|
8
8
|
// Start a Hono app
|
|
9
|
-
const app = new Hono();
|
|
9
|
+
const app = new Hono<{ Bindings: Env }>();
|
|
10
10
|
|
|
11
11
|
// Setup OpenAPI registry
|
|
12
12
|
const openapi = fromHono(app, {
|
|
@@ -19,5 +19,8 @@ openapi.post("/api/tasks", TaskCreate);
|
|
|
19
19
|
openapi.get("/api/tasks/:taskSlug", TaskFetch);
|
|
20
20
|
openapi.delete("/api/tasks/:taskSlug", TaskDelete);
|
|
21
21
|
|
|
22
|
+
// You may also register routes for non OpenAPI directly on Hono
|
|
23
|
+
// app.get('/test', (c) => c.text('Hono!'))
|
|
24
|
+
|
|
22
25
|
// Export the Hono app
|
|
23
26
|
export default app;
|
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
|
|
4
|
-
"allowSyntheticDefaultImports": true,
|
|
5
|
-
"baseUrl": "src",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"sourceMap": true,
|
|
3
|
+
/* Base Options: */
|
|
8
4
|
"esModuleInterop": true,
|
|
9
|
-
"inlineSourceMap": false,
|
|
10
|
-
"lib": ["esnext"],
|
|
11
|
-
"listEmittedFiles": false,
|
|
12
|
-
"listFiles": false,
|
|
13
|
-
"moduleResolution": "node",
|
|
14
|
-
"noFallthroughCasesInSwitch": true,
|
|
15
|
-
"pretty": true,
|
|
16
|
-
"resolveJsonModule": true,
|
|
17
|
-
"rootDir": ".",
|
|
18
5
|
"skipLibCheck": true,
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
6
|
+
"target": "es2022",
|
|
7
|
+
"verbatimModuleSyntax": false,
|
|
8
|
+
"allowJs": true,
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"moduleDetection": "force",
|
|
11
|
+
/* Strictness */
|
|
12
|
+
"noImplicitAny": false,
|
|
13
|
+
"noImplicitThis": true,
|
|
14
|
+
"strictNullChecks": false,
|
|
15
|
+
"strict": true,
|
|
16
|
+
"noUncheckedIndexedAccess": true,
|
|
17
|
+
/* If NOT transpiling with TypeScript: */
|
|
18
|
+
"moduleResolution": "Bundler",
|
|
19
|
+
"module": "es2022",
|
|
20
|
+
"noEmit": true,
|
|
21
|
+
"lib": ["es2022"],
|
|
24
22
|
"types": [
|
|
25
23
|
"@types/node",
|
|
26
24
|
"@types/service-worker-mock",
|
|
27
|
-
"@cloudflare/workers-types"
|
|
28
25
|
]
|
|
29
26
|
},
|
|
30
27
|
"exclude": ["node_modules", "dist", "tests"],
|
|
31
|
-
"include": ["src", "
|
|
28
|
+
"include": ["src", "worker-configuration.d.ts"]
|
|
32
29
|
}
|
|
@@ -13,8 +13,6 @@
|
|
|
13
13
|
"module": "es2022",
|
|
14
14
|
/* Specify how TypeScript looks up a file from a given module specifier. */
|
|
15
15
|
"moduleResolution": "node",
|
|
16
|
-
/* Specify type package names to be included without being referenced in a source file. */
|
|
17
|
-
"types": ["@cloudflare/workers-types"],
|
|
18
16
|
/* Enable importing .json files */
|
|
19
17
|
"resolveJsonModule": true,
|
|
20
18
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { endSection } from "@cloudflare/cli";
|
|
2
2
|
import { brandColor } from "@cloudflare/cli/colors";
|
|
3
3
|
import { spinner } from "@cloudflare/cli/interactive";
|
|
4
4
|
import { runFrameworkGenerator } from "frameworks/index";
|
|
@@ -24,8 +24,6 @@ const configure = async (ctx: C3Context) => {
|
|
|
24
24
|
await runCommand(cmd);
|
|
25
25
|
|
|
26
26
|
// Remove the extraneous Pages files
|
|
27
|
-
removeFile("./public/_headers");
|
|
28
|
-
removeFile("./public/_redirects");
|
|
29
27
|
removeFile("./public/_routes.json");
|
|
30
28
|
|
|
31
29
|
addBindingsProxy(ctx);
|
|
@@ -81,7 +79,7 @@ const addBindingsProxy = (ctx: C3Context) => {
|
|
|
81
79
|
}
|
|
82
80
|
|
|
83
81
|
if (configArgument.type !== "ObjectExpression") {
|
|
84
|
-
|
|
82
|
+
throw new Error("Failed to update `vite.config.ts`");
|
|
85
83
|
}
|
|
86
84
|
|
|
87
85
|
// Add the `platform` object to the object
|
|
@@ -150,5 +148,6 @@ const config: TemplateConfig = {
|
|
|
150
148
|
devScript: "dev",
|
|
151
149
|
deployScript: "deploy",
|
|
152
150
|
previewScript: "preview",
|
|
151
|
+
workersTypes: "installed",
|
|
153
152
|
};
|
|
154
153
|
export default config;
|
|
@@ -49,11 +49,13 @@ const config: TemplateConfig = {
|
|
|
49
49
|
platform: "pages",
|
|
50
50
|
hidden: true,
|
|
51
51
|
path: "templates/react/pages",
|
|
52
|
+
copyFiles: { path: "./templates" },
|
|
52
53
|
generate,
|
|
53
54
|
transformPackageJson: async () => ({
|
|
54
55
|
scripts: {
|
|
55
|
-
deploy: `${npm} run build && wrangler pages deploy
|
|
56
|
-
preview: `${npm} run build && wrangler pages dev
|
|
56
|
+
deploy: `${npm} run build && wrangler pages deploy`,
|
|
57
|
+
preview: `${npm} run build && wrangler pages dev`,
|
|
58
|
+
"cf-typegen": `wrangler types`,
|
|
57
59
|
},
|
|
58
60
|
}),
|
|
59
61
|
devScript: "dev",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"extends": "./tsconfig.node.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.worker.tsbuildinfo",
|
|
5
|
-
"types": ["
|
|
5
|
+
"types": ["./worker-configuration.d.ts", "vite/client"],
|
|
6
6
|
},
|
|
7
|
-
"include": ["worker"]
|
|
7
|
+
"include": ["./worker-configuration.d.ts", "./worker"]
|
|
8
8
|
}
|
|
@@ -19,24 +19,12 @@ const generate = async (ctx: C3Context) => {
|
|
|
19
19
|
logRaw(""); // newline
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
// TODO: Uncomment this once @react-router/dev updates its peer dependency to Wrangler v4
|
|
23
|
-
// const configure = async () => {
|
|
24
|
-
// await installPackages(["wrangler@latest"], {
|
|
25
|
-
// dev: true,
|
|
26
|
-
// startText: "Updating the Wrangler version",
|
|
27
|
-
// doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`,
|
|
28
|
-
// });
|
|
29
|
-
// };
|
|
30
|
-
|
|
31
22
|
const config: TemplateConfig = {
|
|
32
23
|
configVersion: 1,
|
|
33
24
|
id: "react-router",
|
|
34
25
|
platform: "workers",
|
|
35
26
|
frameworkCli: "create-react-router",
|
|
36
27
|
displayName: "React Router (formerly Remix)",
|
|
37
|
-
copyFiles: {
|
|
38
|
-
path: "./templates",
|
|
39
|
-
},
|
|
40
28
|
generate,
|
|
41
29
|
// configure,
|
|
42
30
|
transformPackageJson: async () => ({
|
|
@@ -8,4 +8,4 @@ assets = { directory = "./build/client" }
|
|
|
8
8
|
# Docs: https://developers.cloudflare.com/workers/observability/logs/workers-logs/
|
|
9
9
|
# Configuration: https://developers.cloudflare.com/workers/observability/logs/workers-logs/#enable-workers-logs
|
|
10
10
|
[observability]
|
|
11
|
-
enabled = true
|
|
11
|
+
enabled = true
|
|
@@ -13,8 +13,6 @@
|
|
|
13
13
|
"module": "es2022",
|
|
14
14
|
/* Specify how TypeScript looks up a file from a given module specifier. */
|
|
15
15
|
"moduleResolution": "node",
|
|
16
|
-
/* Specify type package names to be included without being referenced in a source file. */
|
|
17
|
-
"types": ["@cloudflare/workers-types"],
|
|
18
16
|
/* Enable importing .json files */
|
|
19
17
|
"resolveJsonModule": true,
|
|
20
18
|
|
package/templates/solid/c3.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
-
import { platform } from "node:os";
|
|
3
2
|
import { logRaw, updateStatus } from "@cloudflare/cli";
|
|
4
3
|
import { blue, brandColor, dim } from "@cloudflare/cli/colors";
|
|
5
4
|
import { runFrameworkGenerator } from "frameworks/index";
|
|
@@ -124,6 +123,7 @@ const updateTypeDefinitions = (ctx: C3Context) => {
|
|
|
124
123
|
});
|
|
125
124
|
};
|
|
126
125
|
|
|
126
|
+
const typesPath = "src/worker-configuration.d.ts";
|
|
127
127
|
const config: TemplateConfig = {
|
|
128
128
|
configVersion: 1,
|
|
129
129
|
id: "svelte",
|
|
@@ -144,10 +144,9 @@ const config: TemplateConfig = {
|
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
if (usesTypescript(ctx)) {
|
|
147
|
-
const mv = platform() === "win32" ? "move" : "mv";
|
|
148
147
|
scripts = {
|
|
149
148
|
...scripts,
|
|
150
|
-
"cf-typegen": `wrangler types
|
|
149
|
+
"cf-typegen": `wrangler types ${typesPath}`,
|
|
151
150
|
};
|
|
152
151
|
}
|
|
153
152
|
|
|
@@ -156,5 +155,6 @@ const config: TemplateConfig = {
|
|
|
156
155
|
devScript: "dev",
|
|
157
156
|
deployScript: "deploy",
|
|
158
157
|
previewScript: "preview",
|
|
158
|
+
typesPath,
|
|
159
159
|
};
|
|
160
160
|
export default config;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { platform } from "node:os";
|
|
2
1
|
import { logRaw, updateStatus } from "@cloudflare/cli";
|
|
3
2
|
import { blue, brandColor, dim } from "@cloudflare/cli/colors";
|
|
4
3
|
import { runFrameworkGenerator } from "frameworks/index";
|
|
@@ -94,6 +93,7 @@ const updateTypeDefinitions = (ctx: C3Context) => {
|
|
|
94
93
|
});
|
|
95
94
|
};
|
|
96
95
|
|
|
96
|
+
const typesPath = "./src/worker-configuration.d.ts";
|
|
97
97
|
const config: TemplateConfig = {
|
|
98
98
|
configVersion: 1,
|
|
99
99
|
id: "svelte",
|
|
@@ -113,10 +113,9 @@ const config: TemplateConfig = {
|
|
|
113
113
|
};
|
|
114
114
|
|
|
115
115
|
if (usesTypescript(ctx)) {
|
|
116
|
-
const mv = platform() === "win32" ? "move" : "mv";
|
|
117
116
|
scripts = {
|
|
118
117
|
...scripts,
|
|
119
|
-
"cf-typegen": `wrangler types
|
|
118
|
+
"cf-typegen": `wrangler types ${typesPath}`,
|
|
120
119
|
};
|
|
121
120
|
}
|
|
122
121
|
|
|
@@ -125,5 +124,6 @@ const config: TemplateConfig = {
|
|
|
125
124
|
devScript: "dev",
|
|
126
125
|
deployScript: "deploy",
|
|
127
126
|
previewScript: "preview",
|
|
127
|
+
typesPath,
|
|
128
128
|
};
|
|
129
129
|
export default config;
|
|
@@ -16,12 +16,14 @@ const config: TemplateConfig = {
|
|
|
16
16
|
displayName: "Vue",
|
|
17
17
|
platform: "pages",
|
|
18
18
|
hidden: true,
|
|
19
|
-
path: "templates/pages
|
|
19
|
+
path: "templates/vue/pages",
|
|
20
|
+
copyFiles: { path: "./templates" },
|
|
20
21
|
generate,
|
|
21
22
|
transformPackageJson: async () => ({
|
|
22
23
|
scripts: {
|
|
23
|
-
deploy: `${npm} run build && wrangler pages deploy
|
|
24
|
-
preview: `${npm} run build && wrangler pages dev
|
|
24
|
+
deploy: `${npm} run build && wrangler pages deploy`,
|
|
25
|
+
preview: `${npm} run build && wrangler pages dev`,
|
|
26
|
+
"cf-typegen": `wrangler types`,
|
|
25
27
|
},
|
|
26
28
|
}),
|
|
27
29
|
devScript: "dev",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"extends": "./tsconfig.node.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.worker.tsbuildinfo",
|
|
5
|
-
"types": [
|
|
5
|
+
"types": [ "./worker-configuration.d.ts","vite/client"],
|
|
6
6
|
},
|
|
7
7
|
"include": ["server"],
|
|
8
8
|
}
|
|
@@ -84,9 +84,9 @@ const config: TemplateConfig = {
|
|
|
84
84
|
scripts: {
|
|
85
85
|
preview: `${npm} run build && npx wrangler dev`,
|
|
86
86
|
deploy: `${npm} run build && wrangler deploy`,
|
|
87
|
+
"cf-typegen": `wrangler types`,
|
|
87
88
|
},
|
|
88
89
|
}),
|
|
89
|
-
compatibilityFlags: ["nodejs_compat"],
|
|
90
90
|
devScript: "dev",
|
|
91
91
|
deployScript: "deploy",
|
|
92
92
|
previewScript: "preview",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Generated by Wrangler by running `wrangler types --include-runtime=false` (hash: 2905fd8e181cd2f4083a615fa51f1913)
|
|
2
|
-
// After adding bindings to `wrangler.jsonc`, regenerate this interface via `npm run cf-typegen`
|
|
3
|
-
declare namespace Cloudflare {
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-interface,@typescript-eslint/no-empty-object-type
|
|
5
|
-
interface Env {
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
interface Env extends Cloudflare.Env {}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// Generated by Wrangler by running `wrangler types --include-runtime=false` (hash: 4c81d17e8de07f650cddf73ce751ba8d)
|
|
2
|
-
declare namespace Cloudflare {
|
|
3
|
-
interface Env {
|
|
4
|
-
MY_DURABLE_OBJECT: DurableObjectNamespace<import("./src/index").MyDurableObject>;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
interface Env extends Cloudflare.Env {}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Generated by Wrangler by running `wrangler types --include-runtime=false` (hash: 24be54e90498ce3774054fcb8bb2bc1a)
|
|
2
|
-
declare namespace Cloudflare {
|
|
3
|
-
interface Env {
|
|
4
|
-
MY_DURABLE_OBJECT: DurableObjectNamespace<import("./src/index").MyDurableObject>;
|
|
5
|
-
ASSETS: Fetcher;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
interface Env extends Cloudflare.Env {}
|