create-cloudflare 2.22.2 → 2.23.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 +179 -129
- package/package.json +4 -4
- package/templates/hello-world/c3.ts +4 -1
- package/templates/hello-world/ts/tsconfig.json +2 -1
- package/templates/hello-world-durable-object/c3.ts +1 -1
- package/templates/hello-world-python/c3.ts +0 -9
- /package/templates/{hello-world-python → hello-world}/py/__dot__gitignore +0 -0
- /package/templates/{hello-world-python → hello-world}/py/package.json +0 -0
- /package/templates/{hello-world-python → hello-world}/py/src/entry.py +0 -0
- /package/templates/{hello-world-python → hello-world}/py/wrangler.toml +0 -0
package/dist/cli.js
CHANGED
|
@@ -2870,7 +2870,7 @@ var init_args = __esm({
|
|
|
2870
2870
|
var version;
|
|
2871
2871
|
var init_package = __esm({
|
|
2872
2872
|
"package.json"() {
|
|
2873
|
-
version = "2.
|
|
2873
|
+
version = "2.23.0";
|
|
2874
2874
|
}
|
|
2875
2875
|
});
|
|
2876
2876
|
|
|
@@ -23653,13 +23653,14 @@ var init_cli2 = __esm({
|
|
|
23653
23653
|
};
|
|
23654
23654
|
C3_DEFAULTS = {
|
|
23655
23655
|
projectName: new import_haikunator.default().haikunate({ tokenHex: true }),
|
|
23656
|
+
category: "hello-world",
|
|
23656
23657
|
type: "hello-world",
|
|
23657
23658
|
framework: "analog",
|
|
23658
23659
|
autoUpdate: true,
|
|
23659
23660
|
deploy: true,
|
|
23660
23661
|
git: true,
|
|
23661
23662
|
open: true,
|
|
23662
|
-
|
|
23663
|
+
lang: "ts",
|
|
23663
23664
|
template: "cloudflare/workers-sdk/packages/create-cloudflare/templates/hello-world"
|
|
23664
23665
|
};
|
|
23665
23666
|
WRANGLER_DEFAULTS = {
|
|
@@ -23684,15 +23685,15 @@ var init_package2 = __esm({
|
|
|
23684
23685
|
dependencies: {
|
|
23685
23686
|
"create-astro": "4.8.0",
|
|
23686
23687
|
"create-analog": "1.3.1",
|
|
23687
|
-
"@angular/create": "18.1.
|
|
23688
|
+
"@angular/create": "18.1.2",
|
|
23688
23689
|
"create-docusaurus": "3.4.0",
|
|
23689
23690
|
"create-hono": "0.10.1",
|
|
23690
|
-
"create-next-app": "14.
|
|
23691
|
+
"create-next-app": "14.2.5",
|
|
23691
23692
|
"create-qwik": "1.5.7",
|
|
23692
23693
|
"create-react-app": "5.0.1",
|
|
23693
23694
|
"create-remix": "2.10.3",
|
|
23694
23695
|
"create-solid": "0.5.12",
|
|
23695
|
-
"create-svelte": "6.3.
|
|
23696
|
+
"create-svelte": "6.3.4",
|
|
23696
23697
|
"create-vue": "3.10.4",
|
|
23697
23698
|
gatsby: "5.13.7",
|
|
23698
23699
|
nuxi: "3.12.0"
|
|
@@ -23771,7 +23772,7 @@ var init_frameworks = __esm({
|
|
|
23771
23772
|
var version2;
|
|
23772
23773
|
var init_package3 = __esm({
|
|
23773
23774
|
"../wrangler/package.json"() {
|
|
23774
|
-
version2 = "3.
|
|
23775
|
+
version2 = "3.68.0";
|
|
23775
23776
|
}
|
|
23776
23777
|
});
|
|
23777
23778
|
|
|
@@ -23884,16 +23885,6 @@ var init_git = __esm({
|
|
|
23884
23885
|
ctx.args.git = false;
|
|
23885
23886
|
return;
|
|
23886
23887
|
}
|
|
23887
|
-
const gitConfigured = await isGitConfigured();
|
|
23888
|
-
if (!gitConfigured) {
|
|
23889
|
-
if (ctx.args.git) {
|
|
23890
|
-
updateStatus(
|
|
23891
|
-
"Must configure `user.name` and user.email` to use git. Continuing without git."
|
|
23892
|
-
);
|
|
23893
|
-
}
|
|
23894
|
-
ctx.args.git = false;
|
|
23895
|
-
return;
|
|
23896
|
-
}
|
|
23897
23888
|
const insideGitRepo = await isInsideGitRepo(ctx.project.path);
|
|
23898
23889
|
if (insideGitRepo) {
|
|
23899
23890
|
ctx.args.git = true;
|
|
@@ -23905,9 +23896,18 @@ var init_git = __esm({
|
|
|
23905
23896
|
label: "git",
|
|
23906
23897
|
defaultValue: C3_DEFAULTS.git
|
|
23907
23898
|
});
|
|
23908
|
-
if (ctx.args.git) {
|
|
23909
|
-
|
|
23899
|
+
if (!ctx.args.git) {
|
|
23900
|
+
return;
|
|
23910
23901
|
}
|
|
23902
|
+
const gitConfigured = await isGitConfigured();
|
|
23903
|
+
if (!gitConfigured) {
|
|
23904
|
+
updateStatus(
|
|
23905
|
+
"Must configure `user.name` and user.email` to use git. Continuing without git."
|
|
23906
|
+
);
|
|
23907
|
+
ctx.args.git = false;
|
|
23908
|
+
return;
|
|
23909
|
+
}
|
|
23910
|
+
await initializeGit(ctx.project.path);
|
|
23911
23911
|
};
|
|
23912
23912
|
gitCommit = async (ctx) => {
|
|
23913
23913
|
const commitMessage = await createCommitMessage(ctx);
|
|
@@ -71101,7 +71101,7 @@ var init_c315 = __esm({
|
|
|
71101
71101
|
c3_default15 = {
|
|
71102
71102
|
configVersion: 1,
|
|
71103
71103
|
id: "hello-world",
|
|
71104
|
-
displayName:
|
|
71104
|
+
displayName: "Hello World Worker",
|
|
71105
71105
|
platform: "workers",
|
|
71106
71106
|
copyFiles: {
|
|
71107
71107
|
variants: {
|
|
@@ -71110,6 +71110,9 @@ var init_c315 = __esm({
|
|
|
71110
71110
|
},
|
|
71111
71111
|
ts: {
|
|
71112
71112
|
path: "./ts"
|
|
71113
|
+
},
|
|
71114
|
+
python: {
|
|
71115
|
+
path: "./py"
|
|
71113
71116
|
}
|
|
71114
71117
|
}
|
|
71115
71118
|
}
|
|
@@ -71117,35 +71120,15 @@ var init_c315 = __esm({
|
|
|
71117
71120
|
}
|
|
71118
71121
|
});
|
|
71119
71122
|
|
|
71120
|
-
// templates/
|
|
71123
|
+
// templates/common/c3.ts
|
|
71121
71124
|
var c3_exports16 = {};
|
|
71122
71125
|
__export(c3_exports16, {
|
|
71123
71126
|
default: () => c3_default16
|
|
71124
71127
|
});
|
|
71125
71128
|
var c3_default16;
|
|
71126
71129
|
var init_c316 = __esm({
|
|
71127
|
-
"templates/hello-world-python/c3.ts"() {
|
|
71128
|
-
c3_default16 = {
|
|
71129
|
-
configVersion: 1,
|
|
71130
|
-
id: "hello-world-python",
|
|
71131
|
-
displayName: '"Hello World" Worker (Python)',
|
|
71132
|
-
platform: "workers",
|
|
71133
|
-
copyFiles: {
|
|
71134
|
-
path: "./py"
|
|
71135
|
-
}
|
|
71136
|
-
};
|
|
71137
|
-
}
|
|
71138
|
-
});
|
|
71139
|
-
|
|
71140
|
-
// templates/common/c3.ts
|
|
71141
|
-
var c3_exports17 = {};
|
|
71142
|
-
__export(c3_exports17, {
|
|
71143
|
-
default: () => c3_default17
|
|
71144
|
-
});
|
|
71145
|
-
var c3_default17;
|
|
71146
|
-
var init_c317 = __esm({
|
|
71147
71130
|
"templates/common/c3.ts"() {
|
|
71148
|
-
|
|
71131
|
+
c3_default16 = {
|
|
71149
71132
|
configVersion: 1,
|
|
71150
71133
|
id: "common",
|
|
71151
71134
|
displayName: "Example router & proxy Worker",
|
|
@@ -71165,14 +71148,14 @@ var init_c317 = __esm({
|
|
|
71165
71148
|
});
|
|
71166
71149
|
|
|
71167
71150
|
// templates/scheduled/c3.ts
|
|
71168
|
-
var
|
|
71169
|
-
__export(
|
|
71170
|
-
default: () =>
|
|
71151
|
+
var c3_exports17 = {};
|
|
71152
|
+
__export(c3_exports17, {
|
|
71153
|
+
default: () => c3_default17
|
|
71171
71154
|
});
|
|
71172
|
-
var
|
|
71173
|
-
var
|
|
71155
|
+
var c3_default17;
|
|
71156
|
+
var init_c317 = __esm({
|
|
71174
71157
|
"templates/scheduled/c3.ts"() {
|
|
71175
|
-
|
|
71158
|
+
c3_default17 = {
|
|
71176
71159
|
configVersion: 1,
|
|
71177
71160
|
id: "scheduled",
|
|
71178
71161
|
displayName: "Scheduled Worker (Cron Trigger)",
|
|
@@ -71192,14 +71175,14 @@ var init_c318 = __esm({
|
|
|
71192
71175
|
});
|
|
71193
71176
|
|
|
71194
71177
|
// templates/queues/c3.ts
|
|
71195
|
-
var
|
|
71196
|
-
__export(
|
|
71197
|
-
default: () =>
|
|
71178
|
+
var c3_exports18 = {};
|
|
71179
|
+
__export(c3_exports18, {
|
|
71180
|
+
default: () => c3_default18
|
|
71198
71181
|
});
|
|
71199
|
-
var
|
|
71200
|
-
var
|
|
71182
|
+
var c3_default18;
|
|
71183
|
+
var init_c318 = __esm({
|
|
71201
71184
|
"templates/queues/c3.ts"() {
|
|
71202
|
-
|
|
71185
|
+
c3_default18 = {
|
|
71203
71186
|
configVersion: 1,
|
|
71204
71187
|
id: "queues",
|
|
71205
71188
|
displayName: "Queue consumer & producer Worker",
|
|
@@ -71229,17 +71212,17 @@ var init_c319 = __esm({
|
|
|
71229
71212
|
});
|
|
71230
71213
|
|
|
71231
71214
|
// templates/hello-world-durable-object/c3.ts
|
|
71232
|
-
var
|
|
71233
|
-
__export(
|
|
71234
|
-
default: () =>
|
|
71215
|
+
var c3_exports19 = {};
|
|
71216
|
+
__export(c3_exports19, {
|
|
71217
|
+
default: () => c3_default19
|
|
71235
71218
|
});
|
|
71236
|
-
var
|
|
71237
|
-
var
|
|
71219
|
+
var c3_default19;
|
|
71220
|
+
var init_c319 = __esm({
|
|
71238
71221
|
"templates/hello-world-durable-object/c3.ts"() {
|
|
71239
|
-
|
|
71222
|
+
c3_default19 = {
|
|
71240
71223
|
configVersion: 1,
|
|
71241
71224
|
id: "hello-world-durable-object",
|
|
71242
|
-
displayName: "
|
|
71225
|
+
displayName: "Hello World Worker Using Durable Objects",
|
|
71243
71226
|
platform: "workers",
|
|
71244
71227
|
copyFiles: {
|
|
71245
71228
|
variants: {
|
|
@@ -71256,14 +71239,14 @@ var init_c320 = __esm({
|
|
|
71256
71239
|
});
|
|
71257
71240
|
|
|
71258
71241
|
// templates/openapi/c3.ts
|
|
71259
|
-
var
|
|
71260
|
-
__export(
|
|
71261
|
-
default: () =>
|
|
71242
|
+
var c3_exports20 = {};
|
|
71243
|
+
__export(c3_exports20, {
|
|
71244
|
+
default: () => c3_default20
|
|
71262
71245
|
});
|
|
71263
|
-
var
|
|
71264
|
-
var
|
|
71246
|
+
var c3_default20;
|
|
71247
|
+
var init_c320 = __esm({
|
|
71265
71248
|
"templates/openapi/c3.ts"() {
|
|
71266
|
-
|
|
71249
|
+
c3_default20 = {
|
|
71267
71250
|
configVersion: 1,
|
|
71268
71251
|
id: "openapi",
|
|
71269
71252
|
displayName: "API starter (OpenAPI compliant)",
|
|
@@ -71276,10 +71259,10 @@ var init_c321 = __esm({
|
|
|
71276
71259
|
});
|
|
71277
71260
|
|
|
71278
71261
|
// templates/pre-existing/c3.ts
|
|
71279
|
-
var
|
|
71280
|
-
__export(
|
|
71262
|
+
var c3_exports21 = {};
|
|
71263
|
+
__export(c3_exports21, {
|
|
71281
71264
|
copyExistingWorkerFiles: () => copyExistingWorkerFiles,
|
|
71282
|
-
default: () =>
|
|
71265
|
+
default: () => c3_default21
|
|
71283
71266
|
});
|
|
71284
71267
|
async function copyExistingWorkerFiles(ctx) {
|
|
71285
71268
|
const { dlx } = detectPackageManager();
|
|
@@ -71328,8 +71311,8 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
71328
71311
|
(0, import_path14.join)(ctx.project.path, "wrangler.toml")
|
|
71329
71312
|
);
|
|
71330
71313
|
}
|
|
71331
|
-
var import_promises, import_os, import_path14,
|
|
71332
|
-
var
|
|
71314
|
+
var import_promises, import_os, import_path14, c3_default21;
|
|
71315
|
+
var init_c321 = __esm({
|
|
71333
71316
|
"templates/pre-existing/c3.ts"() {
|
|
71334
71317
|
import_promises = require("fs/promises");
|
|
71335
71318
|
import_os = require("os");
|
|
@@ -71339,7 +71322,7 @@ var init_c322 = __esm({
|
|
|
71339
71322
|
init_command();
|
|
71340
71323
|
init_packageManagers();
|
|
71341
71324
|
init_accounts();
|
|
71342
|
-
|
|
71325
|
+
c3_default21 = {
|
|
71343
71326
|
configVersion: 1,
|
|
71344
71327
|
id: "pre-existing",
|
|
71345
71328
|
displayName: "Pre-existing Worker (from Dashboard)",
|
|
@@ -71382,7 +71365,19 @@ async function copyTemplateFiles(ctx) {
|
|
|
71382
71365
|
}
|
|
71383
71366
|
s.stop(`${brandColor("files")} ${dim("copied to project directory")}`);
|
|
71384
71367
|
}
|
|
71385
|
-
|
|
71368
|
+
function inferLanguageArg(args) {
|
|
71369
|
+
if (args.ts === void 0) {
|
|
71370
|
+
return;
|
|
71371
|
+
}
|
|
71372
|
+
const language = args.ts ? "ts" : "js";
|
|
71373
|
+
if (args.lang !== void 0) {
|
|
71374
|
+
crash(
|
|
71375
|
+
"The `--ts` argument cannot be specified in conjunction with the `--lang` argument"
|
|
71376
|
+
);
|
|
71377
|
+
}
|
|
71378
|
+
args.lang = language;
|
|
71379
|
+
}
|
|
71380
|
+
var import_fs12, import_promises2, import_os2, import_path15, import_deepmerge, import_degit, defaultSelectVariant, getFrameworkMap, getTemplateMap, selectTemplate, selectFramework, selectLanguage, processRemoteTemplate, validateTemplate, validateTemplateSrcDirectory, inferTemplateConfig, inferCopyFilesDefinition, downloadRemoteTemplate, updatePackageName, updatePackageScripts, getTemplatePath, isVariantInfo, getCopyFilesDestinationDir, addWranglerToGitIgnore;
|
|
71386
71381
|
var init_templates = __esm({
|
|
71387
71382
|
"src/templates.ts"() {
|
|
71388
71383
|
import_fs12 = require("fs");
|
|
@@ -71399,8 +71394,7 @@ var init_templates = __esm({
|
|
|
71399
71394
|
init_files();
|
|
71400
71395
|
init_validators();
|
|
71401
71396
|
defaultSelectVariant = async (ctx) => {
|
|
71402
|
-
|
|
71403
|
-
return typescript ? "ts" : "js";
|
|
71397
|
+
return await selectLanguage(ctx);
|
|
71404
71398
|
};
|
|
71405
71399
|
getFrameworkMap = async () => ({
|
|
71406
71400
|
analog: (await Promise.resolve().then(() => (init_c3(), c3_exports))).default,
|
|
@@ -71421,48 +71415,88 @@ var init_templates = __esm({
|
|
|
71421
71415
|
getTemplateMap = async () => {
|
|
71422
71416
|
return {
|
|
71423
71417
|
"hello-world": (await Promise.resolve().then(() => (init_c315(), c3_exports15))).default,
|
|
71424
|
-
|
|
71425
|
-
|
|
71426
|
-
|
|
71427
|
-
|
|
71428
|
-
|
|
71429
|
-
|
|
71430
|
-
"hello-world-durable-object": (await Promise.resolve().then(() => (init_c320(), c3_exports20))).default,
|
|
71431
|
-
openapi: (await Promise.resolve().then(() => (init_c321(), c3_exports21))).default,
|
|
71432
|
-
// Dummy record -- actual template config resolved in `processRemoteTemplate`
|
|
71433
|
-
"remote-template": {
|
|
71434
|
-
displayName: "Worker built from a template hosted in a git repository"
|
|
71435
|
-
},
|
|
71436
|
-
"pre-existing": (await Promise.resolve().then(() => (init_c322(), c3_exports22))).default
|
|
71418
|
+
common: (await Promise.resolve().then(() => (init_c316(), c3_exports16))).default,
|
|
71419
|
+
scheduled: (await Promise.resolve().then(() => (init_c317(), c3_exports17))).default,
|
|
71420
|
+
queues: (await Promise.resolve().then(() => (init_c318(), c3_exports18))).default,
|
|
71421
|
+
"hello-world-durable-object": (await Promise.resolve().then(() => (init_c319(), c3_exports19))).default,
|
|
71422
|
+
openapi: (await Promise.resolve().then(() => (init_c320(), c3_exports20))).default,
|
|
71423
|
+
"pre-existing": (await Promise.resolve().then(() => (init_c321(), c3_exports21))).default
|
|
71437
71424
|
};
|
|
71438
71425
|
};
|
|
71439
71426
|
selectTemplate = async (args) => {
|
|
71440
|
-
if (
|
|
71441
|
-
|
|
71427
|
+
if (args.framework) {
|
|
71428
|
+
args.type ??= "web-framework";
|
|
71429
|
+
} else if (args.template) {
|
|
71430
|
+
args.type ??= "remote-template";
|
|
71431
|
+
} else if (args.existingScript) {
|
|
71432
|
+
args.type ??= "pre-existing";
|
|
71433
|
+
}
|
|
71434
|
+
switch (args.type) {
|
|
71435
|
+
case "hello-world":
|
|
71436
|
+
case "hello-world-durable-object":
|
|
71437
|
+
args.category ??= "hello-world";
|
|
71438
|
+
break;
|
|
71439
|
+
case "hello-world-python":
|
|
71440
|
+
args.category ??= "hello-world";
|
|
71441
|
+
args.type = "hello-world";
|
|
71442
|
+
args.lang = "python";
|
|
71443
|
+
break;
|
|
71444
|
+
case "webFramework":
|
|
71445
|
+
warn(
|
|
71446
|
+
"The `webFramework` type is deprecated and will be removed in a future version. Please use `web-framework` instead."
|
|
71447
|
+
);
|
|
71448
|
+
args.category ??= "web-framework";
|
|
71442
71449
|
args.type = "web-framework";
|
|
71443
|
-
|
|
71444
|
-
|
|
71445
|
-
|
|
71446
|
-
args.
|
|
71447
|
-
|
|
71450
|
+
break;
|
|
71451
|
+
case "web-framework":
|
|
71452
|
+
case "remote-template":
|
|
71453
|
+
args.category ??= args.type;
|
|
71454
|
+
break;
|
|
71455
|
+
case "common":
|
|
71456
|
+
case "scheduled":
|
|
71457
|
+
case "queues":
|
|
71458
|
+
case "openapi":
|
|
71459
|
+
args.category ??= "demo";
|
|
71460
|
+
break;
|
|
71461
|
+
case "pre-existing":
|
|
71462
|
+
args.category ??= "others";
|
|
71463
|
+
break;
|
|
71448
71464
|
}
|
|
71449
|
-
|
|
71450
|
-
|
|
71451
|
-
|
|
71452
|
-
|
|
71453
|
-
|
|
71465
|
+
const category = await processArgument(args, "category", {
|
|
71466
|
+
type: "select",
|
|
71467
|
+
question: "What would you like to start with?",
|
|
71468
|
+
label: "category",
|
|
71469
|
+
options: [
|
|
71470
|
+
{ label: "Hello World example", value: "hello-world" },
|
|
71471
|
+
{ label: "Framework Starter", value: "web-framework" },
|
|
71472
|
+
{ label: "Demo application", value: "demo" },
|
|
71473
|
+
{ label: "Template from a Github repo", value: "remote-template" },
|
|
71474
|
+
// This is used only if the type is `pre-existing`
|
|
71475
|
+
{ label: "Others", value: "others", hidden: true }
|
|
71476
|
+
],
|
|
71477
|
+
defaultValue: C3_DEFAULTS.category
|
|
71478
|
+
});
|
|
71479
|
+
if (category === "web-framework") {
|
|
71480
|
+
return selectFramework(args);
|
|
71481
|
+
}
|
|
71482
|
+
if (category === "remote-template") {
|
|
71483
|
+
return processRemoteTemplate(args);
|
|
71454
71484
|
}
|
|
71455
71485
|
const templateMap = await getTemplateMap();
|
|
71456
71486
|
const templateOptions = Object.entries(templateMap).map(
|
|
71457
|
-
([value, { displayName, hidden: hidden2 }]) =>
|
|
71458
|
-
value
|
|
71459
|
-
|
|
71460
|
-
|
|
71461
|
-
|
|
71487
|
+
([value, { displayName, hidden: hidden2 }]) => {
|
|
71488
|
+
const isHelloWorldExample = value.startsWith("hello-world");
|
|
71489
|
+
const isCategoryMatched = category === "hello-world" ? isHelloWorldExample : !isHelloWorldExample;
|
|
71490
|
+
return {
|
|
71491
|
+
value,
|
|
71492
|
+
label: displayName,
|
|
71493
|
+
hidden: hidden2 || !isCategoryMatched
|
|
71494
|
+
};
|
|
71495
|
+
}
|
|
71462
71496
|
);
|
|
71463
71497
|
const type = await processArgument(args, "type", {
|
|
71464
71498
|
type: "select",
|
|
71465
|
-
question: "
|
|
71499
|
+
question: "Which template would you like to use?",
|
|
71466
71500
|
label: "type",
|
|
71467
71501
|
options: templateOptions,
|
|
71468
71502
|
defaultValue: C3_DEFAULTS.type
|
|
@@ -71473,12 +71507,6 @@ var init_templates = __esm({
|
|
|
71473
71507
|
if (!Object.keys(templateMap).includes(type)) {
|
|
71474
71508
|
return crash(`Unknown application type provided: ${type}.`);
|
|
71475
71509
|
}
|
|
71476
|
-
if (type === "web-framework") {
|
|
71477
|
-
return selectFramework(args);
|
|
71478
|
-
}
|
|
71479
|
-
if (type === "remote-template") {
|
|
71480
|
-
return processRemoteTemplate(args);
|
|
71481
|
-
}
|
|
71482
71510
|
return templateMap[type];
|
|
71483
71511
|
};
|
|
71484
71512
|
selectFramework = async (args) => {
|
|
@@ -71511,18 +71539,26 @@ var init_templates = __esm({
|
|
|
71511
71539
|
...frameworkMap[framework]
|
|
71512
71540
|
};
|
|
71513
71541
|
};
|
|
71514
|
-
|
|
71542
|
+
selectLanguage = async (ctx) => {
|
|
71515
71543
|
if (usesTypescript(ctx)) {
|
|
71516
|
-
return
|
|
71544
|
+
return "ts";
|
|
71517
71545
|
}
|
|
71518
71546
|
if (ctx.template.generate) {
|
|
71519
|
-
return
|
|
71520
|
-
}
|
|
71521
|
-
|
|
71522
|
-
|
|
71523
|
-
|
|
71524
|
-
label: "
|
|
71525
|
-
|
|
71547
|
+
return "js";
|
|
71548
|
+
}
|
|
71549
|
+
inferLanguageArg(ctx.args);
|
|
71550
|
+
const variants = ctx.template.copyFiles && !isVariantInfo(ctx.template.copyFiles) ? Object.keys(ctx.template.copyFiles.variants) : [];
|
|
71551
|
+
const languageOptions = [
|
|
71552
|
+
{ label: "TypeScript", value: "ts" },
|
|
71553
|
+
{ label: "JavaScript", value: "js" },
|
|
71554
|
+
{ label: "Python", value: "python" }
|
|
71555
|
+
].filter((option) => variants.includes(option.value));
|
|
71556
|
+
return processArgument(ctx.args, "lang", {
|
|
71557
|
+
type: "select",
|
|
71558
|
+
question: "Which language do you want to use?",
|
|
71559
|
+
label: "lang",
|
|
71560
|
+
options: languageOptions,
|
|
71561
|
+
defaultValue: C3_DEFAULTS.lang
|
|
71526
71562
|
});
|
|
71527
71563
|
};
|
|
71528
71564
|
processRemoteTemplate = async (args) => {
|
|
@@ -76923,6 +76959,17 @@ var cliDefinition = {
|
|
|
76923
76959
|
}
|
|
76924
76960
|
],
|
|
76925
76961
|
options: [
|
|
76962
|
+
{
|
|
76963
|
+
name: "category",
|
|
76964
|
+
type: "string",
|
|
76965
|
+
description: `Specifies the kind of templates that should be created`,
|
|
76966
|
+
values: [
|
|
76967
|
+
{ name: "hello-world", description: "Hello World example" },
|
|
76968
|
+
{ name: "web-framework", description: "Framework Starter" },
|
|
76969
|
+
{ name: "demo", description: "Demo application" },
|
|
76970
|
+
{ name: "remote-template", description: "Template from a Github repo" }
|
|
76971
|
+
]
|
|
76972
|
+
},
|
|
76926
76973
|
{
|
|
76927
76974
|
name: "type",
|
|
76928
76975
|
alias: "t",
|
|
@@ -76931,13 +76978,9 @@ var cliDefinition = {
|
|
|
76931
76978
|
description: `
|
|
76932
76979
|
When using a built-in template, specifies the type of application that should be created.
|
|
76933
76980
|
|
|
76934
|
-
Note that "--
|
|
76981
|
+
Note that "--category" and "--template" are mutually exclusive options. If both are provided, "--category" will be used.
|
|
76935
76982
|
`,
|
|
76936
76983
|
values: [
|
|
76937
|
-
{
|
|
76938
|
-
name: "web-framework",
|
|
76939
|
-
description: "A website or web application."
|
|
76940
|
-
},
|
|
76941
76984
|
{
|
|
76942
76985
|
name: "hello-world",
|
|
76943
76986
|
description: "A basic \u201CHello World\u201D Cloudflare Worker."
|
|
@@ -76973,7 +77016,7 @@ var cliDefinition = {
|
|
|
76973
77016
|
alias: "f",
|
|
76974
77017
|
type: "string",
|
|
76975
77018
|
requiresArg: true,
|
|
76976
|
-
description: `The type of framework to use to create a web application (when using this option "--
|
|
77019
|
+
description: `The type of framework to use to create a web application (when using this option "--category" is coerced to "web-framework")
|
|
76977
77020
|
|
|
76978
77021
|
When using the --framework option, C3 will dispatch to the official creation tool used by the framework (ex. "create-remix" is used for Remix).
|
|
76979
77022
|
|
|
@@ -76999,6 +77042,12 @@ var cliDefinition = {
|
|
|
76999
77042
|
{ name: "vue" }
|
|
77000
77043
|
]
|
|
77001
77044
|
},
|
|
77045
|
+
{
|
|
77046
|
+
name: "lang",
|
|
77047
|
+
type: "string",
|
|
77048
|
+
description: `The programming language of the template`,
|
|
77049
|
+
values: [{ name: "ts" }, { name: "js" }, { name: "python" }]
|
|
77050
|
+
},
|
|
77002
77051
|
{
|
|
77003
77052
|
name: "deploy",
|
|
77004
77053
|
type: "boolean",
|
|
@@ -77007,7 +77056,8 @@ var cliDefinition = {
|
|
|
77007
77056
|
{
|
|
77008
77057
|
name: "ts",
|
|
77009
77058
|
type: "boolean",
|
|
77010
|
-
description: "Use TypeScript in your application"
|
|
77059
|
+
description: "Use TypeScript in your application",
|
|
77060
|
+
hidden: true
|
|
77011
77061
|
},
|
|
77012
77062
|
{
|
|
77013
77063
|
name: "git",
|
|
@@ -80064,7 +80114,7 @@ var runCli = async (args) => {
|
|
|
80064
80114
|
};
|
|
80065
80115
|
const originalCWD = process.cwd();
|
|
80066
80116
|
const { name, path: path4 } = setupProjectDirectory(validatedArgs);
|
|
80067
|
-
const template = await selectTemplate(
|
|
80117
|
+
const template = await selectTemplate(validatedArgs);
|
|
80068
80118
|
const ctx = {
|
|
80069
80119
|
project: { name, path: path4 },
|
|
80070
80120
|
args: validatedArgs,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-cloudflare",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.0",
|
|
4
4
|
"description": "A CLI for creating and deploying new applications to Cloudflare.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@babel/parser": "^7.21.3",
|
|
30
30
|
"@babel/types": "^7.21.4",
|
|
31
31
|
"@clack/prompts": "^0.6.3",
|
|
32
|
-
"@cloudflare/workers-types": "^4.
|
|
32
|
+
"@cloudflare/workers-types": "^4.20240725.0",
|
|
33
33
|
"@iarna/toml": "^3.0.0",
|
|
34
34
|
"@types/command-exists": "^1.2.0",
|
|
35
35
|
"@types/cross-spawn": "^6.0.2",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"yargs": "^17.7.2",
|
|
67
67
|
"@cloudflare/cli": "1.1.1",
|
|
68
68
|
"@cloudflare/eslint-config-worker": "1.1.0",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
69
|
+
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
70
|
+
"wrangler": "3.68.0"
|
|
71
71
|
},
|
|
72
72
|
"engines": {
|
|
73
73
|
"node": ">=18.14.1"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
configVersion: 1,
|
|
3
3
|
id: "hello-world",
|
|
4
|
-
displayName:
|
|
4
|
+
displayName: "Hello World Worker",
|
|
5
5
|
platform: "workers",
|
|
6
6
|
copyFiles: {
|
|
7
7
|
variants: {
|
|
@@ -11,6 +11,9 @@ export default {
|
|
|
11
11
|
ts: {
|
|
12
12
|
path: "./ts",
|
|
13
13
|
},
|
|
14
|
+
python: {
|
|
15
|
+
path: "./py",
|
|
16
|
+
},
|
|
14
17
|
},
|
|
15
18
|
},
|
|
16
19
|
};
|
|
@@ -98,5 +98,6 @@
|
|
|
98
98
|
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
99
99
|
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
100
100
|
},
|
|
101
|
-
"exclude": ["test"]
|
|
101
|
+
"exclude": ["test"],
|
|
102
|
+
"include": ["worker-configuration.d.ts", "src/**/*.ts"]
|
|
102
103
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|