create-cloudflare 0.0.0-e8df68ee → 0.0.0-f7ae0ead
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 +327 -284
- package/package.json +2 -2
- package/templates/chatgptPlugin/ts/README.md +1 -1
- package/templates/chatgptPlugin/ts/package.json +1 -1
- package/templates/chatgptPlugin/ts/wrangler.toml +2 -2
- package/templates/common/js/package.json +1 -2
- package/templates/common/js/wrangler.toml +1 -1
- package/templates/common/ts/package.json +1 -1
- package/templates/common/ts/wrangler.toml +1 -1
- package/templates/hello-world/js/package.json +1 -3
- package/templates/hello-world/js/wrangler.toml +1 -1
- package/templates/hello-world/ts/package.json +1 -1
- package/templates/hello-world/ts/wrangler.toml +1 -1
- package/templates/queues/js/package.json +1 -3
- package/templates/queues/js/wrangler.toml +1 -1
- package/templates/queues/ts/package.json +1 -1
- package/templates/queues/ts/wrangler.toml +1 -1
- package/templates/scheduled/js/package.json +1 -3
- package/templates/scheduled/js/wrangler.toml +1 -1
- package/templates/scheduled/ts/package.json +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());
|
|
@@ -53150,7 +53152,7 @@ var status = {
|
|
|
53150
53152
|
success: bgRed(` SUCCESS `)
|
|
53151
53153
|
};
|
|
53152
53154
|
var space = (n = 1) => {
|
|
53153
|
-
return
|
|
53155
|
+
return hidden("\u200A".repeat(n));
|
|
53154
53156
|
};
|
|
53155
53157
|
var logRaw = (msg) => {
|
|
53156
53158
|
if (process.env.VITEST)
|
|
@@ -54347,171 +54349,165 @@ var logUpdateStderr = createLogUpdate(import_node_process6.default.stderr);
|
|
|
54347
54349
|
var grayBar = gray(shapes.bar);
|
|
54348
54350
|
var blCorner = gray(shapes.corners.bl);
|
|
54349
54351
|
var leftT = gray(shapes.leftT);
|
|
54350
|
-
var
|
|
54351
|
-
|
|
54352
|
-
const
|
|
54353
|
-
|
|
54354
|
-
|
|
54355
|
-
|
|
54356
|
-
|
|
54357
|
-
|
|
54358
|
-
|
|
54359
|
-
|
|
54360
|
-
body += `${blCorner} ${bold(question)} ${dim(helpText)}
|
|
54361
|
-
`;
|
|
54362
|
-
body += `${space(2)}${gray(defaultValue)}
|
|
54363
|
-
`;
|
|
54364
|
-
break;
|
|
54365
|
-
case "active":
|
|
54366
|
-
body += `${blCorner} ${bold(question)} ${dim(helpText)}
|
|
54367
|
-
`;
|
|
54368
|
-
body += `${space(2)}${this.value}
|
|
54369
|
-
`;
|
|
54370
|
-
break;
|
|
54371
|
-
case "submit":
|
|
54372
|
-
body += `${leftT} ${question}
|
|
54373
|
-
`;
|
|
54374
|
-
body += `${grayBar} ${renderSubmitted(this.value)}
|
|
54375
|
-
${grayBar}`;
|
|
54376
|
-
break;
|
|
54377
|
-
case "error":
|
|
54378
|
-
body += `${leftT} ${status.error} ${dim(this.error)}
|
|
54379
|
-
`;
|
|
54380
|
-
body += `${grayBar}
|
|
54381
|
-
`;
|
|
54382
|
-
body += `${blCorner} ${question} ${dim(helpText)}
|
|
54383
|
-
`;
|
|
54384
|
-
body += `${space(2)}${this.value}
|
|
54385
|
-
`;
|
|
54386
|
-
break;
|
|
54387
|
-
default:
|
|
54388
|
-
break;
|
|
54389
|
-
}
|
|
54390
|
-
return body;
|
|
54391
|
-
}
|
|
54392
|
-
});
|
|
54393
|
-
let value;
|
|
54394
|
-
if (acceptDefault) {
|
|
54395
|
-
logRaw(`${leftT} ${question}`);
|
|
54396
|
-
logRaw(`${grayBar} ${renderSubmitted(defaultValue)}
|
|
54397
|
-
${grayBar}`);
|
|
54398
|
-
value = defaultValue;
|
|
54399
|
-
validate?.(value);
|
|
54400
|
-
} else {
|
|
54401
|
-
value = await prompt.prompt();
|
|
54402
|
-
if (eD(value)) {
|
|
54403
|
-
cancel("Operation cancelled.");
|
|
54404
|
-
process.exit(0);
|
|
54405
|
-
}
|
|
54406
|
-
}
|
|
54352
|
+
var processArgument = async (args, name, promptConfig) => {
|
|
54353
|
+
let value = args[name];
|
|
54354
|
+
const renderSubmitted = getRenderers(promptConfig).submit;
|
|
54355
|
+
if (value !== void 0) {
|
|
54356
|
+
promptConfig.validate?.(value);
|
|
54357
|
+
const lines = renderSubmitted({ value });
|
|
54358
|
+
logRaw(lines.join("\n"));
|
|
54359
|
+
return value;
|
|
54360
|
+
}
|
|
54361
|
+
value = await inputPrompt(promptConfig);
|
|
54407
54362
|
return value;
|
|
54408
54363
|
};
|
|
54409
|
-
var
|
|
54410
|
-
const
|
|
54411
|
-
|
|
54412
|
-
const
|
|
54413
|
-
|
|
54414
|
-
|
|
54415
|
-
|
|
54416
|
-
|
|
54417
|
-
|
|
54418
|
-
|
|
54419
|
-
|
|
54420
|
-
|
|
54421
|
-
|
|
54422
|
-
|
|
54423
|
-
let body = ``;
|
|
54424
|
-
switch (this.state) {
|
|
54425
|
-
case "submit":
|
|
54426
|
-
body += `${leftT} ${question}
|
|
54427
|
-
`;
|
|
54428
|
-
body += `${grayBar} ${renderSubmitted(options[this.cursor])}`;
|
|
54429
|
-
body += `
|
|
54430
|
-
${grayBar}`;
|
|
54431
|
-
break;
|
|
54432
|
-
default:
|
|
54433
|
-
body += `${blCorner} ${bold(question)} ${dim(helpText)}
|
|
54434
|
-
`;
|
|
54435
|
-
body += `${options.map(renderOption).join(`
|
|
54436
|
-
`)}
|
|
54437
|
-
`;
|
|
54438
|
-
break;
|
|
54364
|
+
var inputPrompt = async (promptConfig) => {
|
|
54365
|
+
const renderers = getRenderers(promptConfig);
|
|
54366
|
+
let prompt;
|
|
54367
|
+
const dispatchRender = (props) => {
|
|
54368
|
+
const renderedLines = renderers[props.state](props);
|
|
54369
|
+
return renderedLines.join("\n");
|
|
54370
|
+
};
|
|
54371
|
+
if (promptConfig.type === "select") {
|
|
54372
|
+
prompt = new ED({
|
|
54373
|
+
...promptConfig,
|
|
54374
|
+
options: promptConfig.options,
|
|
54375
|
+
initialValue: String(promptConfig.defaultValue),
|
|
54376
|
+
render() {
|
|
54377
|
+
return dispatchRender(this);
|
|
54439
54378
|
}
|
|
54440
|
-
|
|
54441
|
-
|
|
54442
|
-
|
|
54443
|
-
|
|
54444
|
-
|
|
54445
|
-
|
|
54446
|
-
|
|
54447
|
-
|
|
54448
|
-
|
|
54449
|
-
|
|
54450
|
-
|
|
54451
|
-
);
|
|
54452
|
-
logRaw(`${grayBar}`);
|
|
54453
|
-
value = defaultValue;
|
|
54379
|
+
});
|
|
54380
|
+
} else if (promptConfig.type === "confirm") {
|
|
54381
|
+
prompt = new sD({
|
|
54382
|
+
...promptConfig,
|
|
54383
|
+
initialValue: Boolean(promptConfig.defaultValue),
|
|
54384
|
+
active: promptConfig.activeText || "",
|
|
54385
|
+
inactive: promptConfig.inactiveText || "",
|
|
54386
|
+
render() {
|
|
54387
|
+
return dispatchRender(this);
|
|
54388
|
+
}
|
|
54389
|
+
});
|
|
54454
54390
|
} else {
|
|
54455
|
-
|
|
54456
|
-
|
|
54457
|
-
|
|
54458
|
-
|
|
54459
|
-
|
|
54391
|
+
prompt = new oD({
|
|
54392
|
+
...promptConfig,
|
|
54393
|
+
defaultValue: String(promptConfig.defaultValue),
|
|
54394
|
+
render() {
|
|
54395
|
+
return dispatchRender(this);
|
|
54396
|
+
}
|
|
54397
|
+
});
|
|
54460
54398
|
}
|
|
54461
|
-
|
|
54399
|
+
const input = await prompt.prompt();
|
|
54400
|
+
if (eD(input)) {
|
|
54401
|
+
cancel("Operation cancelled.");
|
|
54402
|
+
process.exit(0);
|
|
54403
|
+
}
|
|
54404
|
+
return input;
|
|
54405
|
+
};
|
|
54406
|
+
var renderSubmit = (config14, value) => {
|
|
54407
|
+
const { question, label } = config14;
|
|
54408
|
+
const content = config14.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
|
|
54409
|
+
return [`${leftT} ${question}`, content, `${grayBar}`];
|
|
54410
|
+
};
|
|
54411
|
+
var handleCancel = () => {
|
|
54412
|
+
cancel("Operation cancelled.");
|
|
54413
|
+
process.exit(0);
|
|
54462
54414
|
};
|
|
54463
|
-
var
|
|
54415
|
+
var getRenderers = (config14) => {
|
|
54416
|
+
switch (config14.type) {
|
|
54417
|
+
case "select":
|
|
54418
|
+
return getSelectRenderers(config14);
|
|
54419
|
+
case "confirm":
|
|
54420
|
+
return getConfirmRenderers(config14);
|
|
54421
|
+
case "text":
|
|
54422
|
+
return getTextRenderers(config14);
|
|
54423
|
+
}
|
|
54424
|
+
};
|
|
54425
|
+
var getTextRenderers = (config14) => {
|
|
54464
54426
|
const {
|
|
54465
|
-
|
|
54466
|
-
inactiveText,
|
|
54427
|
+
defaultValue,
|
|
54467
54428
|
question,
|
|
54468
|
-
|
|
54469
|
-
|
|
54470
|
-
|
|
54471
|
-
|
|
54472
|
-
const
|
|
54429
|
+
helpText: _helpText,
|
|
54430
|
+
format: _format
|
|
54431
|
+
} = config14;
|
|
54432
|
+
const helpText = _helpText ?? "";
|
|
54433
|
+
const format3 = _format ?? ((val) => String(val));
|
|
54434
|
+
return {
|
|
54435
|
+
initial: () => [
|
|
54436
|
+
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
|
54437
|
+
`${space(2)}${gray(format3(defaultValue))}`,
|
|
54438
|
+
``
|
|
54439
|
+
// extra line for readability
|
|
54440
|
+
],
|
|
54441
|
+
active: ({ value }) => [
|
|
54442
|
+
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
|
54443
|
+
`${space(2)}${format3(value || dim(defaultValue))}`,
|
|
54444
|
+
``
|
|
54445
|
+
// extra line for readability
|
|
54446
|
+
],
|
|
54447
|
+
error: ({ value, error }) => [
|
|
54448
|
+
`${leftT} ${status.error} ${dim(error)}`,
|
|
54449
|
+
`${grayBar}`,
|
|
54450
|
+
`${blCorner} ${question} ${dim(helpText)}`,
|
|
54451
|
+
`${space(2)}${format3(value)}`,
|
|
54452
|
+
``
|
|
54453
|
+
// extra line for readability
|
|
54454
|
+
],
|
|
54455
|
+
submit: ({ value }) => renderSubmit(config14, format3(value)),
|
|
54456
|
+
cancel: handleCancel
|
|
54457
|
+
};
|
|
54458
|
+
};
|
|
54459
|
+
var getSelectRenderers = (config14) => {
|
|
54460
|
+
const { options, question, helpText: _helpText } = config14;
|
|
54461
|
+
const helpText = _helpText ?? "";
|
|
54462
|
+
const defaultRenderer = ({ cursor }) => {
|
|
54463
|
+
const renderOption = (opt, i) => {
|
|
54464
|
+
const { label: optionLabel } = opt;
|
|
54465
|
+
const active = i === cursor;
|
|
54466
|
+
const text = active ? blue.underline(optionLabel) : dim(optionLabel);
|
|
54467
|
+
const indicator = active ? blue(shapes.radioActive) : dim(shapes.radioInactive);
|
|
54468
|
+
return `${space(2)}${indicator} ${text}`;
|
|
54469
|
+
};
|
|
54470
|
+
return [
|
|
54471
|
+
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
|
54472
|
+
`${options.map(renderOption).join(`
|
|
54473
|
+
`)}`,
|
|
54474
|
+
``
|
|
54475
|
+
// extra line for readability
|
|
54476
|
+
];
|
|
54477
|
+
};
|
|
54478
|
+
return {
|
|
54479
|
+
initial: defaultRenderer,
|
|
54480
|
+
active: defaultRenderer,
|
|
54481
|
+
confirm: defaultRenderer,
|
|
54482
|
+
error: defaultRenderer,
|
|
54483
|
+
submit: ({ value }) => renderSubmit(
|
|
54484
|
+
config14,
|
|
54485
|
+
options.find((o2) => o2.value === value)?.label
|
|
54486
|
+
),
|
|
54487
|
+
cancel: handleCancel
|
|
54488
|
+
};
|
|
54489
|
+
};
|
|
54490
|
+
var getConfirmRenderers = (config14) => {
|
|
54491
|
+
const { activeText, inactiveText, question, helpText: _helpText } = config14;
|
|
54492
|
+
const helpText = _helpText ?? "";
|
|
54473
54493
|
const active = activeText || "Yes";
|
|
54474
54494
|
const inactive = inactiveText || "No";
|
|
54475
|
-
const
|
|
54476
|
-
|
|
54477
|
-
|
|
54478
|
-
|
|
54479
|
-
|
|
54480
|
-
|
|
54481
|
-
|
|
54482
|
-
|
|
54483
|
-
|
|
54484
|
-
|
|
54485
|
-
|
|
54486
|
-
|
|
54487
|
-
|
|
54488
|
-
|
|
54489
|
-
|
|
54490
|
-
|
|
54491
|
-
default:
|
|
54492
|
-
body += `${blCorner} ${bold(question)} ${dim(helpText)}
|
|
54493
|
-
`;
|
|
54494
|
-
body += `${space(2)}${yesColor(active)} / ${noColor(inactive)}
|
|
54495
|
-
`;
|
|
54496
|
-
break;
|
|
54497
|
-
}
|
|
54498
|
-
return body;
|
|
54499
|
-
}
|
|
54500
|
-
});
|
|
54501
|
-
let value;
|
|
54502
|
-
if (acceptDefault) {
|
|
54503
|
-
logRaw(`${leftT} ${question}`);
|
|
54504
|
-
logRaw(`${grayBar} ${renderSubmitted(defaultValue)}`);
|
|
54505
|
-
logRaw(`${grayBar}`);
|
|
54506
|
-
value = defaultValue;
|
|
54507
|
-
} else {
|
|
54508
|
-
value = Boolean(await prompt.prompt());
|
|
54509
|
-
if (eD(value)) {
|
|
54510
|
-
cancel("Operation cancelled.");
|
|
54511
|
-
process.exit(0);
|
|
54512
|
-
}
|
|
54513
|
-
}
|
|
54514
|
-
return value;
|
|
54495
|
+
const defaultRenderer = ({ value }) => {
|
|
54496
|
+
const yesColor = value ? blue : dim;
|
|
54497
|
+
const noColor = value ? dim : blue;
|
|
54498
|
+
return [
|
|
54499
|
+
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
|
54500
|
+
`${space(2)}${yesColor(active)} / ${noColor(inactive)}`
|
|
54501
|
+
];
|
|
54502
|
+
};
|
|
54503
|
+
return {
|
|
54504
|
+
initial: defaultRenderer,
|
|
54505
|
+
active: defaultRenderer,
|
|
54506
|
+
confirm: defaultRenderer,
|
|
54507
|
+
error: defaultRenderer,
|
|
54508
|
+
submit: ({ value }) => renderSubmit(config14, value ? "yes" : "no"),
|
|
54509
|
+
cancel: handleCancel
|
|
54510
|
+
};
|
|
54515
54511
|
};
|
|
54516
54512
|
var spinner = () => {
|
|
54517
54513
|
const spinnerFrames = ["\u2524", "\u2518", "\u2534", "\u2514", "\u251C", "\u250C", "\u252C", "\u2510"];
|
|
@@ -59416,7 +59412,7 @@ var Yargs = YargsFactory(esm_default);
|
|
|
59416
59412
|
var yargs_default = Yargs;
|
|
59417
59413
|
|
|
59418
59414
|
// package.json
|
|
59419
|
-
var version = "0.0.0-
|
|
59415
|
+
var version = "0.0.0-f7ae0ead";
|
|
59420
59416
|
|
|
59421
59417
|
// src/common.ts
|
|
59422
59418
|
var import_fs6 = require("fs");
|
|
@@ -59471,26 +59467,26 @@ var detectPackageManager = () => {
|
|
|
59471
59467
|
};
|
|
59472
59468
|
|
|
59473
59469
|
// src/helpers/command.ts
|
|
59474
|
-
var runCommand = async (command2, opts) => {
|
|
59470
|
+
var runCommand = async (command2, opts = {}) => {
|
|
59475
59471
|
if (typeof command2 === "string") {
|
|
59476
59472
|
command2 = command2.trim().replace(/\s+/g, ` `).split(" ");
|
|
59477
59473
|
}
|
|
59478
59474
|
return printAsyncStatus({
|
|
59479
|
-
useSpinner: opts
|
|
59480
|
-
startText: opts
|
|
59481
|
-
doneText: opts
|
|
59475
|
+
useSpinner: opts.useSpinner ?? opts.silent,
|
|
59476
|
+
startText: opts.startText || command2.join(" "),
|
|
59477
|
+
doneText: opts.doneText,
|
|
59482
59478
|
promise() {
|
|
59483
59479
|
const [executable, ...args] = command2;
|
|
59484
|
-
const squelch = opts
|
|
59480
|
+
const squelch = opts.silent || process.env.VITEST;
|
|
59485
59481
|
const cmd = (0, import_cross_spawn.spawn)(executable, [...args], {
|
|
59486
59482
|
// TODO: ideally inherit stderr, but npm install uses this for warnings
|
|
59487
59483
|
// stdio: [ioMode, ioMode, "inherit"],
|
|
59488
59484
|
stdio: squelch ? "pipe" : "inherit",
|
|
59489
59485
|
env: {
|
|
59490
59486
|
...process.env,
|
|
59491
|
-
...opts
|
|
59487
|
+
...opts.env
|
|
59492
59488
|
},
|
|
59493
|
-
cwd: opts
|
|
59489
|
+
cwd: opts.cwd
|
|
59494
59490
|
});
|
|
59495
59491
|
let output = ``;
|
|
59496
59492
|
if (opts?.captureOutput ?? squelch) {
|
|
@@ -59503,12 +59499,24 @@ var runCommand = async (command2, opts) => {
|
|
|
59503
59499
|
}
|
|
59504
59500
|
return new Promise((resolve9, reject) => {
|
|
59505
59501
|
cmd.on("close", (code) => {
|
|
59506
|
-
|
|
59507
|
-
|
|
59508
|
-
|
|
59509
|
-
|
|
59502
|
+
try {
|
|
59503
|
+
if (code !== 0) {
|
|
59504
|
+
throw new Error(output, { cause: code });
|
|
59505
|
+
}
|
|
59506
|
+
const transformOutput = opts.transformOutput ?? ((result) => result);
|
|
59507
|
+
const processedOutput = transformOutput(stripAnsi(output));
|
|
59508
|
+
resolve9(processedOutput);
|
|
59509
|
+
} catch (e) {
|
|
59510
|
+
if (opts.fallbackOutput) {
|
|
59511
|
+
resolve9(opts.fallbackOutput(e));
|
|
59512
|
+
} else {
|
|
59513
|
+
reject(new Error(output, { cause: e }));
|
|
59514
|
+
}
|
|
59510
59515
|
}
|
|
59511
59516
|
});
|
|
59517
|
+
cmd.on("error", (code) => {
|
|
59518
|
+
reject(code);
|
|
59519
|
+
});
|
|
59512
59520
|
});
|
|
59513
59521
|
}
|
|
59514
59522
|
});
|
|
@@ -59519,9 +59527,11 @@ async function runCommands({ commands, ...opts }) {
|
|
|
59519
59527
|
startText: opts.startText,
|
|
59520
59528
|
doneText: opts.doneText,
|
|
59521
59529
|
async promise() {
|
|
59530
|
+
const results = [];
|
|
59522
59531
|
for (const command2 of commands) {
|
|
59523
|
-
await runCommand(command2, { ...opts, useSpinner: false });
|
|
59532
|
+
results.push(await runCommand(command2, { ...opts, useSpinner: false }));
|
|
59524
59533
|
}
|
|
59534
|
+
return results.join("\n");
|
|
59525
59535
|
}
|
|
59526
59536
|
});
|
|
59527
59537
|
}
|
|
@@ -59538,8 +59548,9 @@ var printAsyncStatus = async ({
|
|
|
59538
59548
|
promise = promise();
|
|
59539
59549
|
}
|
|
59540
59550
|
try {
|
|
59541
|
-
await promise;
|
|
59542
|
-
|
|
59551
|
+
const output = await promise;
|
|
59552
|
+
const doneText = typeof opts.doneText === "function" ? opts.doneText(output) : opts.doneText;
|
|
59553
|
+
s?.stop(doneText);
|
|
59543
59554
|
} catch (err) {
|
|
59544
59555
|
s?.stop(err.message);
|
|
59545
59556
|
} finally {
|
|
@@ -59616,10 +59627,14 @@ var installWrangler = async () => {
|
|
|
59616
59627
|
};
|
|
59617
59628
|
var isLoggedIn = async () => {
|
|
59618
59629
|
const { npx: npx6 } = detectPackageManager();
|
|
59619
|
-
|
|
59620
|
-
|
|
59621
|
-
|
|
59622
|
-
|
|
59630
|
+
try {
|
|
59631
|
+
const output = await runCommand(`${npx6} wrangler whoami`, {
|
|
59632
|
+
silent: true
|
|
59633
|
+
});
|
|
59634
|
+
return /You are logged in/.test(output);
|
|
59635
|
+
} catch (error) {
|
|
59636
|
+
return false;
|
|
59637
|
+
}
|
|
59623
59638
|
};
|
|
59624
59639
|
var wranglerLogin = async () => {
|
|
59625
59640
|
const { npx: npx6 } = detectPackageManager();
|
|
@@ -59652,6 +59667,24 @@ var listAccounts = async () => {
|
|
|
59652
59667
|
});
|
|
59653
59668
|
return accounts;
|
|
59654
59669
|
};
|
|
59670
|
+
async function getWorkerdCompatibilityDate() {
|
|
59671
|
+
const { npm: npm12 } = detectPackageManager();
|
|
59672
|
+
return runCommand(`${npm12} info workerd dist-tags.latest`, {
|
|
59673
|
+
silent: true,
|
|
59674
|
+
captureOutput: true,
|
|
59675
|
+
startText: "Retrieving current workerd compatibility date",
|
|
59676
|
+
transformOutput: (result) => {
|
|
59677
|
+
const match = result.match(/\d+\.(\d{4})(\d{2})(\d{2})\.\d+/);
|
|
59678
|
+
if (!match) {
|
|
59679
|
+
throw new Error("Could not find workerd date");
|
|
59680
|
+
}
|
|
59681
|
+
const [, year, month, date] = match;
|
|
59682
|
+
return `${year}-${month}-${date}`;
|
|
59683
|
+
},
|
|
59684
|
+
fallbackOutput: () => "2023-05-18",
|
|
59685
|
+
doneText: (output) => `${brandColor("compatibility date")} ${dim(output)}`
|
|
59686
|
+
});
|
|
59687
|
+
}
|
|
59655
59688
|
|
|
59656
59689
|
// src/helpers/poll.ts
|
|
59657
59690
|
var import_promises = require("node:dns/promises");
|
|
@@ -59729,14 +59762,15 @@ var validateProjectDirectory = (relativePath) => {
|
|
|
59729
59762
|
const existsAlready = (0, import_fs6.existsSync)(path3);
|
|
59730
59763
|
const isEmpty = existsAlready && (0, import_fs6.readdirSync)(path3).length === 0;
|
|
59731
59764
|
if (existsAlready && !isEmpty) {
|
|
59732
|
-
|
|
59733
|
-
`Directory \`${relativePath}\` already exists and is not empty. Please choose a new name.`
|
|
59734
|
-
);
|
|
59765
|
+
return `Directory \`${relativePath}\` already exists and is not empty. Please choose a new name.`;
|
|
59735
59766
|
}
|
|
59736
59767
|
};
|
|
59737
59768
|
var setupProjectDirectory = (args) => {
|
|
59738
59769
|
const path3 = (0, import_path6.resolve)(args.projectName);
|
|
59739
|
-
validateProjectDirectory(path3);
|
|
59770
|
+
const err = validateProjectDirectory(path3);
|
|
59771
|
+
if (err) {
|
|
59772
|
+
crash(err);
|
|
59773
|
+
}
|
|
59740
59774
|
const directory = (0, import_path6.dirname)(path3);
|
|
59741
59775
|
const name = (0, import_path6.basename)(path3);
|
|
59742
59776
|
(0, import_fs6.mkdirSync)(directory, { recursive: true });
|
|
@@ -59745,14 +59779,12 @@ var setupProjectDirectory = (args) => {
|
|
|
59745
59779
|
};
|
|
59746
59780
|
var offerToDeploy = async (ctx) => {
|
|
59747
59781
|
startSection(`Deploy with Cloudflare`, `Step 3 of 3`);
|
|
59748
|
-
ctx.
|
|
59782
|
+
const label = `deploy via \`${npm} run ${ctx.framework?.config.deployCommand ?? "deploy"}\``;
|
|
59783
|
+
ctx.args.deploy = await processArgument(ctx.args, "deploy", {
|
|
59784
|
+
type: "confirm",
|
|
59749
59785
|
question: "Do you want to deploy your application?",
|
|
59750
|
-
|
|
59751
|
-
|
|
59752
|
-
)}`,
|
|
59753
|
-
defaultValue: ctx.args.deploy ?? (ctx.args.wranglerDefaults ? false : true),
|
|
59754
|
-
// if --wrangler-defaults, default to false, otherwise default to true
|
|
59755
|
-
acceptDefault: ctx.args.wranglerDefaults
|
|
59786
|
+
label,
|
|
59787
|
+
defaultValue: C3_DEFAULTS.deploy
|
|
59756
59788
|
});
|
|
59757
59789
|
if (!ctx.args.deploy)
|
|
59758
59790
|
return;
|
|
@@ -59806,14 +59838,12 @@ var chooseAccount = async (ctx) => {
|
|
|
59806
59838
|
label: name,
|
|
59807
59839
|
value: id
|
|
59808
59840
|
}));
|
|
59809
|
-
accountId = await
|
|
59841
|
+
accountId = await inputPrompt({
|
|
59842
|
+
type: "select",
|
|
59810
59843
|
question: "Which account do you want to use?",
|
|
59811
59844
|
options: accountOptions,
|
|
59812
|
-
|
|
59813
|
-
|
|
59814
|
-
},
|
|
59815
|
-
defaultValue: accountOptions[0].value,
|
|
59816
|
-
acceptDefault: ctx.args.wranglerDefaults
|
|
59845
|
+
label: "account",
|
|
59846
|
+
defaultValue: accountOptions[0].value
|
|
59817
59847
|
});
|
|
59818
59848
|
}
|
|
59819
59849
|
const accountName = Object.keys(accounts).find(
|
|
@@ -59823,6 +59853,7 @@ var chooseAccount = async (ctx) => {
|
|
|
59823
59853
|
};
|
|
59824
59854
|
var printSummary = async (ctx) => {
|
|
59825
59855
|
const nextSteps = [
|
|
59856
|
+
[`Navigate to the new directory:`, `cd ${ctx.project.name}`],
|
|
59826
59857
|
[
|
|
59827
59858
|
`Run the development server`,
|
|
59828
59859
|
`${npm} run ${ctx.framework?.config.devCommand ?? "start"}`
|
|
@@ -59885,11 +59916,11 @@ var offerGit = async (ctx) => {
|
|
|
59885
59916
|
const insideGitRepo = await isInsideGitRepo(ctx.project.path);
|
|
59886
59917
|
if (insideGitRepo)
|
|
59887
59918
|
return;
|
|
59888
|
-
ctx.args.git
|
|
59919
|
+
ctx.args.git = await processArgument(ctx.args, "git", {
|
|
59920
|
+
type: "confirm",
|
|
59889
59921
|
question: "Do you want to use git for version control?",
|
|
59890
|
-
|
|
59891
|
-
defaultValue:
|
|
59892
|
-
acceptDefault: ctx.args.wranglerDefaults
|
|
59922
|
+
label: "git",
|
|
59923
|
+
defaultValue: C3_DEFAULTS.git
|
|
59893
59924
|
});
|
|
59894
59925
|
if (ctx.args.git) {
|
|
59895
59926
|
await printAsyncStatus({
|
|
@@ -60021,10 +60052,10 @@ var config = {
|
|
|
60021
60052
|
displayName: "Angular",
|
|
60022
60053
|
packageScripts: {
|
|
60023
60054
|
process: "node ./tools/copy-worker-files.mjs && node ./tools/copy-client-files.mjs && node ./tools/bundle.mjs",
|
|
60024
|
-
prestart: `${npm2} run build:ssr &&
|
|
60055
|
+
prestart: `${npm2} run build:ssr && ${npm2} run process`,
|
|
60025
60056
|
start: "wrangler pages dev dist/cloudflare --compatibility-date=2021-09-20 --experimental-local",
|
|
60026
|
-
predeploy: `${npm2} run build:ssr &&
|
|
60027
|
-
deploy: "wrangler pages
|
|
60057
|
+
predeploy: `${npm2} run build:ssr && ${npm2} run process`,
|
|
60058
|
+
deploy: "wrangler pages deploy dist/cloudflare"
|
|
60028
60059
|
},
|
|
60029
60060
|
deployCommand: "deploy",
|
|
60030
60061
|
devCommand: "start"
|
|
@@ -60119,7 +60150,7 @@ var config2 = {
|
|
|
60119
60150
|
displayName: "Astro",
|
|
60120
60151
|
packageScripts: {
|
|
60121
60152
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- astro dev`,
|
|
60122
|
-
"pages:deploy": `astro build && wrangler pages
|
|
60153
|
+
"pages:deploy": `astro build && wrangler pages deploy ./dist`
|
|
60123
60154
|
},
|
|
60124
60155
|
testFlags: [
|
|
60125
60156
|
"--skip-houston",
|
|
@@ -60148,7 +60179,7 @@ var config3 = {
|
|
|
60148
60179
|
displayName: "Docusaurus",
|
|
60149
60180
|
packageScripts: {
|
|
60150
60181
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- ${npm3} run start`,
|
|
60151
|
-
"pages:deploy": `NODE_VERSION=16 ${npm3} run build && wrangler pages
|
|
60182
|
+
"pages:deploy": `NODE_VERSION=16 ${npm3} run build && wrangler pages deploy ./build`
|
|
60152
60183
|
}
|
|
60153
60184
|
};
|
|
60154
60185
|
var docusaurus_default = config3;
|
|
@@ -60157,25 +60188,19 @@ var docusaurus_default = config3;
|
|
|
60157
60188
|
var { npm: npm4, dlx: dlx4 } = detectPackageManager();
|
|
60158
60189
|
var generate4 = async (ctx) => {
|
|
60159
60190
|
const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
|
|
60160
|
-
const useTemplate = await
|
|
60191
|
+
const useTemplate = await inputPrompt({
|
|
60192
|
+
type: "confirm",
|
|
60161
60193
|
question: "Would you like to use a template?",
|
|
60162
|
-
|
|
60163
|
-
|
|
60164
|
-
return `${brandColor(`template`)} ${status2}`;
|
|
60165
|
-
},
|
|
60166
|
-
defaultValue: true,
|
|
60167
|
-
acceptDefault: false
|
|
60194
|
+
label: "template",
|
|
60195
|
+
defaultValue: true
|
|
60168
60196
|
});
|
|
60169
60197
|
let templateUrl = "";
|
|
60170
60198
|
if (useTemplate) {
|
|
60171
|
-
templateUrl = await
|
|
60199
|
+
templateUrl = await inputPrompt({
|
|
60200
|
+
type: "text",
|
|
60172
60201
|
question: `Please specify the url of the template you'd like to use`,
|
|
60173
|
-
|
|
60174
|
-
|
|
60175
|
-
return `${brandColor("template")} ${dim(result)}`;
|
|
60176
|
-
},
|
|
60177
|
-
defaultValue: defaultTemplate,
|
|
60178
|
-
acceptDefault: false
|
|
60202
|
+
label: "template",
|
|
60203
|
+
defaultValue: defaultTemplate
|
|
60179
60204
|
});
|
|
60180
60205
|
}
|
|
60181
60206
|
const version2 = getFrameworkVersion(ctx);
|
|
@@ -60189,7 +60214,7 @@ var config4 = {
|
|
|
60189
60214
|
displayName: "Gatsby",
|
|
60190
60215
|
packageScripts: {
|
|
60191
60216
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 8000 -- ${npm4} run develop`,
|
|
60192
|
-
"pages:deploy": `${npm4} run build && wrangler pages
|
|
60217
|
+
"pages:deploy": `${npm4} run build && wrangler pages deploy ./public`
|
|
60193
60218
|
}
|
|
60194
60219
|
};
|
|
60195
60220
|
var gatsby_default = config4;
|
|
@@ -60315,7 +60340,7 @@ var config6 = {
|
|
|
60315
60340
|
displayName: "Next",
|
|
60316
60341
|
packageScripts: {
|
|
60317
60342
|
"pages:build": `${npx3} @cloudflare/next-on-pages@1`,
|
|
60318
|
-
"pages:deploy": `${npm5} run pages:build && wrangler pages
|
|
60343
|
+
"pages:deploy": `${npm5} run pages:build && wrangler pages deploy .vercel/output/static`,
|
|
60319
60344
|
"pages:watch": `${npx3} @cloudflare/next-on-pages@1 --watch`,
|
|
60320
60345
|
"pages:dev": `${npx3} wrangler pages dev .vercel/output/static --compatibility-flag=nodejs_compat`
|
|
60321
60346
|
},
|
|
@@ -60353,7 +60378,7 @@ var config7 = {
|
|
|
60353
60378
|
displayName: "Nuxt",
|
|
60354
60379
|
packageScripts: {
|
|
60355
60380
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- npm run dev`,
|
|
60356
|
-
"pages:deploy": `NODE_VERSION=17 npm run generate && wrangler pages
|
|
60381
|
+
"pages:deploy": `NODE_VERSION=17 npm run generate && wrangler pages deploy ./dist`
|
|
60357
60382
|
}
|
|
60358
60383
|
};
|
|
60359
60384
|
var nuxt_default = config7;
|
|
@@ -60400,7 +60425,7 @@ var config9 = {
|
|
|
60400
60425
|
displayName: "React",
|
|
60401
60426
|
packageScripts: {
|
|
60402
60427
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --port 3000 -- ${npm7} start`,
|
|
60403
|
-
"pages:deploy": `${npm7} run build && wrangler pages
|
|
60428
|
+
"pages:deploy": `${npm7} run build && wrangler pages deploy ./build`
|
|
60404
60429
|
}
|
|
60405
60430
|
};
|
|
60406
60431
|
var react_default = config9;
|
|
@@ -60419,7 +60444,7 @@ var config10 = {
|
|
|
60419
60444
|
generate: generate10,
|
|
60420
60445
|
displayName: "Remix",
|
|
60421
60446
|
packageScripts: {
|
|
60422
|
-
"pages:deploy": `${npm8} run build && wrangler pages
|
|
60447
|
+
"pages:deploy": `${npm8} run build && wrangler pages deploy ./public`
|
|
60423
60448
|
},
|
|
60424
60449
|
devCommand: "dev",
|
|
60425
60450
|
testFlags: ["--typescript", "--no-install"]
|
|
@@ -60468,7 +60493,7 @@ var config11 = {
|
|
|
60468
60493
|
displayName: "Solid",
|
|
60469
60494
|
packageScripts: {
|
|
60470
60495
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 3000 -- ${npm9} run dev`,
|
|
60471
|
-
"pages:deploy": `${npm9} run build
|
|
60496
|
+
"pages:deploy": `${npm9} run build && wrangler pages deploy ./dist/public`
|
|
60472
60497
|
}
|
|
60473
60498
|
};
|
|
60474
60499
|
var solid_default = config11;
|
|
@@ -60568,7 +60593,7 @@ var config12 = {
|
|
|
60568
60593
|
displayName: "Svelte",
|
|
60569
60594
|
packageScripts: {
|
|
60570
60595
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 5173 -- ${npm10} run dev`,
|
|
60571
|
-
"pages:deploy": `NODE_VERSION=16 ${npm10} run build && wrangler pages
|
|
60596
|
+
"pages:deploy": `NODE_VERSION=16 ${npm10} run build && wrangler pages deploy .svelte-kit/cloudflare`
|
|
60572
60597
|
}
|
|
60573
60598
|
};
|
|
60574
60599
|
var svelte_default = config12;
|
|
@@ -60579,7 +60604,7 @@ var versionMap_default = {
|
|
|
60579
60604
|
astro: "3.1.5",
|
|
60580
60605
|
docusaurus: "2.4.1",
|
|
60581
60606
|
gatsby: "5.10.0",
|
|
60582
|
-
hono: "0.2.
|
|
60607
|
+
hono: "0.2.6",
|
|
60583
60608
|
next: "13.4.2",
|
|
60584
60609
|
nuxt: "3.4.2",
|
|
60585
60610
|
qwik: "1.1.x",
|
|
@@ -60604,7 +60629,7 @@ var config13 = {
|
|
|
60604
60629
|
displayName: "Vue",
|
|
60605
60630
|
packageScripts: {
|
|
60606
60631
|
"pages:dev": `wrangler pages dev ${compatDateFlag()} --proxy 5173 -- ${npm11} run dev`,
|
|
60607
|
-
"pages:deploy": `${npm11} run build && wrangler pages
|
|
60632
|
+
"pages:deploy": `${npm11} run build && wrangler pages deploy ./dist`
|
|
60608
60633
|
},
|
|
60609
60634
|
testFlags: ["--ts"]
|
|
60610
60635
|
};
|
|
@@ -60684,14 +60709,12 @@ var getFrameworkSelection = async (args) => {
|
|
|
60684
60709
|
value: key
|
|
60685
60710
|
})
|
|
60686
60711
|
);
|
|
60687
|
-
const framework = await
|
|
60712
|
+
const framework = await processArgument(args, "framework", {
|
|
60713
|
+
type: "select",
|
|
60714
|
+
label: "framework",
|
|
60688
60715
|
question: "Which development framework do you want to use?",
|
|
60689
60716
|
options: frameworkOptions,
|
|
60690
|
-
|
|
60691
|
-
return `${brandColor("framework")} ${dim(option.label)}`;
|
|
60692
|
-
},
|
|
60693
|
-
defaultValue: args.framework ?? "svelte",
|
|
60694
|
-
acceptDefault: Boolean(args.framework)
|
|
60717
|
+
defaultValue: C3_DEFAULTS.framework
|
|
60695
60718
|
});
|
|
60696
60719
|
framework || crash("A framework must be selected to continue.");
|
|
60697
60720
|
if (!supportedFramework(framework)) {
|
|
@@ -60769,11 +60792,11 @@ var runWorkersGenerator = async (args) => {
|
|
|
60769
60792
|
};
|
|
60770
60793
|
async function getTemplate(ctx) {
|
|
60771
60794
|
if (ctx.args.ts === void 0) {
|
|
60772
|
-
ctx.args.ts = await
|
|
60795
|
+
ctx.args.ts = await processArgument(ctx.args, "ts", {
|
|
60796
|
+
type: "confirm",
|
|
60773
60797
|
question: "Do you want to use TypeScript?",
|
|
60774
|
-
|
|
60775
|
-
defaultValue:
|
|
60776
|
-
acceptDefault: ctx.args.wranglerDefaults
|
|
60798
|
+
label: "typescript",
|
|
60799
|
+
defaultValue: C3_DEFAULTS.ts
|
|
60777
60800
|
});
|
|
60778
60801
|
}
|
|
60779
60802
|
const preexisting = ctx.args.type === "pre-existing";
|
|
@@ -60799,12 +60822,16 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
60799
60822
|
if (preexisting) {
|
|
60800
60823
|
await chooseAccount(ctx);
|
|
60801
60824
|
if (ctx.args.existingScript === void 0) {
|
|
60802
|
-
ctx.args.existingScript = await
|
|
60803
|
-
|
|
60804
|
-
|
|
60805
|
-
|
|
60806
|
-
|
|
60807
|
-
|
|
60825
|
+
ctx.args.existingScript = await processArgument(
|
|
60826
|
+
ctx.args,
|
|
60827
|
+
"existingScript",
|
|
60828
|
+
{
|
|
60829
|
+
type: "text",
|
|
60830
|
+
question: "Please specify the name of the existing worker in this account?",
|
|
60831
|
+
label: "worker",
|
|
60832
|
+
defaultValue: ctx.project.name
|
|
60833
|
+
}
|
|
60834
|
+
);
|
|
60808
60835
|
}
|
|
60809
60836
|
const tempdir = await (0, import_promises3.mkdtemp)(
|
|
60810
60837
|
(0, import_path9.join)((0, import_os.tmpdir)(), "c3-wrangler-init--from-dash-")
|
|
@@ -60845,10 +60872,12 @@ async function updateFiles(ctx) {
|
|
|
60845
60872
|
packagejson: JSON.parse(await (0, import_promises3.readFile)(paths.packagejson, "utf-8")),
|
|
60846
60873
|
wranglertoml: await (0, import_promises3.readFile)(paths.wranglertoml, "utf-8")
|
|
60847
60874
|
};
|
|
60848
|
-
contents.packagejson.name
|
|
60849
|
-
|
|
60850
|
-
|
|
60851
|
-
|
|
60875
|
+
if (contents.packagejson.name === "<TBD>") {
|
|
60876
|
+
contents.packagejson.name = ctx.project.name;
|
|
60877
|
+
}
|
|
60878
|
+
contents.wranglertoml = contents.wranglertoml.replace(/^name\s*=\s*"<TBD>"/m, `name = "${ctx.project.name}"`).replace(
|
|
60879
|
+
/^compatibility_date\s*=\s*"<TBD>"/m,
|
|
60880
|
+
`compatibility_date = "${await getWorkerdCompatibilityDate()}"`
|
|
60852
60881
|
);
|
|
60853
60882
|
await (0, import_promises3.writeFile)(
|
|
60854
60883
|
paths.packagejson,
|
|
@@ -60858,19 +60887,55 @@ async function updateFiles(ctx) {
|
|
|
60858
60887
|
}
|
|
60859
60888
|
|
|
60860
60889
|
// src/cli.ts
|
|
60890
|
+
var C3_DEFAULTS = {
|
|
60891
|
+
projectName: new import_haikunator.default().haikunate({ tokenHex: true }),
|
|
60892
|
+
type: "hello-world",
|
|
60893
|
+
framework: "angular",
|
|
60894
|
+
deploy: true,
|
|
60895
|
+
git: true,
|
|
60896
|
+
open: true,
|
|
60897
|
+
ts: true
|
|
60898
|
+
};
|
|
60899
|
+
var WRANGLER_DEFAULTS = {
|
|
60900
|
+
...C3_DEFAULTS,
|
|
60901
|
+
deploy: false
|
|
60902
|
+
};
|
|
60861
60903
|
var main = async (argv) => {
|
|
60862
|
-
printBanner();
|
|
60863
60904
|
const args = await parseArgs(argv);
|
|
60905
|
+
printBanner();
|
|
60906
|
+
const projectName = await processArgument(args, "projectName", {
|
|
60907
|
+
type: "text",
|
|
60908
|
+
question: `In which directory do you want to create your application?`,
|
|
60909
|
+
helpText: "also used as application name",
|
|
60910
|
+
defaultValue: C3_DEFAULTS.projectName,
|
|
60911
|
+
label: "dir",
|
|
60912
|
+
validate: (value) => validateProjectDirectory(String(value) || C3_DEFAULTS.projectName),
|
|
60913
|
+
format: (val) => `./${val}`
|
|
60914
|
+
});
|
|
60915
|
+
if (!args.type) {
|
|
60916
|
+
if (args.framework) {
|
|
60917
|
+
args.type = "webFramework";
|
|
60918
|
+
} else if (args.existingScript) {
|
|
60919
|
+
args.type = "pre-existing";
|
|
60920
|
+
}
|
|
60921
|
+
}
|
|
60922
|
+
const templateOptions = Object.entries(templateMap).filter(([_3, { hidden: hidden2 }]) => !hidden2).map(([value, { label }]) => ({ value, label }));
|
|
60923
|
+
const type = await processArgument(args, "type", {
|
|
60924
|
+
type: "select",
|
|
60925
|
+
question: "What type of application do you want to create?",
|
|
60926
|
+
label: "type",
|
|
60927
|
+
options: templateOptions,
|
|
60928
|
+
defaultValue: C3_DEFAULTS.type
|
|
60929
|
+
});
|
|
60930
|
+
if (!type || !Object.keys(templateMap).includes(type)) {
|
|
60931
|
+
return crash("An application type must be specified to continue.");
|
|
60932
|
+
}
|
|
60864
60933
|
const validatedArgs = {
|
|
60865
60934
|
...args,
|
|
60866
|
-
|
|
60867
|
-
|
|
60868
|
-
}),
|
|
60869
|
-
type: await validateType(args.type, {
|
|
60870
|
-
acceptDefault: args.wranglerDefaults
|
|
60871
|
-
})
|
|
60935
|
+
type,
|
|
60936
|
+
projectName
|
|
60872
60937
|
};
|
|
60873
|
-
const { handler } = templateMap[
|
|
60938
|
+
const { handler } = templateMap[type];
|
|
60874
60939
|
await handler(validatedArgs);
|
|
60875
60940
|
};
|
|
60876
60941
|
var printBanner = () => {
|
|
@@ -60887,41 +60952,17 @@ var parseArgs = async (argv) => {
|
|
|
60887
60952
|
}).option("existing-script", {
|
|
60888
60953
|
type: "string",
|
|
60889
60954
|
hidden: templateMap["pre-existing"].hidden
|
|
60890
|
-
}).option("
|
|
60955
|
+
}).option("accept-defaults", {
|
|
60956
|
+
alias: "y",
|
|
60957
|
+
type: "boolean"
|
|
60958
|
+
}).option("wrangler-defaults", { type: "boolean", hidden: true }).version(version).help().argv;
|
|
60891
60959
|
return {
|
|
60960
|
+
...args.wranglerDefaults && WRANGLER_DEFAULTS,
|
|
60961
|
+
...args.acceptDefaults && C3_DEFAULTS,
|
|
60892
60962
|
projectName: args._[0],
|
|
60893
60963
|
...args
|
|
60894
60964
|
};
|
|
60895
60965
|
};
|
|
60896
|
-
var validateName = async (name, { acceptDefault = false } = {}) => {
|
|
60897
|
-
const defaultValue = name ?? new import_haikunator.default().haikunate({ tokenHex: true });
|
|
60898
|
-
return textInput({
|
|
60899
|
-
question: `Where do you want to create your application?`,
|
|
60900
|
-
helpText: "also used as application name",
|
|
60901
|
-
renderSubmitted: (value) => {
|
|
60902
|
-
return `${brandColor("dir")} ${dim(value)}`;
|
|
60903
|
-
},
|
|
60904
|
-
defaultValue,
|
|
60905
|
-
acceptDefault,
|
|
60906
|
-
validate: (value = defaultValue) => validateProjectDirectory(value)
|
|
60907
|
-
});
|
|
60908
|
-
};
|
|
60909
|
-
var validateType = async (type, { acceptDefault = false } = {}) => {
|
|
60910
|
-
const templateOptions = Object.entries(templateMap).filter(([_3, { hidden: hidden2 }]) => !hidden2).map(([value, { label }]) => ({ value, label }));
|
|
60911
|
-
type = await selectInput({
|
|
60912
|
-
question: "What type of application do you want to create?",
|
|
60913
|
-
options: templateOptions,
|
|
60914
|
-
renderSubmitted: (option) => {
|
|
60915
|
-
return `${brandColor("type")} ${dim(option.label)}`;
|
|
60916
|
-
},
|
|
60917
|
-
defaultValue: type ?? "hello-world",
|
|
60918
|
-
acceptDefault
|
|
60919
|
-
});
|
|
60920
|
-
if (!type || !Object.keys(templateMap).includes(type)) {
|
|
60921
|
-
crash("An application type must be specified to continue.");
|
|
60922
|
-
}
|
|
60923
|
-
return type;
|
|
60924
|
-
};
|
|
60925
60966
|
var templateMap = {
|
|
60926
60967
|
webFramework: {
|
|
60927
60968
|
label: "Website or web app",
|
|
@@ -60959,7 +61000,9 @@ var templateMap = {
|
|
|
60959
61000
|
main(process.argv).catch((e) => crash(e));
|
|
60960
61001
|
// Annotate the CommonJS export names for ESM import in node:
|
|
60961
61002
|
0 && (module.exports = {
|
|
60962
|
-
|
|
61003
|
+
C3_DEFAULTS,
|
|
61004
|
+
main,
|
|
61005
|
+
parseArgs
|
|
60963
61006
|
});
|
|
60964
61007
|
/*! Bundled license information:
|
|
60965
61008
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-cloudflare",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-f7ae0ead",
|
|
4
4
|
"description": "A CLI for creating and deploying new applications to Cloudflare.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"recast": "^0.22.0",
|
|
62
62
|
"semver": "^7.5.1",
|
|
63
63
|
"typescript": "^5.0.2",
|
|
64
|
-
"undici": "
|
|
64
|
+
"undici": "5.20.0",
|
|
65
65
|
"vite-tsconfig-paths": "^4.0.8",
|
|
66
66
|
"vitest": "^0.30.0",
|
|
67
67
|
"which-pm-runs": "^1.1.0",
|
|
@@ -12,7 +12,7 @@ The sample plugin allows ChatGPT users to search for repositories using GitHub's
|
|
|
12
12
|
1. Install [wrangler](https://developers.cloudflare.com/workers/cli-wrangler/install-update), the Cloudflare Workers CLI
|
|
13
13
|
2. Clone this project and install dependencies with `npm install`
|
|
14
14
|
3. Run `wrangler login` to login to your Cloudflare account in wrangler
|
|
15
|
-
4. Run `wrangler
|
|
15
|
+
4. Run `wrangler deploy` to publish the plugin to Cloudflare Workers
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
name = "
|
|
1
|
+
name = "<TBD>"
|
|
2
2
|
main = "src/index.ts"
|
|
3
|
-
compatibility_date = "
|
|
3
|
+
compatibility_date = "<TBD>"
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
"version": "0.0.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
|
-
"deploy": "wrangler
|
|
6
|
+
"deploy": "wrangler deploy",
|
|
7
7
|
"start": "wrangler dev"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@cloudflare/workers-types": "^4.20230419.0",
|
|
11
10
|
"itty-router": "^3.0.12",
|
|
12
11
|
"wrangler": "^3.0.0"
|
|
13
12
|
}
|
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
"version": "0.0.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
|
-
"deploy": "wrangler
|
|
6
|
+
"deploy": "wrangler deploy",
|
|
7
7
|
"start": "wrangler dev"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@cloudflare/workers-types": "^4.20230419.0",
|
|
11
|
-
"typescript": "^5.0.4",
|
|
12
10
|
"wrangler": "^3.0.0"
|
|
13
11
|
}
|
|
14
12
|
}
|
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
"version": "0.0.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
|
-
"deploy": "wrangler
|
|
6
|
+
"deploy": "wrangler deploy",
|
|
7
7
|
"start": "wrangler dev"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@cloudflare/workers-types": "^4.20230419.0",
|
|
11
|
-
"typescript": "^5.0.4",
|
|
12
10
|
"wrangler": "^3.0.0"
|
|
13
11
|
}
|
|
14
12
|
}
|
|
@@ -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
|
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
"version": "0.0.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
|
-
"deploy": "wrangler
|
|
6
|
+
"deploy": "wrangler deploy",
|
|
7
7
|
"start": "wrangler dev"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@cloudflare/workers-types": "^4.20230419.0",
|
|
11
|
-
"typescript": "^5.0.4",
|
|
12
10
|
"wrangler": "^3.0.0"
|
|
13
11
|
}
|
|
14
12
|
}
|