create-cloudflare 0.0.0-c5f3bf45 → 0.0.0-cb26366c
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/angular/templates/tools/bundle.mjs +5 -2
- package/dist/cli.js +357 -285
- package/package.json +1 -1
- package/templates/chatgptPlugin/ts/wrangler.toml +2 -2
- package/templates/common/js/package.json +0 -1
- package/templates/common/js/wrangler.toml +1 -1
- package/templates/common/ts/wrangler.toml +1 -1
- package/templates/hello-world/js/package.json +0 -2
- package/templates/hello-world/js/wrangler.toml +1 -1
- package/templates/hello-world/ts/wrangler.toml +1 -1
- package/templates/queues/js/package.json +0 -2
- package/templates/queues/js/wrangler.toml +1 -1
- package/templates/queues/ts/wrangler.toml +1 -1
- package/templates/scheduled/js/package.json +0 -2
- package/templates/scheduled/js/wrangler.toml +1 -1
|
@@ -37,7 +37,8 @@ async function bundleMain() {
|
|
|
37
37
|
],
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
// Store the original promise (before Angular/Zone.js replaces it) on the global scope.
|
|
41
|
+
let main = "globalThis.OGPromise = Promise;\n" + result.outputFiles[0].text;
|
|
41
42
|
|
|
42
43
|
// Patch any dynamic imports (converting `require()` calls to `import()` calls).
|
|
43
44
|
main = main.replace(
|
|
@@ -45,7 +46,9 @@ async function bundleMain() {
|
|
|
45
46
|
'promises.push(import("./" + __webpack_require__.u(chunkId)).then((mod) => installChunk(mod.default))'
|
|
46
47
|
);
|
|
47
48
|
// Export the fetch handler (grabbing it from the global).
|
|
48
|
-
|
|
49
|
+
// Also Cloudflare expects `fetch()` to return an original Promise (not a ZoneAwarePromise).
|
|
50
|
+
main +=
|
|
51
|
+
"\nexport default { fetch: (request, env) => globalThis.OGPromise.resolve(globalThis.__workerFetchHandler(request, env)) };";
|
|
49
52
|
|
|
50
53
|
await fs.writeFile(path.resolve(workerPath, "index.js"), main);
|
|
51
54
|
}
|
package/dist/cli.js
CHANGED
|
@@ -52612,7 +52612,9 @@ var require_typescript2 = __commonJS({
|
|
|
52612
52612
|
// src/cli.ts
|
|
52613
52613
|
var cli_exports = {};
|
|
52614
52614
|
__export(cli_exports, {
|
|
52615
|
-
|
|
52615
|
+
C3_DEFAULTS: () => C3_DEFAULTS,
|
|
52616
|
+
main: () => main,
|
|
52617
|
+
parseArgs: () => parseArgs
|
|
52616
52618
|
});
|
|
52617
52619
|
module.exports = __toCommonJS(cli_exports);
|
|
52618
52620
|
var import_haikunator = __toESM(require_dist_node());
|
|
@@ -53153,8 +53155,6 @@ var space = (n = 1) => {
|
|
|
53153
53155
|
return hidden("\u200A".repeat(n));
|
|
53154
53156
|
};
|
|
53155
53157
|
var logRaw = (msg) => {
|
|
53156
|
-
if (process.env.VITEST)
|
|
53157
|
-
return;
|
|
53158
53158
|
process.stdout.write(`${msg}
|
|
53159
53159
|
`);
|
|
53160
53160
|
};
|
|
@@ -54347,174 +54347,165 @@ var logUpdateStderr = createLogUpdate(import_node_process6.default.stderr);
|
|
|
54347
54347
|
var grayBar = gray(shapes.bar);
|
|
54348
54348
|
var blCorner = gray(shapes.corners.bl);
|
|
54349
54349
|
var leftT = gray(shapes.leftT);
|
|
54350
|
-
var
|
|
54351
|
-
|
|
54352
|
-
const
|
|
54353
|
-
|
|
54354
|
-
|
|
54355
|
-
|
|
54356
|
-
|
|
54357
|
-
|
|
54358
|
-
|
|
54359
|
-
|
|
54360
|
-
case "initial":
|
|
54361
|
-
body += `${blCorner} ${bold(question)} ${dim(helpText)}
|
|
54362
|
-
`;
|
|
54363
|
-
body += `${space(2)}${gray(format3(defaultValue))}
|
|
54364
|
-
`;
|
|
54365
|
-
break;
|
|
54366
|
-
case "active":
|
|
54367
|
-
body += `${blCorner} ${bold(question)} ${dim(helpText)}
|
|
54368
|
-
`;
|
|
54369
|
-
body += `${space(2)}${format3(this.value || dim(defaultValue))}
|
|
54370
|
-
`;
|
|
54371
|
-
break;
|
|
54372
|
-
case "submit":
|
|
54373
|
-
body += `${leftT} ${question}
|
|
54374
|
-
`;
|
|
54375
|
-
body += `${grayBar} ${renderSubmitted(
|
|
54376
|
-
format3(this.value)
|
|
54377
|
-
)}
|
|
54378
|
-
${grayBar}`;
|
|
54379
|
-
break;
|
|
54380
|
-
case "error":
|
|
54381
|
-
body += `${leftT} ${status.error} ${dim(this.error)}
|
|
54382
|
-
`;
|
|
54383
|
-
body += `${grayBar}
|
|
54384
|
-
`;
|
|
54385
|
-
body += `${blCorner} ${question} ${dim(helpText)}
|
|
54386
|
-
`;
|
|
54387
|
-
body += `${space(2)}${format3(this.value)}
|
|
54388
|
-
`;
|
|
54389
|
-
break;
|
|
54390
|
-
default:
|
|
54391
|
-
break;
|
|
54392
|
-
}
|
|
54393
|
-
return body;
|
|
54394
|
-
}
|
|
54395
|
-
});
|
|
54396
|
-
let value;
|
|
54397
|
-
if (acceptDefault) {
|
|
54398
|
-
logRaw(`${leftT} ${question}`);
|
|
54399
|
-
logRaw(`${grayBar} ${renderSubmitted(defaultValue)}
|
|
54400
|
-
${grayBar}`);
|
|
54401
|
-
value = defaultValue;
|
|
54402
|
-
validate?.(value);
|
|
54403
|
-
} else {
|
|
54404
|
-
value = await prompt.prompt();
|
|
54405
|
-
if (eD(value)) {
|
|
54406
|
-
cancel("Operation cancelled.");
|
|
54407
|
-
process.exit(0);
|
|
54408
|
-
}
|
|
54409
|
-
}
|
|
54350
|
+
var processArgument = async (args, name, promptConfig) => {
|
|
54351
|
+
let value = args[name];
|
|
54352
|
+
const renderSubmitted = getRenderers(promptConfig).submit;
|
|
54353
|
+
if (value !== void 0) {
|
|
54354
|
+
promptConfig.validate?.(value);
|
|
54355
|
+
const lines = renderSubmitted({ value });
|
|
54356
|
+
logRaw(lines.join("\n"));
|
|
54357
|
+
return value;
|
|
54358
|
+
}
|
|
54359
|
+
value = await inputPrompt(promptConfig);
|
|
54410
54360
|
return value;
|
|
54411
54361
|
};
|
|
54412
|
-
var
|
|
54413
|
-
const
|
|
54414
|
-
|
|
54415
|
-
const
|
|
54416
|
-
|
|
54417
|
-
|
|
54418
|
-
|
|
54419
|
-
|
|
54420
|
-
|
|
54421
|
-
|
|
54422
|
-
|
|
54423
|
-
|
|
54424
|
-
|
|
54425
|
-
|
|
54426
|
-
let body = ``;
|
|
54427
|
-
switch (this.state) {
|
|
54428
|
-
case "submit":
|
|
54429
|
-
body += `${leftT} ${question}
|
|
54430
|
-
`;
|
|
54431
|
-
body += `${grayBar} ${renderSubmitted(options[this.cursor])}`;
|
|
54432
|
-
body += `
|
|
54433
|
-
${grayBar}`;
|
|
54434
|
-
break;
|
|
54435
|
-
default:
|
|
54436
|
-
body += `${blCorner} ${bold(question)} ${dim(helpText)}
|
|
54437
|
-
`;
|
|
54438
|
-
body += `${options.map(renderOption).join(`
|
|
54439
|
-
`)}
|
|
54440
|
-
`;
|
|
54441
|
-
break;
|
|
54362
|
+
var inputPrompt = async (promptConfig) => {
|
|
54363
|
+
const renderers = getRenderers(promptConfig);
|
|
54364
|
+
let prompt;
|
|
54365
|
+
const dispatchRender = (props) => {
|
|
54366
|
+
const renderedLines = renderers[props.state](props);
|
|
54367
|
+
return renderedLines.join("\n");
|
|
54368
|
+
};
|
|
54369
|
+
if (promptConfig.type === "select") {
|
|
54370
|
+
prompt = new ED({
|
|
54371
|
+
...promptConfig,
|
|
54372
|
+
options: promptConfig.options,
|
|
54373
|
+
initialValue: String(promptConfig.defaultValue),
|
|
54374
|
+
render() {
|
|
54375
|
+
return dispatchRender(this);
|
|
54442
54376
|
}
|
|
54443
|
-
|
|
54444
|
-
|
|
54445
|
-
|
|
54446
|
-
|
|
54447
|
-
|
|
54448
|
-
|
|
54449
|
-
|
|
54450
|
-
|
|
54451
|
-
|
|
54452
|
-
|
|
54453
|
-
|
|
54454
|
-
);
|
|
54455
|
-
logRaw(`${grayBar}`);
|
|
54456
|
-
value = defaultValue;
|
|
54377
|
+
});
|
|
54378
|
+
} else if (promptConfig.type === "confirm") {
|
|
54379
|
+
prompt = new sD({
|
|
54380
|
+
...promptConfig,
|
|
54381
|
+
initialValue: Boolean(promptConfig.defaultValue),
|
|
54382
|
+
active: promptConfig.activeText || "",
|
|
54383
|
+
inactive: promptConfig.inactiveText || "",
|
|
54384
|
+
render() {
|
|
54385
|
+
return dispatchRender(this);
|
|
54386
|
+
}
|
|
54387
|
+
});
|
|
54457
54388
|
} else {
|
|
54458
|
-
|
|
54459
|
-
|
|
54460
|
-
|
|
54461
|
-
|
|
54462
|
-
|
|
54389
|
+
prompt = new oD({
|
|
54390
|
+
...promptConfig,
|
|
54391
|
+
defaultValue: String(promptConfig.defaultValue),
|
|
54392
|
+
render() {
|
|
54393
|
+
return dispatchRender(this);
|
|
54394
|
+
}
|
|
54395
|
+
});
|
|
54463
54396
|
}
|
|
54464
|
-
|
|
54397
|
+
const input = await prompt.prompt();
|
|
54398
|
+
if (eD(input)) {
|
|
54399
|
+
cancel("Operation cancelled.");
|
|
54400
|
+
process.exit(0);
|
|
54401
|
+
}
|
|
54402
|
+
return input;
|
|
54403
|
+
};
|
|
54404
|
+
var renderSubmit = (config14, value) => {
|
|
54405
|
+
const { question, label } = config14;
|
|
54406
|
+
const content = config14.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
|
|
54407
|
+
return [`${leftT} ${question}`, content, `${grayBar}`];
|
|
54408
|
+
};
|
|
54409
|
+
var handleCancel = () => {
|
|
54410
|
+
cancel("Operation cancelled.");
|
|
54411
|
+
process.exit(0);
|
|
54465
54412
|
};
|
|
54466
|
-
var
|
|
54413
|
+
var getRenderers = (config14) => {
|
|
54414
|
+
switch (config14.type) {
|
|
54415
|
+
case "select":
|
|
54416
|
+
return getSelectRenderers(config14);
|
|
54417
|
+
case "confirm":
|
|
54418
|
+
return getConfirmRenderers(config14);
|
|
54419
|
+
case "text":
|
|
54420
|
+
return getTextRenderers(config14);
|
|
54421
|
+
}
|
|
54422
|
+
};
|
|
54423
|
+
var getTextRenderers = (config14) => {
|
|
54467
54424
|
const {
|
|
54468
|
-
|
|
54469
|
-
inactiveText,
|
|
54425
|
+
defaultValue,
|
|
54470
54426
|
question,
|
|
54471
|
-
|
|
54472
|
-
|
|
54473
|
-
|
|
54474
|
-
|
|
54475
|
-
const
|
|
54427
|
+
helpText: _helpText,
|
|
54428
|
+
format: _format
|
|
54429
|
+
} = config14;
|
|
54430
|
+
const helpText = _helpText ?? "";
|
|
54431
|
+
const format3 = _format ?? ((val) => String(val));
|
|
54432
|
+
return {
|
|
54433
|
+
initial: () => [
|
|
54434
|
+
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
|
54435
|
+
`${space(2)}${gray(format3(defaultValue))}`,
|
|
54436
|
+
``
|
|
54437
|
+
// extra line for readability
|
|
54438
|
+
],
|
|
54439
|
+
active: ({ value }) => [
|
|
54440
|
+
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
|
54441
|
+
`${space(2)}${format3(value || dim(defaultValue))}`,
|
|
54442
|
+
``
|
|
54443
|
+
// extra line for readability
|
|
54444
|
+
],
|
|
54445
|
+
error: ({ value, error }) => [
|
|
54446
|
+
`${leftT} ${status.error} ${dim(error)}`,
|
|
54447
|
+
`${grayBar}`,
|
|
54448
|
+
`${blCorner} ${question} ${dim(helpText)}`,
|
|
54449
|
+
`${space(2)}${format3(value)}`,
|
|
54450
|
+
``
|
|
54451
|
+
// extra line for readability
|
|
54452
|
+
],
|
|
54453
|
+
submit: ({ value }) => renderSubmit(config14, format3(value)),
|
|
54454
|
+
cancel: handleCancel
|
|
54455
|
+
};
|
|
54456
|
+
};
|
|
54457
|
+
var getSelectRenderers = (config14) => {
|
|
54458
|
+
const { options, question, helpText: _helpText } = config14;
|
|
54459
|
+
const helpText = _helpText ?? "";
|
|
54460
|
+
const defaultRenderer = ({ cursor }) => {
|
|
54461
|
+
const renderOption = (opt, i) => {
|
|
54462
|
+
const { label: optionLabel } = opt;
|
|
54463
|
+
const active = i === cursor;
|
|
54464
|
+
const text = active ? blue.underline(optionLabel) : dim(optionLabel);
|
|
54465
|
+
const indicator = active ? blue(shapes.radioActive) : dim(shapes.radioInactive);
|
|
54466
|
+
return `${space(2)}${indicator} ${text}`;
|
|
54467
|
+
};
|
|
54468
|
+
return [
|
|
54469
|
+
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
|
54470
|
+
`${options.map(renderOption).join(`
|
|
54471
|
+
`)}`,
|
|
54472
|
+
``
|
|
54473
|
+
// extra line for readability
|
|
54474
|
+
];
|
|
54475
|
+
};
|
|
54476
|
+
return {
|
|
54477
|
+
initial: defaultRenderer,
|
|
54478
|
+
active: defaultRenderer,
|
|
54479
|
+
confirm: defaultRenderer,
|
|
54480
|
+
error: defaultRenderer,
|
|
54481
|
+
submit: ({ value }) => renderSubmit(
|
|
54482
|
+
config14,
|
|
54483
|
+
options.find((o2) => o2.value === value)?.label
|
|
54484
|
+
),
|
|
54485
|
+
cancel: handleCancel
|
|
54486
|
+
};
|
|
54487
|
+
};
|
|
54488
|
+
var getConfirmRenderers = (config14) => {
|
|
54489
|
+
const { activeText, inactiveText, question, helpText: _helpText } = config14;
|
|
54490
|
+
const helpText = _helpText ?? "";
|
|
54476
54491
|
const active = activeText || "Yes";
|
|
54477
54492
|
const inactive = inactiveText || "No";
|
|
54478
|
-
const
|
|
54479
|
-
|
|
54480
|
-
|
|
54481
|
-
|
|
54482
|
-
|
|
54483
|
-
|
|
54484
|
-
|
|
54485
|
-
|
|
54486
|
-
|
|
54487
|
-
|
|
54488
|
-
|
|
54489
|
-
|
|
54490
|
-
|
|
54491
|
-
|
|
54492
|
-
|
|
54493
|
-
|
|
54494
|
-
default:
|
|
54495
|
-
body += `${blCorner} ${bold(question)} ${dim(helpText)}
|
|
54496
|
-
`;
|
|
54497
|
-
body += `${space(2)}${yesColor(active)} / ${noColor(inactive)}
|
|
54498
|
-
`;
|
|
54499
|
-
break;
|
|
54500
|
-
}
|
|
54501
|
-
return body;
|
|
54502
|
-
}
|
|
54503
|
-
});
|
|
54504
|
-
let value;
|
|
54505
|
-
if (acceptDefault) {
|
|
54506
|
-
logRaw(`${leftT} ${question}`);
|
|
54507
|
-
logRaw(`${grayBar} ${renderSubmitted(defaultValue)}`);
|
|
54508
|
-
logRaw(`${grayBar}`);
|
|
54509
|
-
value = defaultValue;
|
|
54510
|
-
} else {
|
|
54511
|
-
value = Boolean(await prompt.prompt());
|
|
54512
|
-
if (eD(value)) {
|
|
54513
|
-
cancel("Operation cancelled.");
|
|
54514
|
-
process.exit(0);
|
|
54515
|
-
}
|
|
54516
|
-
}
|
|
54517
|
-
return value;
|
|
54493
|
+
const defaultRenderer = ({ value }) => {
|
|
54494
|
+
const yesColor = value ? blue : dim;
|
|
54495
|
+
const noColor = value ? dim : blue;
|
|
54496
|
+
return [
|
|
54497
|
+
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
|
54498
|
+
`${space(2)}${yesColor(active)} / ${noColor(inactive)}`
|
|
54499
|
+
];
|
|
54500
|
+
};
|
|
54501
|
+
return {
|
|
54502
|
+
initial: defaultRenderer,
|
|
54503
|
+
active: defaultRenderer,
|
|
54504
|
+
confirm: defaultRenderer,
|
|
54505
|
+
error: defaultRenderer,
|
|
54506
|
+
submit: ({ value }) => renderSubmit(config14, value ? "yes" : "no"),
|
|
54507
|
+
cancel: handleCancel
|
|
54508
|
+
};
|
|
54518
54509
|
};
|
|
54519
54510
|
var spinner = () => {
|
|
54520
54511
|
const spinnerFrames = ["\u2524", "\u2518", "\u2534", "\u2514", "\u251C", "\u250C", "\u252C", "\u2510"];
|
|
@@ -59419,7 +59410,7 @@ var Yargs = YargsFactory(esm_default);
|
|
|
59419
59410
|
var yargs_default = Yargs;
|
|
59420
59411
|
|
|
59421
59412
|
// package.json
|
|
59422
|
-
var version = "0.0.0-
|
|
59413
|
+
var version = "0.0.0-cb26366c";
|
|
59423
59414
|
|
|
59424
59415
|
// src/common.ts
|
|
59425
59416
|
var import_fs6 = require("fs");
|
|
@@ -59474,29 +59465,28 @@ var detectPackageManager = () => {
|
|
|
59474
59465
|
};
|
|
59475
59466
|
|
|
59476
59467
|
// src/helpers/command.ts
|
|
59477
|
-
var runCommand = async (command2, opts) => {
|
|
59468
|
+
var runCommand = async (command2, opts = {}) => {
|
|
59478
59469
|
if (typeof command2 === "string") {
|
|
59479
59470
|
command2 = command2.trim().replace(/\s+/g, ` `).split(" ");
|
|
59480
59471
|
}
|
|
59481
59472
|
return printAsyncStatus({
|
|
59482
|
-
useSpinner: opts
|
|
59483
|
-
startText: opts
|
|
59484
|
-
doneText: opts
|
|
59473
|
+
useSpinner: opts.useSpinner ?? opts.silent,
|
|
59474
|
+
startText: opts.startText || command2.join(" ").trim(),
|
|
59475
|
+
doneText: opts.doneText,
|
|
59485
59476
|
promise() {
|
|
59486
59477
|
const [executable, ...args] = command2;
|
|
59487
|
-
const squelch = opts?.silent || process.env.VITEST;
|
|
59488
59478
|
const cmd = (0, import_cross_spawn.spawn)(executable, [...args], {
|
|
59489
59479
|
// TODO: ideally inherit stderr, but npm install uses this for warnings
|
|
59490
59480
|
// stdio: [ioMode, ioMode, "inherit"],
|
|
59491
|
-
stdio:
|
|
59481
|
+
stdio: opts.silent ? "pipe" : "inherit",
|
|
59492
59482
|
env: {
|
|
59493
59483
|
...process.env,
|
|
59494
|
-
...opts
|
|
59484
|
+
...opts.env
|
|
59495
59485
|
},
|
|
59496
|
-
cwd: opts
|
|
59486
|
+
cwd: opts.cwd
|
|
59497
59487
|
});
|
|
59498
59488
|
let output = ``;
|
|
59499
|
-
if (opts
|
|
59489
|
+
if (opts.captureOutput ?? opts.silent) {
|
|
59500
59490
|
cmd.stdout?.on("data", (data) => {
|
|
59501
59491
|
output += data;
|
|
59502
59492
|
});
|
|
@@ -59506,12 +59496,24 @@ var runCommand = async (command2, opts) => {
|
|
|
59506
59496
|
}
|
|
59507
59497
|
return new Promise((resolve9, reject) => {
|
|
59508
59498
|
cmd.on("close", (code) => {
|
|
59509
|
-
|
|
59510
|
-
|
|
59511
|
-
|
|
59512
|
-
|
|
59499
|
+
try {
|
|
59500
|
+
if (code !== 0) {
|
|
59501
|
+
throw new Error(output, { cause: code });
|
|
59502
|
+
}
|
|
59503
|
+
const transformOutput = opts.transformOutput ?? ((result) => result);
|
|
59504
|
+
const processedOutput = transformOutput(stripAnsi(output));
|
|
59505
|
+
resolve9(processedOutput);
|
|
59506
|
+
} catch (e) {
|
|
59507
|
+
if (opts.fallbackOutput) {
|
|
59508
|
+
resolve9(opts.fallbackOutput(e));
|
|
59509
|
+
} else {
|
|
59510
|
+
reject(new Error(output, { cause: e }));
|
|
59511
|
+
}
|
|
59513
59512
|
}
|
|
59514
59513
|
});
|
|
59514
|
+
cmd.on("error", (code) => {
|
|
59515
|
+
reject(code);
|
|
59516
|
+
});
|
|
59515
59517
|
});
|
|
59516
59518
|
}
|
|
59517
59519
|
});
|
|
@@ -59522,9 +59524,11 @@ async function runCommands({ commands, ...opts }) {
|
|
|
59522
59524
|
startText: opts.startText,
|
|
59523
59525
|
doneText: opts.doneText,
|
|
59524
59526
|
async promise() {
|
|
59527
|
+
const results = [];
|
|
59525
59528
|
for (const command2 of commands) {
|
|
59526
|
-
await runCommand(command2, { ...opts, useSpinner: false });
|
|
59529
|
+
results.push(await runCommand(command2, { ...opts, useSpinner: false }));
|
|
59527
59530
|
}
|
|
59531
|
+
return results.join("\n");
|
|
59528
59532
|
}
|
|
59529
59533
|
});
|
|
59530
59534
|
}
|
|
@@ -59541,8 +59545,9 @@ var printAsyncStatus = async ({
|
|
|
59541
59545
|
promise = promise();
|
|
59542
59546
|
}
|
|
59543
59547
|
try {
|
|
59544
|
-
await promise;
|
|
59545
|
-
|
|
59548
|
+
const output = await promise;
|
|
59549
|
+
const doneText = typeof opts.doneText === "function" ? opts.doneText(output) : opts.doneText;
|
|
59550
|
+
s?.stop(doneText);
|
|
59546
59551
|
} catch (err) {
|
|
59547
59552
|
s?.stop(err.message);
|
|
59548
59553
|
} finally {
|
|
@@ -59619,10 +59624,14 @@ var installWrangler = async () => {
|
|
|
59619
59624
|
};
|
|
59620
59625
|
var isLoggedIn = async () => {
|
|
59621
59626
|
const { npx: npx6 } = detectPackageManager();
|
|
59622
|
-
|
|
59623
|
-
|
|
59624
|
-
|
|
59625
|
-
|
|
59627
|
+
try {
|
|
59628
|
+
const output = await runCommand(`${npx6} wrangler whoami`, {
|
|
59629
|
+
silent: true
|
|
59630
|
+
});
|
|
59631
|
+
return /You are logged in/.test(output);
|
|
59632
|
+
} catch (error) {
|
|
59633
|
+
return false;
|
|
59634
|
+
}
|
|
59626
59635
|
};
|
|
59627
59636
|
var wranglerLogin = async () => {
|
|
59628
59637
|
const { npx: npx6 } = detectPackageManager();
|
|
@@ -59655,6 +59664,24 @@ var listAccounts = async () => {
|
|
|
59655
59664
|
});
|
|
59656
59665
|
return accounts;
|
|
59657
59666
|
};
|
|
59667
|
+
async function getWorkerdCompatibilityDate() {
|
|
59668
|
+
const { npm: npm12 } = detectPackageManager();
|
|
59669
|
+
return runCommand(`${npm12} info workerd dist-tags.latest`, {
|
|
59670
|
+
silent: true,
|
|
59671
|
+
captureOutput: true,
|
|
59672
|
+
startText: "Retrieving current workerd compatibility date",
|
|
59673
|
+
transformOutput: (result) => {
|
|
59674
|
+
const match = result.match(/\d+\.(\d{4})(\d{2})(\d{2})\.\d+/);
|
|
59675
|
+
if (!match) {
|
|
59676
|
+
throw new Error("Could not find workerd date");
|
|
59677
|
+
}
|
|
59678
|
+
const [, year, month, date] = match;
|
|
59679
|
+
return `${year}-${month}-${date}`;
|
|
59680
|
+
},
|
|
59681
|
+
fallbackOutput: () => "2023-05-18",
|
|
59682
|
+
doneText: (output) => `${brandColor("compatibility date")} ${dim(output)}`
|
|
59683
|
+
});
|
|
59684
|
+
}
|
|
59658
59685
|
|
|
59659
59686
|
// src/helpers/poll.ts
|
|
59660
59687
|
var import_promises = require("node:dns/promises");
|
|
@@ -59749,14 +59776,12 @@ var setupProjectDirectory = (args) => {
|
|
|
59749
59776
|
};
|
|
59750
59777
|
var offerToDeploy = async (ctx) => {
|
|
59751
59778
|
startSection(`Deploy with Cloudflare`, `Step 3 of 3`);
|
|
59752
|
-
ctx.
|
|
59779
|
+
const label = `deploy via \`${npm} run ${ctx.framework?.config.deployCommand ?? "deploy"}\``;
|
|
59780
|
+
ctx.args.deploy = await processArgument(ctx.args, "deploy", {
|
|
59781
|
+
type: "confirm",
|
|
59753
59782
|
question: "Do you want to deploy your application?",
|
|
59754
|
-
|
|
59755
|
-
|
|
59756
|
-
)}`,
|
|
59757
|
-
defaultValue: ctx.args.deploy ?? (ctx.args.wranglerDefaults ? false : true),
|
|
59758
|
-
// if --wrangler-defaults, default to false, otherwise default to true
|
|
59759
|
-
acceptDefault: ctx.args.wranglerDefaults
|
|
59783
|
+
label,
|
|
59784
|
+
defaultValue: C3_DEFAULTS.deploy
|
|
59760
59785
|
});
|
|
59761
59786
|
if (!ctx.args.deploy)
|
|
59762
59787
|
return;
|
|
@@ -59810,14 +59835,12 @@ var chooseAccount = async (ctx) => {
|
|
|
59810
59835
|
label: name,
|
|
59811
59836
|
value: id
|
|
59812
59837
|
}));
|
|
59813
|
-
accountId = await
|
|
59838
|
+
accountId = await inputPrompt({
|
|
59839
|
+
type: "select",
|
|
59814
59840
|
question: "Which account do you want to use?",
|
|
59815
59841
|
options: accountOptions,
|
|
59816
|
-
|
|
59817
|
-
|
|
59818
|
-
},
|
|
59819
|
-
defaultValue: accountOptions[0].value,
|
|
59820
|
-
acceptDefault: ctx.args.wranglerDefaults
|
|
59842
|
+
label: "account",
|
|
59843
|
+
defaultValue: accountOptions[0].value
|
|
59821
59844
|
});
|
|
59822
59845
|
}
|
|
59823
59846
|
const accountName = Object.keys(accounts).find(
|
|
@@ -59827,6 +59850,7 @@ var chooseAccount = async (ctx) => {
|
|
|
59827
59850
|
};
|
|
59828
59851
|
var printSummary = async (ctx) => {
|
|
59829
59852
|
const nextSteps = [
|
|
59853
|
+
[`Navigate to the new directory`, `cd ${ctx.project.name}`],
|
|
59830
59854
|
[
|
|
59831
59855
|
`Run the development server`,
|
|
59832
59856
|
`${npm} run ${ctx.framework?.config.devCommand ?? "start"}`
|
|
@@ -59889,11 +59913,11 @@ var offerGit = async (ctx) => {
|
|
|
59889
59913
|
const insideGitRepo = await isInsideGitRepo(ctx.project.path);
|
|
59890
59914
|
if (insideGitRepo)
|
|
59891
59915
|
return;
|
|
59892
|
-
ctx.args.git
|
|
59916
|
+
ctx.args.git = await processArgument(ctx.args, "git", {
|
|
59917
|
+
type: "confirm",
|
|
59893
59918
|
question: "Do you want to use git for version control?",
|
|
59894
|
-
|
|
59895
|
-
defaultValue:
|
|
59896
|
-
acceptDefault: ctx.args.wranglerDefaults
|
|
59919
|
+
label: "git",
|
|
59920
|
+
defaultValue: C3_DEFAULTS.git
|
|
59897
59921
|
});
|
|
59898
59922
|
if (ctx.args.git) {
|
|
59899
59923
|
await printAsyncStatus({
|
|
@@ -59953,6 +59977,24 @@ async function initializeGit(cwd) {
|
|
|
59953
59977
|
await runCommand(`git init`, { useSpinner: false, silent: true, cwd });
|
|
59954
59978
|
}
|
|
59955
59979
|
}
|
|
59980
|
+
async function getProductionBranch(cwd) {
|
|
59981
|
+
try {
|
|
59982
|
+
const productionBranch = await runCommand(
|
|
59983
|
+
// "git branch --show-current", // git@^2.22
|
|
59984
|
+
"git rev-parse --abbrev-ref HEAD",
|
|
59985
|
+
// git@^1.6.3
|
|
59986
|
+
{
|
|
59987
|
+
silent: true,
|
|
59988
|
+
cwd,
|
|
59989
|
+
useSpinner: false,
|
|
59990
|
+
captureOutput: true
|
|
59991
|
+
}
|
|
59992
|
+
);
|
|
59993
|
+
return productionBranch.trim();
|
|
59994
|
+
} catch (err) {
|
|
59995
|
+
}
|
|
59996
|
+
return "main";
|
|
59997
|
+
}
|
|
59956
59998
|
|
|
59957
59999
|
// src/pages.ts
|
|
59958
60000
|
var import_path8 = require("path");
|
|
@@ -60161,25 +60203,19 @@ var docusaurus_default = config3;
|
|
|
60161
60203
|
var { npm: npm4, dlx: dlx4 } = detectPackageManager();
|
|
60162
60204
|
var generate4 = async (ctx) => {
|
|
60163
60205
|
const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
|
|
60164
|
-
const useTemplate = await
|
|
60206
|
+
const useTemplate = await inputPrompt({
|
|
60207
|
+
type: "confirm",
|
|
60165
60208
|
question: "Would you like to use a template?",
|
|
60166
|
-
|
|
60167
|
-
|
|
60168
|
-
return `${brandColor(`template`)} ${status2}`;
|
|
60169
|
-
},
|
|
60170
|
-
defaultValue: true,
|
|
60171
|
-
acceptDefault: false
|
|
60209
|
+
label: "template",
|
|
60210
|
+
defaultValue: true
|
|
60172
60211
|
});
|
|
60173
60212
|
let templateUrl = "";
|
|
60174
60213
|
if (useTemplate) {
|
|
60175
|
-
templateUrl = await
|
|
60214
|
+
templateUrl = await inputPrompt({
|
|
60215
|
+
type: "text",
|
|
60176
60216
|
question: `Please specify the url of the template you'd like to use`,
|
|
60177
|
-
|
|
60178
|
-
|
|
60179
|
-
return `${brandColor("template")} ${dim(result)}`;
|
|
60180
|
-
},
|
|
60181
|
-
defaultValue: defaultTemplate,
|
|
60182
|
-
acceptDefault: false
|
|
60217
|
+
label: "template",
|
|
60218
|
+
defaultValue: defaultTemplate
|
|
60183
60219
|
});
|
|
60184
60220
|
}
|
|
60185
60221
|
const version2 = getFrameworkVersion(ctx);
|
|
@@ -60349,6 +60385,7 @@ var generate7 = async (ctx) => {
|
|
|
60349
60385
|
};
|
|
60350
60386
|
var configure4 = async (ctx) => {
|
|
60351
60387
|
process.chdir(ctx.project.path);
|
|
60388
|
+
writeFile2("./.node-version", "17");
|
|
60352
60389
|
await npmInstall();
|
|
60353
60390
|
};
|
|
60354
60391
|
var config7 = {
|
|
@@ -60356,8 +60393,9 @@ var config7 = {
|
|
|
60356
60393
|
configure: configure4,
|
|
60357
60394
|
displayName: "Nuxt",
|
|
60358
60395
|
packageScripts: {
|
|
60396
|
+
build: (cmd) => `NITRO_PRESET=cloudflare-pages ${cmd}`,
|
|
60359
60397
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- npm run dev`,
|
|
60360
|
-
"pages:deploy":
|
|
60398
|
+
"pages:deploy": "npm run build && wrangler pages deploy ./dist"
|
|
60361
60399
|
}
|
|
60362
60400
|
};
|
|
60363
60401
|
var nuxt_default = config7;
|
|
@@ -60472,7 +60510,7 @@ var config11 = {
|
|
|
60472
60510
|
displayName: "Solid",
|
|
60473
60511
|
packageScripts: {
|
|
60474
60512
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- ${npm9} run dev`,
|
|
60475
|
-
"pages:deploy": `${npm9} run build
|
|
60513
|
+
"pages:deploy": `${npm9} run build && wrangler pages deploy ./dist/public`
|
|
60476
60514
|
}
|
|
60477
60515
|
};
|
|
60478
60516
|
var solid_default = config11;
|
|
@@ -60583,7 +60621,7 @@ var versionMap_default = {
|
|
|
60583
60621
|
astro: "3.1.5",
|
|
60584
60622
|
docusaurus: "2.4.1",
|
|
60585
60623
|
gatsby: "5.10.0",
|
|
60586
|
-
hono: "0.2.
|
|
60624
|
+
hono: "0.2.6",
|
|
60587
60625
|
next: "13.4.2",
|
|
60588
60626
|
nuxt: "3.4.2",
|
|
60589
60627
|
qwik: "1.1.x",
|
|
@@ -60688,14 +60726,12 @@ var getFrameworkSelection = async (args) => {
|
|
|
60688
60726
|
value: key
|
|
60689
60727
|
})
|
|
60690
60728
|
);
|
|
60691
|
-
const framework = await
|
|
60729
|
+
const framework = await processArgument(args, "framework", {
|
|
60730
|
+
type: "select",
|
|
60731
|
+
label: "framework",
|
|
60692
60732
|
question: "Which development framework do you want to use?",
|
|
60693
60733
|
options: frameworkOptions,
|
|
60694
|
-
|
|
60695
|
-
return `${brandColor("framework")} ${dim(option.label)}`;
|
|
60696
|
-
},
|
|
60697
|
-
defaultValue: args.framework ?? "svelte",
|
|
60698
|
-
acceptDefault: Boolean(args.framework)
|
|
60734
|
+
defaultValue: C3_DEFAULTS.framework
|
|
60699
60735
|
});
|
|
60700
60736
|
framework || crash("A framework must be selected to continue.");
|
|
60701
60737
|
if (!supportedFramework(framework)) {
|
|
@@ -60709,11 +60745,29 @@ var updatePackageScripts = async (ctx) => {
|
|
|
60709
60745
|
const { packageScripts } = ctx.framework?.config ?? {};
|
|
60710
60746
|
if (packageScripts) {
|
|
60711
60747
|
const s = spinner();
|
|
60712
|
-
|
|
60748
|
+
const updatingScripts = Object.entries(packageScripts).filter(
|
|
60749
|
+
([_3, cmdOrUpdater]) => typeof cmdOrUpdater === "function"
|
|
60750
|
+
).length > 0;
|
|
60751
|
+
s.start(
|
|
60752
|
+
`${updatingScripts ? "Updating" : "Adding"} command scripts`,
|
|
60753
|
+
"for development and deployment"
|
|
60754
|
+
);
|
|
60713
60755
|
const pkgJsonPath = (0, import_path8.resolve)("package.json");
|
|
60714
60756
|
const pkgConfig = readJSON(pkgJsonPath);
|
|
60715
|
-
Object.entries(packageScripts).forEach(([target,
|
|
60716
|
-
|
|
60757
|
+
Object.entries(packageScripts).forEach(([target, cmdOrUpdater]) => {
|
|
60758
|
+
if (typeof cmdOrUpdater === "string") {
|
|
60759
|
+
const command2 = cmdOrUpdater;
|
|
60760
|
+
pkgConfig.scripts[target] = command2;
|
|
60761
|
+
} else {
|
|
60762
|
+
const existingCommand = pkgConfig.scripts[target];
|
|
60763
|
+
if (!existingCommand) {
|
|
60764
|
+
throw new Error(
|
|
60765
|
+
`Could not find ${target} script to update during ${ctx.framework} setup`
|
|
60766
|
+
);
|
|
60767
|
+
}
|
|
60768
|
+
const updater = cmdOrUpdater;
|
|
60769
|
+
pkgConfig.scripts[target] = updater(existingCommand);
|
|
60770
|
+
}
|
|
60717
60771
|
});
|
|
60718
60772
|
writeFile2(pkgJsonPath, JSON.stringify(pkgConfig, null, 2));
|
|
60719
60773
|
s.stop(`${brandColor("added")} ${dim("commands to `package.json`")}`);
|
|
@@ -60729,7 +60783,8 @@ var createProject = async (ctx) => {
|
|
|
60729
60783
|
const CLOUDFLARE_ACCOUNT_ID = ctx.account.id;
|
|
60730
60784
|
const compatFlags = ctx.framework?.config.compatibilityFlags?.join(" ");
|
|
60731
60785
|
const compatFlagsArg = compatFlags ? `--compatibility-flags ${compatFlags}` : "";
|
|
60732
|
-
const
|
|
60786
|
+
const productionBranch = await getProductionBranch(ctx.project.path);
|
|
60787
|
+
const cmd = `${npx5} wrangler pages project create ${ctx.project.name} --production-branch ${productionBranch} ${compatFlagsArg}`;
|
|
60733
60788
|
try {
|
|
60734
60789
|
await retry(
|
|
60735
60790
|
CREATE_PROJECT_RETRIES,
|
|
@@ -60738,7 +60793,7 @@ var createProject = async (ctx) => {
|
|
|
60738
60793
|
cwd: ctx.project.path,
|
|
60739
60794
|
env: { CLOUDFLARE_ACCOUNT_ID },
|
|
60740
60795
|
startText: "Creating Pages project",
|
|
60741
|
-
doneText: `${brandColor("created")} ${dim(`via \`${cmd}\``)}`
|
|
60796
|
+
doneText: `${brandColor("created")} ${dim(`via \`${cmd.trim()}\``)}`
|
|
60742
60797
|
})
|
|
60743
60798
|
);
|
|
60744
60799
|
} catch (error) {
|
|
@@ -60772,14 +60827,12 @@ var runWorkersGenerator = async (args) => {
|
|
|
60772
60827
|
await printSummary(ctx);
|
|
60773
60828
|
};
|
|
60774
60829
|
async function getTemplate(ctx) {
|
|
60775
|
-
|
|
60776
|
-
|
|
60777
|
-
|
|
60778
|
-
|
|
60779
|
-
|
|
60780
|
-
|
|
60781
|
-
});
|
|
60782
|
-
}
|
|
60830
|
+
ctx.args.ts = await processArgument(ctx.args, "ts", {
|
|
60831
|
+
type: "confirm",
|
|
60832
|
+
question: "Do you want to use TypeScript?",
|
|
60833
|
+
label: "typescript",
|
|
60834
|
+
defaultValue: C3_DEFAULTS.ts
|
|
60835
|
+
});
|
|
60783
60836
|
const preexisting = ctx.args.type === "pre-existing";
|
|
60784
60837
|
const template = preexisting ? "hello-world" : ctx.args.type;
|
|
60785
60838
|
const path3 = (0, import_path9.resolve)(
|
|
@@ -60803,12 +60856,16 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
60803
60856
|
if (preexisting) {
|
|
60804
60857
|
await chooseAccount(ctx);
|
|
60805
60858
|
if (ctx.args.existingScript === void 0) {
|
|
60806
|
-
ctx.args.existingScript = await
|
|
60807
|
-
|
|
60808
|
-
|
|
60809
|
-
|
|
60810
|
-
|
|
60811
|
-
|
|
60859
|
+
ctx.args.existingScript = await processArgument(
|
|
60860
|
+
ctx.args,
|
|
60861
|
+
"existingScript",
|
|
60862
|
+
{
|
|
60863
|
+
type: "text",
|
|
60864
|
+
question: "Please specify the name of the existing worker in this account?",
|
|
60865
|
+
label: "worker",
|
|
60866
|
+
defaultValue: ctx.project.name
|
|
60867
|
+
}
|
|
60868
|
+
);
|
|
60812
60869
|
}
|
|
60813
60870
|
const tempdir = await (0, import_promises3.mkdtemp)(
|
|
60814
60871
|
(0, import_path9.join)((0, import_os.tmpdir)(), "c3-wrangler-init--from-dash-")
|
|
@@ -60849,10 +60906,12 @@ async function updateFiles(ctx) {
|
|
|
60849
60906
|
packagejson: JSON.parse(await (0, import_promises3.readFile)(paths.packagejson, "utf-8")),
|
|
60850
60907
|
wranglertoml: await (0, import_promises3.readFile)(paths.wranglertoml, "utf-8")
|
|
60851
60908
|
};
|
|
60852
|
-
contents.packagejson.name
|
|
60853
|
-
|
|
60854
|
-
|
|
60855
|
-
|
|
60909
|
+
if (contents.packagejson.name === "<TBD>") {
|
|
60910
|
+
contents.packagejson.name = ctx.project.name;
|
|
60911
|
+
}
|
|
60912
|
+
contents.wranglertoml = contents.wranglertoml.replace(/^name\s*=\s*"<TBD>"/m, `name = "${ctx.project.name}"`).replace(
|
|
60913
|
+
/^compatibility_date\s*=\s*"<TBD>"/m,
|
|
60914
|
+
`compatibility_date = "${await getWorkerdCompatibilityDate()}"`
|
|
60856
60915
|
);
|
|
60857
60916
|
await (0, import_promises3.writeFile)(
|
|
60858
60917
|
paths.packagejson,
|
|
@@ -60862,19 +60921,55 @@ async function updateFiles(ctx) {
|
|
|
60862
60921
|
}
|
|
60863
60922
|
|
|
60864
60923
|
// src/cli.ts
|
|
60924
|
+
var C3_DEFAULTS = {
|
|
60925
|
+
projectName: new import_haikunator.default().haikunate({ tokenHex: true }),
|
|
60926
|
+
type: "hello-world",
|
|
60927
|
+
framework: "angular",
|
|
60928
|
+
deploy: true,
|
|
60929
|
+
git: true,
|
|
60930
|
+
open: true,
|
|
60931
|
+
ts: true
|
|
60932
|
+
};
|
|
60933
|
+
var WRANGLER_DEFAULTS = {
|
|
60934
|
+
...C3_DEFAULTS,
|
|
60935
|
+
deploy: false
|
|
60936
|
+
};
|
|
60865
60937
|
var main = async (argv) => {
|
|
60866
|
-
printBanner();
|
|
60867
60938
|
const args = await parseArgs(argv);
|
|
60939
|
+
printBanner();
|
|
60940
|
+
const projectName = await processArgument(args, "projectName", {
|
|
60941
|
+
type: "text",
|
|
60942
|
+
question: `In which directory do you want to create your application?`,
|
|
60943
|
+
helpText: "also used as application name",
|
|
60944
|
+
defaultValue: C3_DEFAULTS.projectName,
|
|
60945
|
+
label: "dir",
|
|
60946
|
+
validate: (value) => validateProjectDirectory(String(value) || C3_DEFAULTS.projectName),
|
|
60947
|
+
format: (val) => `./${val}`
|
|
60948
|
+
});
|
|
60949
|
+
if (!args.type) {
|
|
60950
|
+
if (args.framework) {
|
|
60951
|
+
args.type = "webFramework";
|
|
60952
|
+
} else if (args.existingScript) {
|
|
60953
|
+
args.type = "pre-existing";
|
|
60954
|
+
}
|
|
60955
|
+
}
|
|
60956
|
+
const templateOptions = Object.entries(templateMap).filter(([_3, { hidden: hidden2 }]) => !hidden2).map(([value, { label }]) => ({ value, label }));
|
|
60957
|
+
const type = await processArgument(args, "type", {
|
|
60958
|
+
type: "select",
|
|
60959
|
+
question: "What type of application do you want to create?",
|
|
60960
|
+
label: "type",
|
|
60961
|
+
options: templateOptions,
|
|
60962
|
+
defaultValue: C3_DEFAULTS.type
|
|
60963
|
+
});
|
|
60964
|
+
if (!type || !Object.keys(templateMap).includes(type)) {
|
|
60965
|
+
return crash("An application type must be specified to continue.");
|
|
60966
|
+
}
|
|
60868
60967
|
const validatedArgs = {
|
|
60869
60968
|
...args,
|
|
60870
|
-
|
|
60871
|
-
|
|
60872
|
-
}),
|
|
60873
|
-
type: await validateType(args.type, {
|
|
60874
|
-
acceptDefault: args.wranglerDefaults
|
|
60875
|
-
})
|
|
60969
|
+
type,
|
|
60970
|
+
projectName
|
|
60876
60971
|
};
|
|
60877
|
-
const { handler } = templateMap[
|
|
60972
|
+
const { handler } = templateMap[type];
|
|
60878
60973
|
await handler(validatedArgs);
|
|
60879
60974
|
};
|
|
60880
60975
|
var printBanner = () => {
|
|
@@ -60891,42 +60986,17 @@ var parseArgs = async (argv) => {
|
|
|
60891
60986
|
}).option("existing-script", {
|
|
60892
60987
|
type: "string",
|
|
60893
60988
|
hidden: templateMap["pre-existing"].hidden
|
|
60894
|
-
}).option("
|
|
60989
|
+
}).option("accept-defaults", {
|
|
60990
|
+
alias: "y",
|
|
60991
|
+
type: "boolean"
|
|
60992
|
+
}).option("wrangler-defaults", { type: "boolean", hidden: true }).version(version).help().argv;
|
|
60895
60993
|
return {
|
|
60994
|
+
...args.wranglerDefaults && WRANGLER_DEFAULTS,
|
|
60995
|
+
...args.acceptDefaults && C3_DEFAULTS,
|
|
60896
60996
|
projectName: args._[0],
|
|
60897
60997
|
...args
|
|
60898
60998
|
};
|
|
60899
60999
|
};
|
|
60900
|
-
var validateName = async (name, { acceptDefault = false } = {}) => {
|
|
60901
|
-
const defaultValue = name ?? new import_haikunator.default().haikunate({ tokenHex: true });
|
|
60902
|
-
return textInput({
|
|
60903
|
-
question: `Where do you want to create your application?`,
|
|
60904
|
-
helpText: "also used as application name",
|
|
60905
|
-
renderSubmitted: (value) => {
|
|
60906
|
-
return `${brandColor("dir")} ${dim(value)}`;
|
|
60907
|
-
},
|
|
60908
|
-
defaultValue,
|
|
60909
|
-
acceptDefault,
|
|
60910
|
-
validate: (value) => validateProjectDirectory(value || defaultValue),
|
|
60911
|
-
format: (val) => `./${val}`
|
|
60912
|
-
});
|
|
60913
|
-
};
|
|
60914
|
-
var validateType = async (type, { acceptDefault = false } = {}) => {
|
|
60915
|
-
const templateOptions = Object.entries(templateMap).filter(([_3, { hidden: hidden2 }]) => !hidden2).map(([value, { label }]) => ({ value, label }));
|
|
60916
|
-
type = await selectInput({
|
|
60917
|
-
question: "What type of application do you want to create?",
|
|
60918
|
-
options: templateOptions,
|
|
60919
|
-
renderSubmitted: (option) => {
|
|
60920
|
-
return `${brandColor("type")} ${dim(option.label)}`;
|
|
60921
|
-
},
|
|
60922
|
-
defaultValue: type ?? "hello-world",
|
|
60923
|
-
acceptDefault
|
|
60924
|
-
});
|
|
60925
|
-
if (!type || !Object.keys(templateMap).includes(type)) {
|
|
60926
|
-
crash("An application type must be specified to continue.");
|
|
60927
|
-
}
|
|
60928
|
-
return type;
|
|
60929
|
-
};
|
|
60930
61000
|
var templateMap = {
|
|
60931
61001
|
webFramework: {
|
|
60932
61002
|
label: "Website or web app",
|
|
@@ -60964,7 +61034,9 @@ var templateMap = {
|
|
|
60964
61034
|
main(process.argv).catch((e) => crash(e));
|
|
60965
61035
|
// Annotate the CommonJS export names for ESM import in node:
|
|
60966
61036
|
0 && (module.exports = {
|
|
60967
|
-
|
|
61037
|
+
C3_DEFAULTS,
|
|
61038
|
+
main,
|
|
61039
|
+
parseArgs
|
|
60968
61040
|
});
|
|
60969
61041
|
/*! Bundled license information:
|
|
60970
61042
|
|
package/package.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
name = "
|
|
1
|
+
name = "<TBD>"
|
|
2
2
|
main = "src/index.ts"
|
|
3
|
-
compatibility_date = "
|
|
3
|
+
compatibility_date = "<TBD>"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
name = "<TBD>"
|
|
2
2
|
main = "src/worker.js"
|
|
3
|
-
compatibility_date = "
|
|
3
|
+
compatibility_date = "<TBD>"
|
|
4
4
|
|
|
5
5
|
# Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
|
|
6
6
|
# Docs: https://developers.cloudflare.com/queues/get-started
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
name = "<TBD>"
|
|
2
2
|
main = "src/worker.ts"
|
|
3
|
-
compatibility_date = "
|
|
3
|
+
compatibility_date = "<TBD>"
|
|
4
4
|
|
|
5
5
|
# Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
|
|
6
6
|
# Docs: https://developers.cloudflare.com/queues/get-started
|