create-cloudflare 2.33.2 → 2.33.3
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 +39 -53
- package/package.json +4 -4
- package/templates/hello-world/js/package.json +1 -1
- package/templates/hello-world/ts/package.json +1 -1
- package/templates/svelte/c3.ts +30 -0
- package/templates-experimental/hello-world-with-assets/js/package.json +1 -1
- package/templates-experimental/hello-world-with-assets/ts/package.json +1 -1
- package/templates-experimental/nuxt/c3.ts +1 -1
- package/templates-experimental/nuxt/templates/wrangler.toml +2 -2
- package/templates-experimental/solid/c3.ts +7 -50
- package/templates-experimental/solid/templates/wrangler.toml +2 -2
- package/templates-experimental/nuxt/templates/cloudflare-preset/nitro.config.ts +0 -27
package/dist/cli.js
CHANGED
|
@@ -73725,7 +73725,7 @@ var Yargs = YargsFactory(esm_default);
|
|
|
73725
73725
|
var yargs_default = Yargs;
|
|
73726
73726
|
|
|
73727
73727
|
// package.json
|
|
73728
|
-
var version = "2.33.
|
|
73728
|
+
var version = "2.33.3";
|
|
73729
73729
|
|
|
73730
73730
|
// src/metrics.ts
|
|
73731
73731
|
var import_node_async_hooks = require("node:async_hooks");
|
|
@@ -73817,6 +73817,13 @@ var runCommand = async (command2, opts = {}) => {
|
|
|
73817
73817
|
doneText: opts.doneText,
|
|
73818
73818
|
promise() {
|
|
73819
73819
|
const [executable, ...args] = command2;
|
|
73820
|
+
if (args[0] === "wrangler") {
|
|
73821
|
+
const metrics = readMetricsConfig();
|
|
73822
|
+
if (metrics.c3permission?.enabled === false) {
|
|
73823
|
+
opts.env ??= {};
|
|
73824
|
+
opts.env["WRANGLER_SEND_METRICS"] = "false";
|
|
73825
|
+
}
|
|
73826
|
+
}
|
|
73820
73827
|
const abortController = new AbortController();
|
|
73821
73828
|
const cmd = (0, import_cross_spawn.spawn)(executable, [...args], {
|
|
73822
73829
|
// TODO: ideally inherit stderr, but npm install uses this for warnings
|
|
@@ -75081,7 +75088,7 @@ var updateNuxtConfig = () => {
|
|
|
75081
75088
|
b2.objectExpression([
|
|
75082
75089
|
b2.objectProperty(
|
|
75083
75090
|
b2.identifier("preset"),
|
|
75084
|
-
b2.stringLiteral("
|
|
75091
|
+
b2.stringLiteral("cloudflare_module")
|
|
75085
75092
|
)
|
|
75086
75093
|
])
|
|
75087
75094
|
);
|
|
@@ -75297,6 +75304,7 @@ var configure7 = async (ctx) => {
|
|
|
75297
75304
|
});
|
|
75298
75305
|
usesTypescript(ctx);
|
|
75299
75306
|
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
75307
|
+
const compatDate = await getWorkerdCompatibilityDate();
|
|
75300
75308
|
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
75301
75309
|
transformFile(filePath, {
|
|
75302
75310
|
visitCallExpression: function(n2) {
|
|
@@ -75311,60 +75319,14 @@ var configure7 = async (ctx) => {
|
|
|
75311
75319
|
b2.objectProperty(
|
|
75312
75320
|
b2.identifier("server"),
|
|
75313
75321
|
b2.objectExpression([
|
|
75314
|
-
// preset: "
|
|
75322
|
+
// preset: "cloudflare_module"
|
|
75315
75323
|
b2.objectProperty(
|
|
75316
75324
|
b2.identifier("preset"),
|
|
75317
|
-
b2.stringLiteral("
|
|
75318
|
-
),
|
|
75319
|
-
// output: {
|
|
75320
|
-
// dir: "{{ rootDir }}/dist",
|
|
75321
|
-
// publicDir: "{{ output.dir }}/public",
|
|
75322
|
-
// serverDir: "{{ output.dir }}/worker",
|
|
75323
|
-
// },
|
|
75324
|
-
b2.objectProperty(
|
|
75325
|
-
b2.identifier("output"),
|
|
75326
|
-
b2.objectExpression([
|
|
75327
|
-
b2.objectProperty(
|
|
75328
|
-
b2.identifier("dir"),
|
|
75329
|
-
b2.stringLiteral("{{ rootDir }}/dist")
|
|
75330
|
-
),
|
|
75331
|
-
b2.objectProperty(
|
|
75332
|
-
b2.identifier("publicDir"),
|
|
75333
|
-
b2.stringLiteral("{{ output.dir }}/public")
|
|
75334
|
-
),
|
|
75335
|
-
b2.objectProperty(
|
|
75336
|
-
b2.identifier("serverDir"),
|
|
75337
|
-
b2.stringLiteral("{{ output.dir }}/worker")
|
|
75338
|
-
)
|
|
75339
|
-
])
|
|
75325
|
+
b2.stringLiteral("cloudflare_module")
|
|
75340
75326
|
),
|
|
75341
|
-
// rollupConfig: {
|
|
75342
|
-
// external: ["node:async_hooks"],
|
|
75343
|
-
// },
|
|
75344
75327
|
b2.objectProperty(
|
|
75345
|
-
b2.identifier("
|
|
75346
|
-
b2.
|
|
75347
|
-
b2.objectProperty(
|
|
75348
|
-
b2.identifier("external"),
|
|
75349
|
-
b2.arrayExpression([b2.stringLiteral("node:async_hooks")])
|
|
75350
|
-
)
|
|
75351
|
-
])
|
|
75352
|
-
),
|
|
75353
|
-
// hooks: {
|
|
75354
|
-
// // Prevent the Pages preset from writing the _routes.json etc.
|
|
75355
|
-
// compiled() {},
|
|
75356
|
-
// },
|
|
75357
|
-
b2.objectProperty(
|
|
75358
|
-
b2.identifier("hooks"),
|
|
75359
|
-
b2.objectExpression([
|
|
75360
|
-
b2.objectMethod(
|
|
75361
|
-
"method",
|
|
75362
|
-
b2.identifier("compiled"),
|
|
75363
|
-
[],
|
|
75364
|
-
b2.blockStatement([]),
|
|
75365
|
-
false
|
|
75366
|
-
)
|
|
75367
|
-
])
|
|
75328
|
+
b2.identifier("compatibilityDate"),
|
|
75329
|
+
b2.stringLiteral(compatDate)
|
|
75368
75330
|
)
|
|
75369
75331
|
])
|
|
75370
75332
|
)
|
|
@@ -76735,6 +76697,7 @@ var config23 = {
|
|
|
76735
76697
|
var c3_default33 = config23;
|
|
76736
76698
|
|
|
76737
76699
|
// templates/svelte/c3.ts
|
|
76700
|
+
var import_node_fs3 = require("node:fs");
|
|
76738
76701
|
var import_node_os4 = require("node:os");
|
|
76739
76702
|
var recast12 = __toESM(require_main3());
|
|
76740
76703
|
var { npm: npm19 } = detectPackageManager();
|
|
@@ -76750,6 +76713,7 @@ var configure18 = async (ctx) => {
|
|
|
76750
76713
|
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
76751
76714
|
});
|
|
76752
76715
|
updateSvelteConfig2();
|
|
76716
|
+
updatePlaywrightConfig(usesTypescript(ctx));
|
|
76753
76717
|
updateTypeDefinitions2(ctx);
|
|
76754
76718
|
};
|
|
76755
76719
|
var updateSvelteConfig2 = () => {
|
|
@@ -76764,6 +76728,28 @@ var updateSvelteConfig2 = () => {
|
|
|
76764
76728
|
}
|
|
76765
76729
|
});
|
|
76766
76730
|
};
|
|
76731
|
+
var updatePlaywrightConfig = (shouldUseTypescript) => {
|
|
76732
|
+
const filePath = `playwright.config.${shouldUseTypescript ? "ts" : "js"}`;
|
|
76733
|
+
if (!(0, import_node_fs3.existsSync)(filePath)) {
|
|
76734
|
+
return;
|
|
76735
|
+
}
|
|
76736
|
+
updateStatus(`Changing webServer port in ${blue(filePath)}`);
|
|
76737
|
+
transformFile(filePath, {
|
|
76738
|
+
visitObjectExpression: function(n2) {
|
|
76739
|
+
const portProp = n2.node.properties.find((prop) => {
|
|
76740
|
+
if (!("key" in prop) || !("name" in prop.key)) {
|
|
76741
|
+
return false;
|
|
76742
|
+
}
|
|
76743
|
+
return prop.key.name === "port";
|
|
76744
|
+
});
|
|
76745
|
+
if (!portProp || !("value" in portProp) || !("value" in portProp.value)) {
|
|
76746
|
+
return this.traverse(n2);
|
|
76747
|
+
}
|
|
76748
|
+
portProp.value.value = 8788;
|
|
76749
|
+
return false;
|
|
76750
|
+
}
|
|
76751
|
+
});
|
|
76752
|
+
};
|
|
76767
76753
|
var updateTypeDefinitions2 = (ctx) => {
|
|
76768
76754
|
if (!usesTypescript(ctx)) {
|
|
76769
76755
|
return;
|
|
@@ -76860,7 +76846,7 @@ var config25 = {
|
|
|
76860
76846
|
var c3_default35 = config25;
|
|
76861
76847
|
|
|
76862
76848
|
// ../wrangler/package.json
|
|
76863
|
-
var version2 = "3.
|
|
76849
|
+
var version2 = "3.93.0";
|
|
76864
76850
|
|
|
76865
76851
|
// src/git.ts
|
|
76866
76852
|
var offerGit = async (ctx) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-cloudflare",
|
|
3
|
-
"version": "2.33.
|
|
3
|
+
"version": "2.33.3",
|
|
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.20241205.0",
|
|
34
34
|
"@iarna/toml": "^3.0.0",
|
|
35
35
|
"@types/command-exists": "^1.2.0",
|
|
36
36
|
"@types/cross-spawn": "^6.0.2",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"yargs": "^17.7.2",
|
|
69
69
|
"@cloudflare/cli": "1.1.1",
|
|
70
70
|
"@cloudflare/eslint-config-worker": "1.1.0",
|
|
71
|
-
"
|
|
72
|
-
"
|
|
71
|
+
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
72
|
+
"wrangler": "3.93.0"
|
|
73
73
|
},
|
|
74
74
|
"engines": {
|
|
75
75
|
"node": ">=18.14.1"
|
package/templates/svelte/c3.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
1
2
|
import { platform } from "node:os";
|
|
2
3
|
import { logRaw, updateStatus } from "@cloudflare/cli";
|
|
3
4
|
import { blue, brandColor, dim } from "@cloudflare/cli/colors";
|
|
@@ -28,6 +29,7 @@ const configure = async (ctx: C3Context) => {
|
|
|
28
29
|
});
|
|
29
30
|
|
|
30
31
|
updateSvelteConfig();
|
|
32
|
+
updatePlaywrightConfig(usesTypescript(ctx));
|
|
31
33
|
updateTypeDefinitions(ctx);
|
|
32
34
|
};
|
|
33
35
|
|
|
@@ -49,6 +51,34 @@ const updateSvelteConfig = () => {
|
|
|
49
51
|
});
|
|
50
52
|
};
|
|
51
53
|
|
|
54
|
+
const updatePlaywrightConfig = (shouldUseTypescript: boolean) => {
|
|
55
|
+
const filePath = `playwright.config.${shouldUseTypescript ? "ts" : "js"}`;
|
|
56
|
+
if (!existsSync(filePath)) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
updateStatus(`Changing webServer port in ${blue(filePath)}`);
|
|
61
|
+
|
|
62
|
+
transformFile(filePath, {
|
|
63
|
+
visitObjectExpression: function (n) {
|
|
64
|
+
const portProp = n.node.properties.find((prop) => {
|
|
65
|
+
if (!("key" in prop) || !("name" in prop.key)) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return prop.key.name === "port";
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
if (!portProp || !("value" in portProp) || !("value" in portProp.value)) {
|
|
73
|
+
return this.traverse(n);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
portProp.value.value = 8788;
|
|
77
|
+
return false;
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
52
82
|
const updateTypeDefinitions = (ctx: C3Context) => {
|
|
53
83
|
if (!usesTypescript(ctx)) {
|
|
54
84
|
return;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#:schema node_modules/wrangler/config-schema.json
|
|
2
2
|
name = "<TBD>"
|
|
3
3
|
compatibility_date = "<TBD>"
|
|
4
|
-
main = "
|
|
5
|
-
assets = { directory = "
|
|
4
|
+
main = "./.output/server/index.mjs"
|
|
5
|
+
assets = { directory = "./.output/public/", binding = "ASSETS" }
|
|
6
6
|
|
|
7
7
|
# Workers Logs
|
|
8
8
|
# Docs: https://developers.cloudflare.com/workers/observability/logs/workers-logs/
|
|
@@ -2,6 +2,7 @@ import { logRaw, updateStatus } from "@cloudflare/cli";
|
|
|
2
2
|
import { blue, brandColor, dim } from "@cloudflare/cli/colors";
|
|
3
3
|
import { runFrameworkGenerator } from "frameworks/index";
|
|
4
4
|
import { mergeObjectProperties, transformFile } from "helpers/codemod";
|
|
5
|
+
import { getWorkerdCompatibilityDate } from "helpers/compatDate";
|
|
5
6
|
import { usesTypescript } from "helpers/files";
|
|
6
7
|
import { detectPackageManager } from "helpers/packageManagers";
|
|
7
8
|
import { installPackages } from "helpers/packages";
|
|
@@ -30,6 +31,8 @@ const configure = async (ctx: C3Context) => {
|
|
|
30
31
|
usesTypescript(ctx);
|
|
31
32
|
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
32
33
|
|
|
34
|
+
const compatDate = await getWorkerdCompatibilityDate();
|
|
35
|
+
|
|
33
36
|
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
34
37
|
|
|
35
38
|
transformFile(filePath, {
|
|
@@ -46,60 +49,14 @@ const configure = async (ctx: C3Context) => {
|
|
|
46
49
|
b.objectProperty(
|
|
47
50
|
b.identifier("server"),
|
|
48
51
|
b.objectExpression([
|
|
49
|
-
// preset: "
|
|
52
|
+
// preset: "cloudflare_module"
|
|
50
53
|
b.objectProperty(
|
|
51
54
|
b.identifier("preset"),
|
|
52
|
-
b.stringLiteral("
|
|
53
|
-
),
|
|
54
|
-
// output: {
|
|
55
|
-
// dir: "{{ rootDir }}/dist",
|
|
56
|
-
// publicDir: "{{ output.dir }}/public",
|
|
57
|
-
// serverDir: "{{ output.dir }}/worker",
|
|
58
|
-
// },
|
|
59
|
-
b.objectProperty(
|
|
60
|
-
b.identifier("output"),
|
|
61
|
-
b.objectExpression([
|
|
62
|
-
b.objectProperty(
|
|
63
|
-
b.identifier("dir"),
|
|
64
|
-
b.stringLiteral("{{ rootDir }}/dist"),
|
|
65
|
-
),
|
|
66
|
-
b.objectProperty(
|
|
67
|
-
b.identifier("publicDir"),
|
|
68
|
-
b.stringLiteral("{{ output.dir }}/public"),
|
|
69
|
-
),
|
|
70
|
-
b.objectProperty(
|
|
71
|
-
b.identifier("serverDir"),
|
|
72
|
-
b.stringLiteral("{{ output.dir }}/worker"),
|
|
73
|
-
),
|
|
74
|
-
]),
|
|
75
|
-
),
|
|
76
|
-
// rollupConfig: {
|
|
77
|
-
// external: ["node:async_hooks"],
|
|
78
|
-
// },
|
|
79
|
-
b.objectProperty(
|
|
80
|
-
b.identifier("rollupConfig"),
|
|
81
|
-
b.objectExpression([
|
|
82
|
-
b.objectProperty(
|
|
83
|
-
b.identifier("external"),
|
|
84
|
-
b.arrayExpression([b.stringLiteral("node:async_hooks")]),
|
|
85
|
-
),
|
|
86
|
-
]),
|
|
55
|
+
b.stringLiteral("cloudflare_module"),
|
|
87
56
|
),
|
|
88
|
-
// hooks: {
|
|
89
|
-
// // Prevent the Pages preset from writing the _routes.json etc.
|
|
90
|
-
// compiled() {},
|
|
91
|
-
// },
|
|
92
57
|
b.objectProperty(
|
|
93
|
-
b.identifier("
|
|
94
|
-
b.
|
|
95
|
-
b.objectMethod(
|
|
96
|
-
"method",
|
|
97
|
-
b.identifier("compiled"),
|
|
98
|
-
[],
|
|
99
|
-
b.blockStatement([]),
|
|
100
|
-
false,
|
|
101
|
-
),
|
|
102
|
-
]),
|
|
58
|
+
b.identifier("compatibilityDate"),
|
|
59
|
+
b.stringLiteral(compatDate),
|
|
103
60
|
),
|
|
104
61
|
]),
|
|
105
62
|
),
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
name = "<TBD>"
|
|
3
3
|
compatibility_date = "<TBD>"
|
|
4
4
|
compatibility_flags = ["nodejs_compat"]
|
|
5
|
-
main = "
|
|
6
|
-
assets = { directory = "
|
|
5
|
+
main = "./.output/server/index.mjs"
|
|
6
|
+
assets = { directory = "./.output/public", binding = "ASSETS" }
|
|
7
7
|
|
|
8
8
|
# Workers Logs
|
|
9
9
|
# Docs: https://developers.cloudflare.com/workers/observability/logs/workers-logs/
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { type NitroPreset } from "nitropack";
|
|
2
|
-
|
|
3
|
-
export default <NitroPreset>{
|
|
4
|
-
extends: "cloudflare",
|
|
5
|
-
exportConditions: ["workerd"],
|
|
6
|
-
output: {
|
|
7
|
-
dir: "{{ rootDir }}/dist",
|
|
8
|
-
publicDir: "{{ output.dir }}/public",
|
|
9
|
-
serverDir: "{{ output.dir }}/worker",
|
|
10
|
-
},
|
|
11
|
-
commands: {
|
|
12
|
-
preview: "npx wrangler dev",
|
|
13
|
-
deploy: "npx wrangler deploy",
|
|
14
|
-
},
|
|
15
|
-
wasm: {
|
|
16
|
-
lazy: false,
|
|
17
|
-
esmImport: true,
|
|
18
|
-
},
|
|
19
|
-
rollupConfig: {
|
|
20
|
-
output: {
|
|
21
|
-
entryFileNames: "index.js",
|
|
22
|
-
format: "esm",
|
|
23
|
-
exports: "named",
|
|
24
|
-
inlineDynamicImports: false,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
};
|