create-cloudflare 2.57.1 → 2.59.0
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 +575 -653
- package/package.json +6 -6
- package/templates/analog/c3.ts +39 -61
- package/templates/analog/templates/wrangler.jsonc +10 -3
- package/templates/angular/pages/templates/wrangler.jsonc +2 -2
- package/templates/angular/workers/templates/wrangler.jsonc +2 -2
- package/templates/astro/pages/templates/js/wrangler.jsonc +2 -2
- package/templates/astro/pages/templates/ts/wrangler.jsonc +2 -2
- package/templates/astro/workers/templates/js/wrangler.jsonc +2 -2
- package/templates/astro/workers/templates/ts/wrangler.jsonc +2 -2
- package/templates/common/js/package.json +1 -1
- package/templates/common/js/wrangler.jsonc +2 -2
- package/templates/common/ts/package.json +1 -1
- package/templates/common/ts/tsconfig.json +2 -2
- package/templates/common/ts/wrangler.jsonc +2 -2
- package/templates/docusaurus/workers/templates/wrangler.jsonc +2 -2
- package/templates/gatsby/workers/templates/wrangler.jsonc +2 -2
- package/templates/hello-world/c3.ts +0 -12
- package/templates/hello-world/js/package.json +1 -1
- package/templates/hello-world/js/wrangler.jsonc +2 -2
- package/templates/hello-world/py/package.json +1 -1
- package/templates/hello-world/py/pyproject.toml +1 -1
- package/templates/hello-world/py/wrangler.jsonc +2 -2
- package/templates/hello-world/ts/package.json +1 -1
- package/templates/hello-world/ts/tsconfig.json +2 -2
- package/templates/hello-world/ts/wrangler.jsonc +2 -2
- package/templates/hello-world-assets-only/templates/package.json +1 -1
- package/templates/hello-world-assets-only/templates/wrangler.jsonc +2 -2
- package/templates/hello-world-durable-object/js/package.json +1 -1
- package/templates/hello-world-durable-object/js/wrangler.jsonc +2 -2
- package/templates/hello-world-durable-object/py/package.json +1 -1
- package/templates/hello-world-durable-object/py/pyproject.toml +1 -1
- package/templates/hello-world-durable-object/py/wrangler.jsonc +2 -2
- package/templates/hello-world-durable-object/ts/package.json +1 -1
- package/templates/hello-world-durable-object/ts/tsconfig.json +2 -2
- package/templates/hello-world-durable-object/ts/wrangler.jsonc +2 -2
- package/templates/hello-world-durable-object-with-assets/js/package.json +1 -1
- package/templates/hello-world-durable-object-with-assets/js/wrangler.jsonc +2 -2
- package/templates/hello-world-durable-object-with-assets/py/package.json +1 -1
- package/templates/hello-world-durable-object-with-assets/py/pyproject.toml +1 -1
- package/templates/hello-world-durable-object-with-assets/py/wrangler.jsonc +2 -2
- package/templates/hello-world-durable-object-with-assets/ts/package.json +1 -1
- package/templates/hello-world-durable-object-with-assets/ts/tsconfig.json +2 -2
- package/templates/hello-world-durable-object-with-assets/ts/wrangler.jsonc +2 -2
- package/templates/hello-world-with-assets/js/package.json +1 -1
- package/templates/hello-world-with-assets/js/wrangler.jsonc +2 -2
- package/templates/hello-world-with-assets/py/package.json +1 -1
- package/templates/hello-world-with-assets/py/pyproject.toml +1 -1
- package/templates/hello-world-with-assets/py/wrangler.jsonc +2 -2
- package/templates/hello-world-with-assets/ts/package.json +1 -1
- package/templates/hello-world-with-assets/ts/tsconfig.json +2 -2
- package/templates/hello-world-with-assets/ts/wrangler.jsonc +2 -2
- package/templates/hello-world-workflows/js/package.json +1 -1
- package/templates/hello-world-workflows/js/wrangler.jsonc +2 -2
- package/templates/hello-world-workflows/ts/package.json +1 -1
- package/templates/hello-world-workflows/ts/tsconfig.json +2 -2
- package/templates/hello-world-workflows/ts/wrangler.jsonc +2 -2
- package/templates/hono/pages/templates/wrangler.jsonc +2 -2
- package/templates/hono/workers/templates/wrangler.jsonc +2 -2
- package/templates/next/c3.ts +9 -22
- package/templates/nuxt/pages/templates/wrangler.jsonc +2 -2
- package/templates/nuxt/workers/templates/wrangler.jsonc +2 -2
- package/templates/openapi/ts/tsconfig.json +2 -2
- package/templates/openapi/ts/wrangler.jsonc +2 -2
- package/templates/pre-existing/js/package.json +1 -1
- package/templates/queues/js/package.json +1 -1
- package/templates/queues/js/wrangler.jsonc +2 -2
- package/templates/queues/ts/package.json +1 -1
- package/templates/queues/ts/tsconfig.json +2 -2
- package/templates/queues/ts/wrangler.jsonc +2 -2
- package/templates/qwik/pages/c3.ts +0 -35
- package/templates/qwik/pages/templates/wrangler.jsonc +2 -2
- package/templates/qwik/workers/c3.ts +0 -35
- package/templates/qwik/workers/templates/wrangler.jsonc +2 -2
- package/templates/react/pages/templates/wrangler.jsonc +2 -2
- package/templates/react/workers/js/wrangler.jsonc +2 -2
- package/templates/react/workers/ts/wrangler.jsonc +2 -2
- package/templates/react-router/c3.ts +7 -3
- package/templates/scheduled/js/package.json +1 -1
- package/templates/scheduled/js/wrangler.jsonc +2 -2
- package/templates/scheduled/ts/package.json +2 -2
- package/templates/scheduled/ts/tsconfig.json +2 -2
- package/templates/scheduled/ts/wrangler.jsonc +2 -2
- package/templates/solid/templates/wrangler.jsonc +2 -2
- package/templates/svelte/pages/templates/wrangler.jsonc +2 -2
- package/templates/svelte/workers/templates/wrangler.jsonc +2 -2
- package/templates/vike/c3.ts +28 -0
- package/templates/vue/pages/templates/wrangler.jsonc +2 -2
- package/templates/vue/workers/js/wrangler.jsonc +2 -2
- package/templates/vue/workers/ts/wrangler.jsonc +2 -2
- package/templates/waku/wrangler.jsonc +2 -2
- package/templates/analog/snippets/devBindingsModule.ts +0 -7
- package/templates/analog/templates/env.d.ts +0 -13
- package/templates/analog/templates/src/dev-bindings.ts +0 -18
- package/templates/next/templates/.dev.vars +0 -2
- package/templates/next/templates/__dot__gitignore +0 -39
- package/templates/next/templates/open-next.config.ts +0 -9
- package/templates/next/templates/public/_headers +0 -3
- package/templates/next/templates/wrangler.jsonc +0 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-cloudflare",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.59.0",
|
|
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.20251210.0",
|
|
34
34
|
"@types/command-exists": "^1.2.0",
|
|
35
35
|
"@types/cross-spawn": "^6.0.2",
|
|
36
36
|
"@types/deepmerge": "^2.2.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"recast": "^0.22.0",
|
|
66
66
|
"semver": "^7.7.1",
|
|
67
67
|
"smol-toml": "^1.5.2",
|
|
68
|
-
"typescript": "
|
|
68
|
+
"typescript": "~5.8.3",
|
|
69
69
|
"undici": "7.14.0",
|
|
70
70
|
"vite": "^5.4.14",
|
|
71
71
|
"vite-tsconfig-paths": "^4.0.8",
|
|
@@ -75,11 +75,11 @@
|
|
|
75
75
|
"xdg-app-paths": "^8.3.0",
|
|
76
76
|
"yargs": "^17.7.2",
|
|
77
77
|
"@cloudflare/cli": "1.1.4",
|
|
78
|
-
"@cloudflare/eslint-config-shared": "1.1.0",
|
|
79
78
|
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
80
|
-
"@cloudflare/
|
|
79
|
+
"@cloudflare/eslint-config-shared": "1.1.0",
|
|
81
80
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
82
|
-
"
|
|
81
|
+
"@cloudflare/vite-plugin": "1.17.1",
|
|
82
|
+
"wrangler": "4.54.0"
|
|
83
83
|
},
|
|
84
84
|
"engines": {
|
|
85
85
|
"node": ">=18.14.1"
|
package/templates/analog/c3.ts
CHANGED
|
@@ -1,106 +1,84 @@
|
|
|
1
|
-
import { logRaw } from "@cloudflare/cli";
|
|
2
|
-
import {
|
|
3
|
-
import { spinner } from "@cloudflare/cli/interactive";
|
|
1
|
+
import { logRaw, updateStatus } from "@cloudflare/cli";
|
|
2
|
+
import { blue } from "@cloudflare/cli/colors";
|
|
4
3
|
import { runFrameworkGenerator } from "frameworks/index";
|
|
5
|
-
import {
|
|
4
|
+
import { mergeObjectProperties, transformFile } from "helpers/codemod";
|
|
5
|
+
import { getWorkerdCompatibilityDate } from "helpers/compatDate";
|
|
6
|
+
import { usesTypescript } from "helpers/files";
|
|
6
7
|
import { detectPackageManager } from "helpers/packageManagers";
|
|
7
|
-
import { installPackages } from "helpers/packages";
|
|
8
8
|
import * as recast from "recast";
|
|
9
9
|
import type { TemplateConfig } from "../../src/templates";
|
|
10
10
|
import type { C3Context } from "types";
|
|
11
11
|
|
|
12
|
-
const { npm
|
|
12
|
+
const { npm } = detectPackageManager();
|
|
13
13
|
|
|
14
14
|
const generate = async (ctx: C3Context) => {
|
|
15
|
-
await runFrameworkGenerator(ctx, [
|
|
16
|
-
|
|
17
|
-
"--template",
|
|
18
|
-
"angular-v17",
|
|
19
|
-
]);
|
|
20
|
-
|
|
21
|
-
logRaw(""); // newline
|
|
15
|
+
await runFrameworkGenerator(ctx, [ctx.project.name, "--template=latest"]);
|
|
16
|
+
logRaw("");
|
|
22
17
|
};
|
|
23
18
|
|
|
24
19
|
const configure = async (ctx: C3Context) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const packages = [];
|
|
28
|
-
packages.push("nitropack");
|
|
29
|
-
packages.push("h3");
|
|
30
|
-
packages.push("@ngtools/webpack");
|
|
31
|
-
packages.push("@angular-devkit/build-angular");
|
|
32
|
-
|
|
33
|
-
await installPackages(packages, {
|
|
34
|
-
dev: true,
|
|
35
|
-
startText: `Installing ${packages.join(", ")}`,
|
|
36
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
updateViteConfig(ctx);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const updateViteConfig = (ctx: C3Context) => {
|
|
44
|
-
const b = recast.types.builders;
|
|
45
|
-
const s = spinner();
|
|
46
|
-
|
|
47
|
-
const configFile = "vite.config.ts";
|
|
48
|
-
s.start(`Updating \`${configFile}\``);
|
|
20
|
+
usesTypescript(ctx);
|
|
21
|
+
const filePath = `vite.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
49
22
|
|
|
50
|
-
const
|
|
23
|
+
const compatDate = await getWorkerdCompatibilityDate();
|
|
51
24
|
|
|
52
|
-
|
|
53
|
-
visitProgram(n) {
|
|
54
|
-
const lastImportIndex = n.node.body.findLastIndex(
|
|
55
|
-
(t) => t.type === "ImportDeclaration",
|
|
56
|
-
);
|
|
57
|
-
const lastImport = n.get("body", lastImportIndex);
|
|
58
|
-
lastImport.insertAfter(...snippets.devBindingsModuleTs);
|
|
25
|
+
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
59
26
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
visitCallExpression(n) {
|
|
27
|
+
transformFile(filePath, {
|
|
28
|
+
visitCallExpression: function (n) {
|
|
63
29
|
const callee = n.node.callee as recast.types.namedTypes.Identifier;
|
|
64
|
-
if (callee.name
|
|
65
|
-
|
|
30
|
+
if (callee.name !== "analog") {
|
|
31
|
+
return this.traverse(n);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const b = recast.types.builders;
|
|
35
|
+
const presetDef = [
|
|
36
|
+
b.objectProperty(
|
|
66
37
|
b.identifier("nitro"),
|
|
67
38
|
b.objectExpression([
|
|
39
|
+
// preset: "cloudflare_module"
|
|
68
40
|
b.objectProperty(
|
|
69
41
|
b.identifier("preset"),
|
|
70
|
-
b.stringLiteral("
|
|
42
|
+
b.stringLiteral("cloudflare_module"),
|
|
71
43
|
),
|
|
72
44
|
b.objectProperty(
|
|
73
|
-
b.identifier("
|
|
74
|
-
b.
|
|
45
|
+
b.identifier("compatibilityDate"),
|
|
46
|
+
b.stringLiteral(compatDate),
|
|
75
47
|
),
|
|
76
48
|
]),
|
|
77
|
-
)
|
|
49
|
+
),
|
|
50
|
+
];
|
|
78
51
|
|
|
79
|
-
|
|
52
|
+
if (n.node.arguments.length === 0) {
|
|
53
|
+
n.node.arguments.push(b.objectExpression(presetDef));
|
|
54
|
+
} else {
|
|
55
|
+
mergeObjectProperties(
|
|
56
|
+
n.node.arguments[0] as recast.types.namedTypes.ObjectExpression,
|
|
57
|
+
presetDef,
|
|
58
|
+
);
|
|
80
59
|
}
|
|
81
60
|
|
|
82
|
-
return
|
|
61
|
+
return false;
|
|
83
62
|
},
|
|
84
63
|
});
|
|
85
|
-
|
|
86
|
-
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
87
64
|
};
|
|
88
65
|
|
|
89
66
|
const config: TemplateConfig = {
|
|
90
67
|
configVersion: 1,
|
|
91
68
|
id: "analog",
|
|
92
69
|
frameworkCli: "create-analog",
|
|
93
|
-
platform: "pages",
|
|
94
70
|
displayName: "Analog",
|
|
71
|
+
platform: "workers",
|
|
95
72
|
copyFiles: {
|
|
96
73
|
path: "./templates",
|
|
97
74
|
},
|
|
75
|
+
path: "templates/analog",
|
|
98
76
|
generate,
|
|
99
77
|
configure,
|
|
100
78
|
transformPackageJson: async () => ({
|
|
101
79
|
scripts: {
|
|
102
|
-
preview: `${npm} run build && wrangler
|
|
103
|
-
deploy: `${npm} run build && wrangler
|
|
80
|
+
preview: `${npm} run build && wrangler dev`,
|
|
81
|
+
deploy: `${npm} run build && wrangler deploy`,
|
|
104
82
|
"cf-typegen": `wrangler types`,
|
|
105
83
|
},
|
|
106
84
|
}),
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
"name": "<WORKER_NAME>",
|
|
3
|
+
"compatibility_date": "<COMPATIBILITY_DATE>",
|
|
4
|
+
"main": "dist/analog/server/index.mjs",
|
|
5
|
+
"assets": {
|
|
6
|
+
"binding": "ASSETS",
|
|
7
|
+
"directory": "dist/analog/public",
|
|
8
|
+
},
|
|
9
|
+
"observability": {
|
|
10
|
+
"enabled": true,
|
|
11
|
+
},
|
|
5
12
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
4
|
|
|
5
5
|
/* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
6
|
-
"target": "
|
|
6
|
+
"target": "es2024",
|
|
7
7
|
/* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
8
|
-
"lib": ["
|
|
8
|
+
"lib": ["es2024"],
|
|
9
9
|
/* Specify what JSX code is generated. */
|
|
10
10
|
"jsx": "react-jsx" ,
|
|
11
11
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
-
import { resolve } from "node:path";
|
|
3
1
|
import type { TemplateConfig } from "../../src/templates";
|
|
4
2
|
|
|
5
3
|
export default {
|
|
@@ -9,16 +7,6 @@ export default {
|
|
|
9
7
|
description:
|
|
10
8
|
"For processing requests, transforming responses, or API endpoints",
|
|
11
9
|
platform: "workers",
|
|
12
|
-
async configure(ctx) {
|
|
13
|
-
if (ctx.args.lang === "python") {
|
|
14
|
-
const contents = await readFile(
|
|
15
|
-
resolve(ctx.project.path, "pyproject.toml"),
|
|
16
|
-
"utf8",
|
|
17
|
-
);
|
|
18
|
-
const updated = contents.replaceAll(/<TBD>/g, ctx.project.name);
|
|
19
|
-
await writeFile(resolve(ctx.project.path, "pyproject.toml"), updated);
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
10
|
copyFiles: {
|
|
23
11
|
variants: {
|
|
24
12
|
js: {
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
4
|
|
|
5
5
|
/* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
6
|
-
"target": "
|
|
6
|
+
"target": "es2024",
|
|
7
7
|
/* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
8
|
-
"lib": ["
|
|
8
|
+
"lib": ["es2024"],
|
|
9
9
|
/* Specify what JSX code is generated. */
|
|
10
10
|
"jsx": "react-jsx",
|
|
11
11
|
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
4
|
|
|
5
5
|
/* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
6
|
-
"target": "
|
|
6
|
+
"target": "es2024",
|
|
7
7
|
/* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
8
|
-
"lib": ["
|
|
8
|
+
"lib": ["es2024"],
|
|
9
9
|
/* Specify what JSX code is generated. */
|
|
10
10
|
"jsx": "react-jsx",
|
|
11
11
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "<
|
|
2
|
+
"name": "<WORKER_NAME>",
|
|
3
3
|
"main": "src/index.js",
|
|
4
|
-
"compatibility_date": "<
|
|
4
|
+
"compatibility_date": "<COMPATIBILITY_DATE>",
|
|
5
5
|
"assets": {
|
|
6
6
|
// The path to the directory containing the `index.html` file to be served at `/`
|
|
7
7
|
"directory": "./public"
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
4
|
|
|
5
5
|
/* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
6
|
-
"target": "
|
|
6
|
+
"target": "es2024",
|
|
7
7
|
/* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
8
|
-
"lib": ["
|
|
8
|
+
"lib": ["es2024"],
|
|
9
9
|
/* Specify what JSX code is generated. */
|
|
10
10
|
"jsx": "react-jsx",
|
|
11
11
|
|