create-cloudflare 0.0.0-8c7c3b56b → 0.0.0-8ca9533f8
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 +695 -633
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/templates/angular/c3.ts +25 -13
- package/templates/angular/templates/src/server.ts +15 -0
- package/templates/angular/templates/tools/copy-files.mjs +8 -2
- package/templates/astro/templates/wrangler.toml +1 -0
- package/templates/hello-world/js/package.json +1 -1
- package/templates/hello-world/ts/package.json +1 -1
- package/templates/hello-world/ts/test/tsconfig.json +1 -1
- package/templates/pre-existing/c3.ts +26 -7
- package/templates/svelte/c3.ts +33 -3
- package/templates-experimental/angular/c3.ts +21 -7
- package/templates-experimental/angular/templates/src/server.ts +15 -0
- package/templates-experimental/hello-world-with-assets/js/package.json +1 -1
- package/templates-experimental/hello-world-with-assets/ts/package.json +1 -1
- package/templates-experimental/nuxt/c3.ts +1 -1
- package/templates-experimental/nuxt/templates/wrangler.toml +2 -2
- package/templates-experimental/remix/c3.ts +1 -26
- package/templates-experimental/remix/templates/public/.assetsignore +0 -4
- package/templates-experimental/remix/templates/wrangler.toml +1 -1
- package/templates-experimental/solid/c3.ts +7 -50
- package/templates-experimental/solid/templates/wrangler.toml +2 -2
- package/templates-experimental/svelte/c3.ts +3 -3
- package/templates-experimental/vue/c3.ts +33 -0
- package/templates-experimental/vue/templates/wrangler.toml +10 -0
- package/templates/angular/templates/server.ts +0 -34
- package/templates/angular/templates/tools/alter-polyfills.mjs +0 -27
- package/templates/angular/templates/tools/paths.mjs +0 -9
- package/templates-experimental/angular/templates/server.ts +0 -34
- package/templates-experimental/angular/templates/tools/alter-polyfills.mjs +0 -32
- package/templates-experimental/nuxt/templates/cloudflare-preset/nitro.config.ts +0 -27
package/dist/cli.js
CHANGED
|
@@ -558,7 +558,7 @@ var require_XDGAppPaths = __commonJS({
|
|
|
558
558
|
XDGAppPaths.cache = function cache(dirOptions) {
|
|
559
559
|
return path6.join(xdg.cache(), finalPathSegment(dirOptions));
|
|
560
560
|
};
|
|
561
|
-
XDGAppPaths.config = function
|
|
561
|
+
XDGAppPaths.config = function config27(dirOptions) {
|
|
562
562
|
return path6.join(xdg.config(), finalPathSegment(dirOptions));
|
|
563
563
|
};
|
|
564
564
|
XDGAppPaths.data = function data(dirOptions) {
|
|
@@ -615,7 +615,7 @@ var require_XDG = __commonJS({
|
|
|
615
615
|
var cache = function() {
|
|
616
616
|
return valOrPath(env3.get("XDG_CACHE_HOME"), [baseDir(), ".cache"]);
|
|
617
617
|
};
|
|
618
|
-
var
|
|
618
|
+
var config27 = function() {
|
|
619
619
|
return valOrPath(env3.get("XDG_CONFIG_HOME"), [baseDir(), ".config"]);
|
|
620
620
|
};
|
|
621
621
|
var data = function() {
|
|
@@ -627,13 +627,13 @@ var require_XDG = __commonJS({
|
|
|
627
627
|
var state = function() {
|
|
628
628
|
return valOrPath(env3.get("XDG_STATE_HOME"), [baseDir(), ".local", "state"]);
|
|
629
629
|
};
|
|
630
|
-
return { cache, config:
|
|
630
|
+
return { cache, config: config27, data, runtime, state };
|
|
631
631
|
};
|
|
632
632
|
var macos = function() {
|
|
633
633
|
var cache = function() {
|
|
634
634
|
return valOrPath(env3.get("XDG_CACHE_HOME"), [baseDir(), "Library", "Caches"]);
|
|
635
635
|
};
|
|
636
|
-
var
|
|
636
|
+
var config27 = function() {
|
|
637
637
|
return valOrPath(env3.get("XDG_CONFIG_HOME"), [baseDir(), "Library", "Preferences"]);
|
|
638
638
|
};
|
|
639
639
|
var data = function() {
|
|
@@ -645,7 +645,7 @@ var require_XDG = __commonJS({
|
|
|
645
645
|
var state = function() {
|
|
646
646
|
return valOrPath(env3.get("XDG_STATE_HOME"), [baseDir(), "Library", "State"]);
|
|
647
647
|
};
|
|
648
|
-
return { cache, config:
|
|
648
|
+
return { cache, config: config27, data, runtime, state };
|
|
649
649
|
};
|
|
650
650
|
var windows = function() {
|
|
651
651
|
function appData() {
|
|
@@ -657,7 +657,7 @@ var require_XDG = __commonJS({
|
|
|
657
657
|
var cache = function() {
|
|
658
658
|
return valOrPath(env3.get("XDG_CACHE_HOME"), [localAppData(), "xdg.cache"]);
|
|
659
659
|
};
|
|
660
|
-
var
|
|
660
|
+
var config27 = function() {
|
|
661
661
|
return valOrPath(env3.get("XDG_CONFIG_HOME"), [appData(), "xdg.config"]);
|
|
662
662
|
};
|
|
663
663
|
var data = function() {
|
|
@@ -669,7 +669,7 @@ var require_XDG = __commonJS({
|
|
|
669
669
|
var state = function() {
|
|
670
670
|
return valOrPath(env3.get("XDG_STATE_HOME"), [localAppData(), "xdg.state"]);
|
|
671
671
|
};
|
|
672
|
-
return { cache, config:
|
|
672
|
+
return { cache, config: config27, data, runtime, state };
|
|
673
673
|
};
|
|
674
674
|
var XDG_ = function() {
|
|
675
675
|
function XDG_2() {
|
|
@@ -24815,8 +24815,8 @@ var require_index_688c5d50 = __commonJS({
|
|
|
24815
24815
|
var pathReservations = () => {
|
|
24816
24816
|
const queues = /* @__PURE__ */ new Map();
|
|
24817
24817
|
const reservations = /* @__PURE__ */ new Map();
|
|
24818
|
-
const { join:
|
|
24819
|
-
const getDirs = (path7) =>
|
|
24818
|
+
const { join: join8 } = path__default["default"];
|
|
24819
|
+
const getDirs = (path7) => join8(path7).split(/[\\/]/).slice(0, -1).reduce((set, path8) => set.length ? set.concat(join8(set[set.length - 1], path8)) : [path8], []);
|
|
24820
24820
|
const running = /* @__PURE__ */ new Set();
|
|
24821
24821
|
const getQueues = (fn) => {
|
|
24822
24822
|
const res = reservations.get(fn);
|
|
@@ -32170,22 +32170,22 @@ var require_dist_web = __commonJS({
|
|
|
32170
32170
|
_createClass(Haikunator3, [{
|
|
32171
32171
|
key: "haikunate",
|
|
32172
32172
|
value: function haikunate(options) {
|
|
32173
|
-
var
|
|
32174
|
-
if (
|
|
32175
|
-
|
|
32173
|
+
var config27 = (0, _lodash["default"])(options, this.config);
|
|
32174
|
+
if (config27.tokenHex === true) {
|
|
32175
|
+
config27.tokenChars = "0123456789abcdef";
|
|
32176
32176
|
}
|
|
32177
32177
|
var adjective = this._randomElement(this.adjectives);
|
|
32178
32178
|
var noun = this._randomElement(this.nouns);
|
|
32179
|
-
if (!
|
|
32180
|
-
|
|
32179
|
+
if (!config27.tokenLength)
|
|
32180
|
+
config27.tokenLength = 0;
|
|
32181
32181
|
var token = "";
|
|
32182
|
-
for (var i = 0; i <
|
|
32183
|
-
token += this._randomElement(
|
|
32182
|
+
for (var i = 0; i < config27.tokenLength; i++) {
|
|
32183
|
+
token += this._randomElement(config27.tokenChars);
|
|
32184
32184
|
}
|
|
32185
32185
|
var sections = [adjective, noun, token];
|
|
32186
32186
|
return sections.filter(function(e) {
|
|
32187
32187
|
return !!e;
|
|
32188
|
-
}).join(
|
|
32188
|
+
}).join(config27.delimiter);
|
|
32189
32189
|
}
|
|
32190
32190
|
/**
|
|
32191
32191
|
* Get a random element from an array/string
|
|
@@ -38609,7 +38609,7 @@ var require_util8 = __commonJS({
|
|
|
38609
38609
|
return path6;
|
|
38610
38610
|
}
|
|
38611
38611
|
exports2.normalize = normalize2;
|
|
38612
|
-
function
|
|
38612
|
+
function join8(aRoot, aPath) {
|
|
38613
38613
|
if (aRoot === "") {
|
|
38614
38614
|
aRoot = ".";
|
|
38615
38615
|
}
|
|
@@ -38641,7 +38641,7 @@ var require_util8 = __commonJS({
|
|
|
38641
38641
|
}
|
|
38642
38642
|
return joined;
|
|
38643
38643
|
}
|
|
38644
|
-
exports2.join =
|
|
38644
|
+
exports2.join = join8;
|
|
38645
38645
|
exports2.isAbsolute = function(aPath) {
|
|
38646
38646
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
38647
38647
|
};
|
|
@@ -38814,7 +38814,7 @@ var require_util8 = __commonJS({
|
|
|
38814
38814
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
38815
38815
|
}
|
|
38816
38816
|
}
|
|
38817
|
-
sourceURL =
|
|
38817
|
+
sourceURL = join8(urlGenerate(parsed), sourceURL);
|
|
38818
38818
|
}
|
|
38819
38819
|
return normalize2(sourceURL);
|
|
38820
38820
|
}
|
|
@@ -46608,13 +46608,13 @@ var require_esprima2 = __commonJS({
|
|
|
46608
46608
|
return Reader2;
|
|
46609
46609
|
}();
|
|
46610
46610
|
var Tokenizer = function() {
|
|
46611
|
-
function Tokenizer2(code,
|
|
46611
|
+
function Tokenizer2(code, config27) {
|
|
46612
46612
|
this.errorHandler = new error_handler_1.ErrorHandler();
|
|
46613
|
-
this.errorHandler.tolerant =
|
|
46613
|
+
this.errorHandler.tolerant = config27 ? typeof config27.tolerant === "boolean" && config27.tolerant : false;
|
|
46614
46614
|
this.scanner = new scanner_1.Scanner(code, this.errorHandler);
|
|
46615
|
-
this.scanner.trackComment =
|
|
46616
|
-
this.trackRange =
|
|
46617
|
-
this.trackLoc =
|
|
46615
|
+
this.scanner.trackComment = config27 ? typeof config27.comment === "boolean" && config27.comment : false;
|
|
46616
|
+
this.trackRange = config27 ? typeof config27.range === "boolean" && config27.range : false;
|
|
46617
|
+
this.trackLoc = config27 ? typeof config27.loc === "boolean" && config27.loc : false;
|
|
46618
46618
|
this.buffer = [];
|
|
46619
46619
|
this.reader = new Reader();
|
|
46620
46620
|
}
|
|
@@ -48807,11 +48807,11 @@ var require_printer = __commonJS({
|
|
|
48807
48807
|
return this.code;
|
|
48808
48808
|
};
|
|
48809
48809
|
var emptyPrintResult = new PrintResult("");
|
|
48810
|
-
var Printer = function Printer2(
|
|
48810
|
+
var Printer = function Printer2(config27) {
|
|
48811
48811
|
assert_1.default.ok(this instanceof Printer2);
|
|
48812
|
-
var explicitTabWidth =
|
|
48813
|
-
|
|
48814
|
-
|
|
48812
|
+
var explicitTabWidth = config27 && config27.tabWidth;
|
|
48813
|
+
config27 = options_1.normalize(config27);
|
|
48814
|
+
config27.sourceFileName = null;
|
|
48815
48815
|
function makePrintFunctionWith(options, overrides) {
|
|
48816
48816
|
options = Object.assign({}, options, overrides);
|
|
48817
48817
|
return function(path6) {
|
|
@@ -48826,11 +48826,11 @@ var require_printer = __commonJS({
|
|
|
48826
48826
|
includeComments: false
|
|
48827
48827
|
}));
|
|
48828
48828
|
}
|
|
48829
|
-
var oldTabWidth =
|
|
48829
|
+
var oldTabWidth = config27.tabWidth;
|
|
48830
48830
|
if (!explicitTabWidth) {
|
|
48831
48831
|
var loc = path6.getNode().loc;
|
|
48832
48832
|
if (loc && loc.lines && loc.lines.guessTabWidth) {
|
|
48833
|
-
|
|
48833
|
+
config27.tabWidth = loc.lines.guessTabWidth();
|
|
48834
48834
|
}
|
|
48835
48835
|
}
|
|
48836
48836
|
var reprinter = patcher_1.getReprinter(path6);
|
|
@@ -48844,11 +48844,11 @@ var require_printer = __commonJS({
|
|
|
48844
48844
|
// right choice because it gives us the opportunity to reprint
|
|
48845
48845
|
// such nodes using their original source.
|
|
48846
48846
|
reprinter(print2)
|
|
48847
|
-
) : genericPrint(path6,
|
|
48847
|
+
) : genericPrint(path6, config27, options, makePrintFunctionWith(options, {
|
|
48848
48848
|
includeComments: true,
|
|
48849
48849
|
avoidRootParens: false
|
|
48850
48850
|
}));
|
|
48851
|
-
|
|
48851
|
+
config27.tabWidth = oldTabWidth;
|
|
48852
48852
|
return lines;
|
|
48853
48853
|
}
|
|
48854
48854
|
this.print = function(ast) {
|
|
@@ -48859,7 +48859,7 @@ var require_printer = __commonJS({
|
|
|
48859
48859
|
includeComments: true,
|
|
48860
48860
|
avoidRootParens: false
|
|
48861
48861
|
});
|
|
48862
|
-
return new PrintResult(lines.toString(
|
|
48862
|
+
return new PrintResult(lines.toString(config27), util.composeSourceMaps(config27.inputSourceMap, lines.getSourceMap(config27.sourceMapName, config27.sourceRoot)));
|
|
48863
48863
|
};
|
|
48864
48864
|
this.printGenerically = function(ast) {
|
|
48865
48865
|
if (!ast) {
|
|
@@ -48867,26 +48867,26 @@ var require_printer = __commonJS({
|
|
|
48867
48867
|
}
|
|
48868
48868
|
function printGenerically(path7) {
|
|
48869
48869
|
return comments_1.printComments(path7, function(path8) {
|
|
48870
|
-
return genericPrint(path8,
|
|
48870
|
+
return genericPrint(path8, config27, {
|
|
48871
48871
|
includeComments: true,
|
|
48872
48872
|
avoidRootParens: false
|
|
48873
48873
|
}, printGenerically);
|
|
48874
48874
|
});
|
|
48875
48875
|
}
|
|
48876
48876
|
var path6 = fast_path_1.default.from(ast);
|
|
48877
|
-
var oldReuseWhitespace =
|
|
48878
|
-
|
|
48879
|
-
var pr = new PrintResult(printGenerically(path6).toString(
|
|
48880
|
-
|
|
48877
|
+
var oldReuseWhitespace = config27.reuseWhitespace;
|
|
48878
|
+
config27.reuseWhitespace = false;
|
|
48879
|
+
var pr = new PrintResult(printGenerically(path6).toString(config27));
|
|
48880
|
+
config27.reuseWhitespace = oldReuseWhitespace;
|
|
48881
48881
|
return pr;
|
|
48882
48882
|
};
|
|
48883
48883
|
};
|
|
48884
48884
|
exports2.Printer = Printer;
|
|
48885
|
-
function genericPrint(path6,
|
|
48885
|
+
function genericPrint(path6, config27, options, printPath) {
|
|
48886
48886
|
assert_1.default.ok(path6 instanceof fast_path_1.default);
|
|
48887
48887
|
var node = path6.getValue();
|
|
48888
48888
|
var parts = [];
|
|
48889
|
-
var linesWithoutParens = genericPrintNoParens(path6,
|
|
48889
|
+
var linesWithoutParens = genericPrintNoParens(path6, config27, printPath);
|
|
48890
48890
|
if (!node || linesWithoutParens.isEmpty()) {
|
|
48891
48891
|
return linesWithoutParens;
|
|
48892
48892
|
}
|
|
@@ -67118,7 +67118,7 @@ var logRaw = (msg) => {
|
|
|
67118
67118
|
`);
|
|
67119
67119
|
};
|
|
67120
67120
|
var log = (msg) => {
|
|
67121
|
-
const lines = msg.split("\n").map((ln) => `${gray(shapes.bar)}
|
|
67121
|
+
const lines = msg.split("\n").map((ln) => `${gray(shapes.bar)}${ln.length > 0 ? " " + white(ln) : ""}`);
|
|
67122
67122
|
logRaw(lines.join("\n"));
|
|
67123
67123
|
};
|
|
67124
67124
|
var newline = () => {
|
|
@@ -68447,7 +68447,12 @@ var inputPrompt = async (promptConfig) => {
|
|
|
68447
68447
|
};
|
|
68448
68448
|
let prompt;
|
|
68449
68449
|
const dispatchRender = (props, p2) => {
|
|
68450
|
-
|
|
68450
|
+
let state = props.state;
|
|
68451
|
+
if (state === "initial" && promptConfig.initialErrorMessage) {
|
|
68452
|
+
state = "error";
|
|
68453
|
+
props.error = promptConfig.initialErrorMessage;
|
|
68454
|
+
}
|
|
68455
|
+
const renderedLines = renderers[state](props, p2);
|
|
68451
68456
|
return renderedLines.join("\n");
|
|
68452
68457
|
};
|
|
68453
68458
|
if (promptConfig.type === "select") {
|
|
@@ -68533,33 +68538,33 @@ var inputPrompt = async (promptConfig) => {
|
|
|
68533
68538
|
}
|
|
68534
68539
|
return input;
|
|
68535
68540
|
};
|
|
68536
|
-
var renderSubmit = (
|
|
68537
|
-
const { question, label } =
|
|
68538
|
-
if (
|
|
68541
|
+
var renderSubmit = (config27, value) => {
|
|
68542
|
+
const { question, label } = config27;
|
|
68543
|
+
if (config27.type !== "confirm" && !value) {
|
|
68539
68544
|
return [`${leftT} ${question} ${dim("(skipped)")}`, `${grayBar}`];
|
|
68540
68545
|
}
|
|
68541
|
-
const content =
|
|
68546
|
+
const content = config27.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
|
|
68542
68547
|
return [`${leftT} ${question}`, content, `${grayBar}`];
|
|
68543
68548
|
};
|
|
68544
|
-
var getRenderers = (
|
|
68545
|
-
switch (
|
|
68549
|
+
var getRenderers = (config27) => {
|
|
68550
|
+
switch (config27.type) {
|
|
68546
68551
|
case "select":
|
|
68547
|
-
return getSelectRenderers(
|
|
68552
|
+
return getSelectRenderers(config27);
|
|
68548
68553
|
case "confirm":
|
|
68549
|
-
return getConfirmRenderers(
|
|
68554
|
+
return getConfirmRenderers(config27);
|
|
68550
68555
|
case "text":
|
|
68551
|
-
return getTextRenderers(
|
|
68556
|
+
return getTextRenderers(config27);
|
|
68552
68557
|
case "multiselect":
|
|
68553
|
-
return getSelectRenderers(
|
|
68558
|
+
return getSelectRenderers(config27);
|
|
68554
68559
|
case "list":
|
|
68555
|
-
return getSelectListRenderers(
|
|
68560
|
+
return getSelectListRenderers(config27);
|
|
68556
68561
|
}
|
|
68557
68562
|
};
|
|
68558
|
-
var getTextRenderers = (
|
|
68559
|
-
const { question } =
|
|
68560
|
-
const helpText =
|
|
68561
|
-
const format5 =
|
|
68562
|
-
const defaultValue =
|
|
68563
|
+
var getTextRenderers = (config27) => {
|
|
68564
|
+
const { question } = config27;
|
|
68565
|
+
const helpText = config27.helpText ?? "";
|
|
68566
|
+
const format5 = config27.format ?? ((val) => String(val));
|
|
68567
|
+
const defaultValue = config27.defaultValue?.toString() ?? "";
|
|
68563
68568
|
const activeRenderer = ({ value }) => [
|
|
68564
68569
|
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
|
68565
68570
|
`${space(2)}${format5(value || dim(defaultValue))}`,
|
|
@@ -68582,14 +68587,14 @@ var getTextRenderers = (config26) => {
|
|
|
68582
68587
|
``
|
|
68583
68588
|
// extra line for readability
|
|
68584
68589
|
],
|
|
68585
|
-
submit: ({ value }) => renderSubmit(
|
|
68590
|
+
submit: ({ value }) => renderSubmit(config27, format5(value ?? "")),
|
|
68586
68591
|
cancel: activeRenderer
|
|
68587
68592
|
};
|
|
68588
68593
|
};
|
|
68589
|
-
var getSelectRenderers = (
|
|
68590
|
-
const { options, question, helpText: _helpText } =
|
|
68594
|
+
var getSelectRenderers = (config27) => {
|
|
68595
|
+
const { options, question, helpText: _helpText } = config27;
|
|
68591
68596
|
const helpText = _helpText ?? "";
|
|
68592
|
-
const maxItemsPerPage =
|
|
68597
|
+
const maxItemsPerPage = config27.maxItemsPerPage ?? 32;
|
|
68593
68598
|
const defaultRenderer = ({ cursor = 0, value }) => {
|
|
68594
68599
|
const renderOption = (opt, i) => {
|
|
68595
68600
|
const { label: optionLabel, value: optionValue } = opt;
|
|
@@ -68664,21 +68669,21 @@ ${space(2)}${dim("...")}` : ""}`,
|
|
|
68664
68669
|
submit: ({ value }) => {
|
|
68665
68670
|
if (Array.isArray(value)) {
|
|
68666
68671
|
return renderSubmit(
|
|
68667
|
-
|
|
68672
|
+
config27,
|
|
68668
68673
|
options.filter((o) => value.includes(o.value)).map((o) => o.label).join(", ")
|
|
68669
68674
|
);
|
|
68670
68675
|
}
|
|
68671
68676
|
return renderSubmit(
|
|
68672
|
-
|
|
68677
|
+
config27,
|
|
68673
68678
|
options.find((o) => o.value === value)?.label
|
|
68674
68679
|
);
|
|
68675
68680
|
},
|
|
68676
68681
|
cancel: defaultRenderer
|
|
68677
68682
|
};
|
|
68678
68683
|
};
|
|
68679
|
-
var getSelectListRenderers = (
|
|
68680
|
-
const { question, helpText: _helpText } =
|
|
68681
|
-
let options =
|
|
68684
|
+
var getSelectListRenderers = (config27) => {
|
|
68685
|
+
const { question, helpText: _helpText } = config27;
|
|
68686
|
+
let options = config27.options;
|
|
68682
68687
|
const helpText = _helpText ?? "";
|
|
68683
68688
|
const { rows } = stdout;
|
|
68684
68689
|
const defaultRenderer = ({ cursor, value }, prompt) => {
|
|
@@ -68759,20 +68764,20 @@ var getSelectListRenderers = (config26) => {
|
|
|
68759
68764
|
submit: ({ value }) => {
|
|
68760
68765
|
if (Array.isArray(value)) {
|
|
68761
68766
|
return renderSubmit(
|
|
68762
|
-
|
|
68767
|
+
config27,
|
|
68763
68768
|
options.filter((o) => value.includes(o.value)).map((o) => o.value).join(", ")
|
|
68764
68769
|
);
|
|
68765
68770
|
}
|
|
68766
68771
|
return renderSubmit(
|
|
68767
|
-
|
|
68772
|
+
config27,
|
|
68768
68773
|
options.find((o) => o.value === value)?.value
|
|
68769
68774
|
);
|
|
68770
68775
|
},
|
|
68771
68776
|
cancel: defaultRenderer
|
|
68772
68777
|
};
|
|
68773
68778
|
};
|
|
68774
|
-
var getConfirmRenderers = (
|
|
68775
|
-
const { activeText, inactiveText, question, helpText: _helpText } =
|
|
68779
|
+
var getConfirmRenderers = (config27) => {
|
|
68780
|
+
const { activeText, inactiveText, question, helpText: _helpText } = config27;
|
|
68776
68781
|
const helpText = _helpText ?? "";
|
|
68777
68782
|
const active = activeText || "Yes";
|
|
68778
68783
|
const inactive = inactiveText || "No";
|
|
@@ -68789,7 +68794,7 @@ var getConfirmRenderers = (config26) => {
|
|
|
68789
68794
|
active: defaultRenderer,
|
|
68790
68795
|
confirm: defaultRenderer,
|
|
68791
68796
|
error: defaultRenderer,
|
|
68792
|
-
submit: ({ value }) => renderSubmit(
|
|
68797
|
+
submit: ({ value }) => renderSubmit(config27, value ? "yes" : "no"),
|
|
68793
68798
|
cancel: defaultRenderer
|
|
68794
68799
|
};
|
|
68795
68800
|
};
|
|
@@ -68813,7 +68818,10 @@ var spinner = (frames = spinnerFrames.clockwise, color = brandColor) => {
|
|
|
68813
68818
|
start(msg, helpText) {
|
|
68814
68819
|
helpText ||= ``;
|
|
68815
68820
|
currentMsg = msg;
|
|
68816
|
-
startMsg =
|
|
68821
|
+
startMsg = currentMsg;
|
|
68822
|
+
if (helpText !== void 0 && helpText.length > 0) {
|
|
68823
|
+
startMsg += ` ${dim(helpText)}`;
|
|
68824
|
+
}
|
|
68817
68825
|
if (isInteractive()) {
|
|
68818
68826
|
let index = 0;
|
|
68819
68827
|
clearLoop();
|
|
@@ -68826,7 +68834,7 @@ var spinner = (frames = spinnerFrames.clockwise, color = brandColor) => {
|
|
|
68826
68834
|
}
|
|
68827
68835
|
}, frameRate);
|
|
68828
68836
|
} else {
|
|
68829
|
-
|
|
68837
|
+
logRaw(`${leftT} ${startMsg}`);
|
|
68830
68838
|
}
|
|
68831
68839
|
},
|
|
68832
68840
|
update(msg) {
|
|
@@ -68844,17 +68852,20 @@ ${grayBar} ${msg}`);
|
|
|
68844
68852
|
clearLoop();
|
|
68845
68853
|
} else {
|
|
68846
68854
|
if (msg !== void 0) {
|
|
68847
|
-
|
|
68848
|
-
${grayBar} ${msg}`);
|
|
68855
|
+
logRaw(`${grayBar} ${msg}`);
|
|
68849
68856
|
}
|
|
68850
68857
|
newline();
|
|
68851
68858
|
}
|
|
68852
68859
|
}
|
|
68853
68860
|
};
|
|
68854
68861
|
};
|
|
68855
|
-
|
|
68856
|
-
|
|
68857
|
-
|
|
68862
|
+
function isInteractive() {
|
|
68863
|
+
try {
|
|
68864
|
+
return Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
68865
|
+
} catch {
|
|
68866
|
+
return false;
|
|
68867
|
+
}
|
|
68868
|
+
}
|
|
68858
68869
|
|
|
68859
68870
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/lib/platform-shims/esm.mjs
|
|
68860
68871
|
var import_assert = require("assert");
|
|
@@ -69753,23 +69764,23 @@ var YargsParser = class {
|
|
|
69753
69764
|
const configPath = argv2[configKey] || configLookup[configKey];
|
|
69754
69765
|
if (configPath) {
|
|
69755
69766
|
try {
|
|
69756
|
-
let
|
|
69767
|
+
let config27 = null;
|
|
69757
69768
|
const resolvedConfigPath = mixin2.resolve(mixin2.cwd(), configPath);
|
|
69758
69769
|
const resolveConfig = flags.configs[configKey];
|
|
69759
69770
|
if (typeof resolveConfig === "function") {
|
|
69760
69771
|
try {
|
|
69761
|
-
|
|
69772
|
+
config27 = resolveConfig(resolvedConfigPath);
|
|
69762
69773
|
} catch (e) {
|
|
69763
|
-
|
|
69774
|
+
config27 = e;
|
|
69764
69775
|
}
|
|
69765
|
-
if (
|
|
69766
|
-
error2 =
|
|
69776
|
+
if (config27 instanceof Error) {
|
|
69777
|
+
error2 = config27;
|
|
69767
69778
|
return;
|
|
69768
69779
|
}
|
|
69769
69780
|
} else {
|
|
69770
|
-
|
|
69781
|
+
config27 = mixin2.require(resolvedConfigPath);
|
|
69771
69782
|
}
|
|
69772
|
-
setConfigObject(
|
|
69783
|
+
setConfigObject(config27);
|
|
69773
69784
|
} catch (ex) {
|
|
69774
69785
|
if (ex.name === "PermissionDenied")
|
|
69775
69786
|
error2 = ex;
|
|
@@ -69779,9 +69790,9 @@ var YargsParser = class {
|
|
|
69779
69790
|
}
|
|
69780
69791
|
});
|
|
69781
69792
|
}
|
|
69782
|
-
function setConfigObject(
|
|
69783
|
-
Object.keys(
|
|
69784
|
-
const value =
|
|
69793
|
+
function setConfigObject(config27, prev) {
|
|
69794
|
+
Object.keys(config27).forEach(function(key) {
|
|
69795
|
+
const value = config27[key];
|
|
69785
69796
|
const fullKey = prev ? prev + "." + key : key;
|
|
69786
69797
|
if (typeof value === "object" && value !== null && !Array.isArray(value) && configuration["dot-notation"]) {
|
|
69787
69798
|
setConfigObject(value, fullKey);
|
|
@@ -70933,11 +70944,11 @@ var CommandInstance = class {
|
|
|
70933
70944
|
});
|
|
70934
70945
|
if (!unparsed.length)
|
|
70935
70946
|
return;
|
|
70936
|
-
const
|
|
70947
|
+
const config27 = Object.assign({}, options.configuration, {
|
|
70937
70948
|
"populate--": false
|
|
70938
70949
|
});
|
|
70939
70950
|
const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, {
|
|
70940
|
-
configuration:
|
|
70951
|
+
configuration: config27
|
|
70941
70952
|
}));
|
|
70942
70953
|
if (parsed.error) {
|
|
70943
70954
|
yargs.getInternalMethods().getUsageInstance().fail(parsed.error.message, parsed.error);
|
|
@@ -72160,31 +72171,31 @@ ${customMsgs.join("\n")}` : "";
|
|
|
72160
72171
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/utils/apply-extends.js
|
|
72161
72172
|
var previouslyVisitedConfigs = [];
|
|
72162
72173
|
var shim2;
|
|
72163
|
-
function applyExtends(
|
|
72174
|
+
function applyExtends(config27, cwd, mergeExtends, _shim) {
|
|
72164
72175
|
shim2 = _shim;
|
|
72165
72176
|
let defaultConfig = {};
|
|
72166
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
72167
|
-
if (typeof
|
|
72177
|
+
if (Object.prototype.hasOwnProperty.call(config27, "extends")) {
|
|
72178
|
+
if (typeof config27.extends !== "string")
|
|
72168
72179
|
return defaultConfig;
|
|
72169
|
-
const isPath = /\.json|\..*rc$/.test(
|
|
72180
|
+
const isPath = /\.json|\..*rc$/.test(config27.extends);
|
|
72170
72181
|
let pathToDefault = null;
|
|
72171
72182
|
if (!isPath) {
|
|
72172
72183
|
try {
|
|
72173
|
-
pathToDefault = require.resolve(
|
|
72184
|
+
pathToDefault = require.resolve(config27.extends);
|
|
72174
72185
|
} catch (_err) {
|
|
72175
|
-
return
|
|
72186
|
+
return config27;
|
|
72176
72187
|
}
|
|
72177
72188
|
} else {
|
|
72178
|
-
pathToDefault = getPathToDefaultConfig(cwd,
|
|
72189
|
+
pathToDefault = getPathToDefaultConfig(cwd, config27.extends);
|
|
72179
72190
|
}
|
|
72180
72191
|
checkForCircularExtends(pathToDefault);
|
|
72181
72192
|
previouslyVisitedConfigs.push(pathToDefault);
|
|
72182
|
-
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(
|
|
72183
|
-
delete
|
|
72193
|
+
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config27.extends);
|
|
72194
|
+
delete config27.extends;
|
|
72184
72195
|
defaultConfig = applyExtends(defaultConfig, shim2.path.dirname(pathToDefault), mergeExtends, shim2);
|
|
72185
72196
|
}
|
|
72186
72197
|
previouslyVisitedConfigs = [];
|
|
72187
|
-
return mergeExtends ? mergeDeep(defaultConfig,
|
|
72198
|
+
return mergeExtends ? mergeDeep(defaultConfig, config27) : Object.assign({}, defaultConfig, config27);
|
|
72188
72199
|
}
|
|
72189
72200
|
function checkForCircularExtends(cfgPath) {
|
|
72190
72201
|
if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
|
|
@@ -72194,17 +72205,17 @@ function checkForCircularExtends(cfgPath) {
|
|
|
72194
72205
|
function getPathToDefaultConfig(cwd, pathToExtend) {
|
|
72195
72206
|
return shim2.path.resolve(cwd, pathToExtend);
|
|
72196
72207
|
}
|
|
72197
|
-
function mergeDeep(config1,
|
|
72208
|
+
function mergeDeep(config1, config27) {
|
|
72198
72209
|
const target = {};
|
|
72199
72210
|
function isObject2(obj) {
|
|
72200
72211
|
return obj && typeof obj === "object" && !Array.isArray(obj);
|
|
72201
72212
|
}
|
|
72202
72213
|
Object.assign(target, config1);
|
|
72203
|
-
for (const key of Object.keys(
|
|
72204
|
-
if (isObject2(
|
|
72205
|
-
target[key] = mergeDeep(config1[key],
|
|
72214
|
+
for (const key of Object.keys(config27)) {
|
|
72215
|
+
if (isObject2(config27[key]) && isObject2(target[key])) {
|
|
72216
|
+
target[key] = mergeDeep(config1[key], config27[key]);
|
|
72206
72217
|
} else {
|
|
72207
|
-
target[key] =
|
|
72218
|
+
target[key] = config27[key];
|
|
72208
72219
|
}
|
|
72209
72220
|
}
|
|
72210
72221
|
return target;
|
|
@@ -72965,9 +72976,9 @@ var YargsInstance = class {
|
|
|
72965
72976
|
}
|
|
72966
72977
|
return maybePromise;
|
|
72967
72978
|
}
|
|
72968
|
-
parserConfiguration(
|
|
72969
|
-
argsert("<object>", [
|
|
72970
|
-
__classPrivateFieldSet(this, _YargsInstance_parserConfig,
|
|
72979
|
+
parserConfiguration(config27) {
|
|
72980
|
+
argsert("<object>", [config27], arguments.length);
|
|
72981
|
+
__classPrivateFieldSet(this, _YargsInstance_parserConfig, config27, "f");
|
|
72971
72982
|
return this;
|
|
72972
72983
|
}
|
|
72973
72984
|
pkgConf(key, rootPath) {
|
|
@@ -73139,9 +73150,9 @@ var YargsInstance = class {
|
|
|
73139
73150
|
return this;
|
|
73140
73151
|
}
|
|
73141
73152
|
}
|
|
73142
|
-
usageConfiguration(
|
|
73143
|
-
argsert("<object>", [
|
|
73144
|
-
__classPrivateFieldSet(this, _YargsInstance_usageConfig,
|
|
73153
|
+
usageConfiguration(config27) {
|
|
73154
|
+
argsert("<object>", [config27], arguments.length);
|
|
73155
|
+
__classPrivateFieldSet(this, _YargsInstance_usageConfig, config27, "f");
|
|
73145
73156
|
return this;
|
|
73146
73157
|
}
|
|
73147
73158
|
version(opt, msg, ver) {
|
|
@@ -73547,11 +73558,11 @@ var YargsInstance = class {
|
|
|
73547
73558
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").__ = __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__;
|
|
73548
73559
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration = this[kGetParserConfiguration]();
|
|
73549
73560
|
const populateDoubleDash = !!__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration["populate--"];
|
|
73550
|
-
const
|
|
73561
|
+
const config27 = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, {
|
|
73551
73562
|
"populate--": true
|
|
73552
73563
|
});
|
|
73553
73564
|
const parsed = __classPrivateFieldGet(this, _YargsInstance_shim, "f").Parser.detailed(args, Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f"), {
|
|
73554
|
-
configuration: { "parse-positional-numbers": false, ...
|
|
73565
|
+
configuration: { "parse-positional-numbers": false, ...config27 }
|
|
73555
73566
|
}));
|
|
73556
73567
|
const argv = Object.assign(parsed.argv, __classPrivateFieldGet(this, _YargsInstance_parseContext, "f"));
|
|
73557
73568
|
let argvPromise = void 0;
|
|
@@ -73714,7 +73725,7 @@ var Yargs = YargsFactory(esm_default);
|
|
|
73714
73725
|
var yargs_default = Yargs;
|
|
73715
73726
|
|
|
73716
73727
|
// package.json
|
|
73717
|
-
var version = "0.0.0-
|
|
73728
|
+
var version = "0.0.0-8ca9533f8";
|
|
73718
73729
|
|
|
73719
73730
|
// src/metrics.ts
|
|
73720
73731
|
var import_node_async_hooks = require("node:async_hooks");
|
|
@@ -73758,12 +73769,12 @@ function getGlobalWranglerConfigPath() {
|
|
|
73758
73769
|
}
|
|
73759
73770
|
|
|
73760
73771
|
// src/helpers/metrics-config.ts
|
|
73761
|
-
function writeMetricsConfig(
|
|
73772
|
+
function writeMetricsConfig(config27) {
|
|
73762
73773
|
(0, import_node_fs2.mkdirSync)(import_node_path2.default.dirname(getMetricsConfigPath()), { recursive: true });
|
|
73763
73774
|
(0, import_node_fs2.writeFileSync)(
|
|
73764
73775
|
getMetricsConfigPath(),
|
|
73765
73776
|
JSON.stringify(
|
|
73766
|
-
|
|
73777
|
+
config27,
|
|
73767
73778
|
(_key, value) => value instanceof Date ? value.toISOString() : value,
|
|
73768
73779
|
" "
|
|
73769
73780
|
)
|
|
@@ -73771,9 +73782,9 @@ function writeMetricsConfig(config26) {
|
|
|
73771
73782
|
}
|
|
73772
73783
|
function readMetricsConfig() {
|
|
73773
73784
|
try {
|
|
73774
|
-
const
|
|
73785
|
+
const config27 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
|
|
73775
73786
|
return JSON.parse(
|
|
73776
|
-
|
|
73787
|
+
config27,
|
|
73777
73788
|
(key, value) => key === "date" ? new Date(value) : value
|
|
73778
73789
|
);
|
|
73779
73790
|
} catch {
|
|
@@ -73783,10 +73794,10 @@ function readMetricsConfig() {
|
|
|
73783
73794
|
function getMetricsConfigPath() {
|
|
73784
73795
|
return import_node_path2.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
|
|
73785
73796
|
}
|
|
73786
|
-
function getDeviceId(
|
|
73787
|
-
const deviceId =
|
|
73788
|
-
if (
|
|
73789
|
-
writeMetricsConfig({ ...
|
|
73797
|
+
function getDeviceId(config27) {
|
|
73798
|
+
const deviceId = config27.deviceId ?? (0, import_node_crypto.randomUUID)();
|
|
73799
|
+
if (config27.deviceId === void 0) {
|
|
73800
|
+
writeMetricsConfig({ ...config27, deviceId });
|
|
73790
73801
|
}
|
|
73791
73802
|
return deviceId;
|
|
73792
73803
|
}
|
|
@@ -73806,6 +73817,13 @@ var runCommand = async (command2, opts = {}) => {
|
|
|
73806
73817
|
doneText: opts.doneText,
|
|
73807
73818
|
promise() {
|
|
73808
73819
|
const [executable, ...args] = command2;
|
|
73820
|
+
if (args[0] === "wrangler") {
|
|
73821
|
+
const metrics = readMetricsConfig();
|
|
73822
|
+
if (metrics.c3permission?.enabled === false) {
|
|
73823
|
+
opts.env ??= {};
|
|
73824
|
+
opts.env["WRANGLER_SEND_METRICS"] = "false";
|
|
73825
|
+
}
|
|
73826
|
+
}
|
|
73809
73827
|
const abortController = new AbortController();
|
|
73810
73828
|
const cmd = (0, import_cross_spawn.spawn)(executable, [...args], {
|
|
73811
73829
|
// TODO: ideally inherit stderr, but npm install uses this for warnings
|
|
@@ -73964,7 +73982,7 @@ var detectPackageManager = () => {
|
|
|
73964
73982
|
}
|
|
73965
73983
|
};
|
|
73966
73984
|
var rectifyPmMismatch = async (ctx) => {
|
|
73967
|
-
const { npm:
|
|
73985
|
+
const { npm: npm23 } = detectPackageManager();
|
|
73968
73986
|
if (!detectPmMismatch(ctx)) {
|
|
73969
73987
|
return;
|
|
73970
73988
|
}
|
|
@@ -73976,17 +73994,17 @@ var rectifyPmMismatch = async (ctx) => {
|
|
|
73976
73994
|
if ((0, import_fs5.existsSync)(lockfilePath)) {
|
|
73977
73995
|
(0, import_fs5.rmSync)(lockfilePath);
|
|
73978
73996
|
}
|
|
73979
|
-
await runCommand([
|
|
73997
|
+
await runCommand([npm23, "install"], {
|
|
73980
73998
|
silent: true,
|
|
73981
73999
|
cwd: ctx.project.path,
|
|
73982
74000
|
startText: "Installing dependencies",
|
|
73983
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
74001
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm23} install\``)}`
|
|
73984
74002
|
});
|
|
73985
74003
|
};
|
|
73986
74004
|
var detectPmMismatch = (ctx) => {
|
|
73987
|
-
const { npm:
|
|
74005
|
+
const { npm: npm23 } = detectPackageManager();
|
|
73988
74006
|
const projectPath = ctx.project.path;
|
|
73989
|
-
switch (
|
|
74007
|
+
switch (npm23) {
|
|
73990
74008
|
case "npm":
|
|
73991
74009
|
return false;
|
|
73992
74010
|
case "yarn":
|
|
@@ -73994,7 +74012,7 @@ var detectPmMismatch = (ctx) => {
|
|
|
73994
74012
|
case "pnpm":
|
|
73995
74013
|
return !(0, import_fs5.existsSync)(import_path5.default.join(projectPath, "pnpm-lock.yaml"));
|
|
73996
74014
|
case "bun":
|
|
73997
|
-
return !(0, import_fs5.existsSync)(import_path5.default.join(projectPath, "bun.lockb"));
|
|
74015
|
+
return !(0, import_fs5.existsSync)(import_path5.default.join(projectPath, "bun.lockb")) && !(0, import_fs5.existsSync)(import_path5.default.join(projectPath, "bun.lock"));
|
|
73998
74016
|
}
|
|
73999
74017
|
};
|
|
74000
74018
|
|
|
@@ -74054,10 +74072,10 @@ function getPlatform() {
|
|
|
74054
74072
|
function createReporter() {
|
|
74055
74073
|
const events = [];
|
|
74056
74074
|
const als = new import_node_async_hooks.AsyncLocalStorage();
|
|
74057
|
-
const
|
|
74058
|
-
const isFirstUsage =
|
|
74075
|
+
const config27 = readMetricsConfig() ?? {};
|
|
74076
|
+
const isFirstUsage = config27.c3permission === void 0;
|
|
74059
74077
|
const isEnabled = isTelemetryEnabled();
|
|
74060
|
-
const deviceId = getDeviceId(
|
|
74078
|
+
const deviceId = getDeviceId(config27);
|
|
74061
74079
|
const packageManager = detectPackageManager();
|
|
74062
74080
|
const platform3 = getPlatform();
|
|
74063
74081
|
const amplitude_session_id = Date.now();
|
|
@@ -74090,7 +74108,7 @@ function createReporter() {
|
|
|
74090
74108
|
if (process.env.CREATE_CLOUDFLARE_TELEMETRY_DISABLED === "1") {
|
|
74091
74109
|
return false;
|
|
74092
74110
|
}
|
|
74093
|
-
return hasSparrowSourceKey() && getC3Permission(
|
|
74111
|
+
return hasSparrowSourceKey() && getC3Permission(config27).enabled;
|
|
74094
74112
|
}
|
|
74095
74113
|
async function waitForAllEventsSettled() {
|
|
74096
74114
|
await Promise.allSettled(events);
|
|
@@ -74196,20 +74214,20 @@ function initializeC3Permission(enabled = true) {
|
|
|
74196
74214
|
date: /* @__PURE__ */ new Date()
|
|
74197
74215
|
};
|
|
74198
74216
|
}
|
|
74199
|
-
function getC3Permission(
|
|
74200
|
-
if (!
|
|
74201
|
-
|
|
74202
|
-
writeMetricsConfig(
|
|
74217
|
+
function getC3Permission(config27 = readMetricsConfig() ?? {}) {
|
|
74218
|
+
if (!config27.c3permission) {
|
|
74219
|
+
config27.c3permission = initializeC3Permission();
|
|
74220
|
+
writeMetricsConfig(config27);
|
|
74203
74221
|
}
|
|
74204
|
-
return
|
|
74222
|
+
return config27.c3permission;
|
|
74205
74223
|
}
|
|
74206
74224
|
function updateC3Pemission(enabled) {
|
|
74207
|
-
const
|
|
74208
|
-
if (
|
|
74225
|
+
const config27 = readMetricsConfig();
|
|
74226
|
+
if (config27.c3permission?.enabled === enabled) {
|
|
74209
74227
|
return;
|
|
74210
74228
|
}
|
|
74211
|
-
|
|
74212
|
-
writeMetricsConfig(
|
|
74229
|
+
config27.c3permission = initializeC3Permission(enabled);
|
|
74230
|
+
writeMetricsConfig(config27);
|
|
74213
74231
|
}
|
|
74214
74232
|
var runTelemetryCommand = (action) => {
|
|
74215
74233
|
const logTelemetryStatus = (enabled) => {
|
|
@@ -74254,28 +74272,28 @@ var import_haikunator = __toESM(require_dist_web());
|
|
|
74254
74272
|
var import_fs6 = require("fs");
|
|
74255
74273
|
var import_path6 = __toESM(require("path"));
|
|
74256
74274
|
var import_undici2 = __toESM(require_undici());
|
|
74257
|
-
var installPackages = async (packages,
|
|
74258
|
-
const { npm:
|
|
74275
|
+
var installPackages = async (packages, config27 = {}) => {
|
|
74276
|
+
const { npm: npm23 } = detectPackageManager();
|
|
74259
74277
|
let saveFlag;
|
|
74260
74278
|
let cmd;
|
|
74261
|
-
switch (
|
|
74279
|
+
switch (npm23) {
|
|
74262
74280
|
case "yarn":
|
|
74263
74281
|
cmd = "add";
|
|
74264
|
-
saveFlag =
|
|
74282
|
+
saveFlag = config27.dev ? "-D" : "";
|
|
74265
74283
|
break;
|
|
74266
74284
|
case "bun":
|
|
74267
74285
|
cmd = "add";
|
|
74268
|
-
saveFlag =
|
|
74286
|
+
saveFlag = config27.dev ? "-d" : "";
|
|
74269
74287
|
break;
|
|
74270
74288
|
case "npm":
|
|
74271
74289
|
case "pnpm":
|
|
74272
74290
|
default:
|
|
74273
74291
|
cmd = "install";
|
|
74274
|
-
saveFlag =
|
|
74292
|
+
saveFlag = config27.dev ? "--save-dev" : "";
|
|
74275
74293
|
break;
|
|
74276
74294
|
}
|
|
74277
|
-
await runCommand([
|
|
74278
|
-
...
|
|
74295
|
+
await runCommand([npm23, cmd, ...saveFlag ? [saveFlag] : [], ...packages], {
|
|
74296
|
+
...config27,
|
|
74279
74297
|
silent: true
|
|
74280
74298
|
});
|
|
74281
74299
|
};
|
|
@@ -74284,11 +74302,11 @@ var npmInstall = async (ctx) => {
|
|
|
74284
74302
|
if ((0, import_fs6.existsSync)(nodeModulesPath)) {
|
|
74285
74303
|
return;
|
|
74286
74304
|
}
|
|
74287
|
-
const { npm:
|
|
74288
|
-
await runCommand([
|
|
74305
|
+
const { npm: npm23 } = detectPackageManager();
|
|
74306
|
+
await runCommand([npm23, "install"], {
|
|
74289
74307
|
silent: true,
|
|
74290
74308
|
startText: "Installing dependencies",
|
|
74291
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
74309
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm23} install\``)}`
|
|
74292
74310
|
});
|
|
74293
74311
|
};
|
|
74294
74312
|
async function getLatestPackageVersion(packageSpecifier) {
|
|
@@ -74297,7 +74315,7 @@ async function getLatestPackageVersion(packageSpecifier) {
|
|
|
74297
74315
|
return npmInfo["dist-tags"].latest;
|
|
74298
74316
|
}
|
|
74299
74317
|
var installWrangler = async () => {
|
|
74300
|
-
const { npm:
|
|
74318
|
+
const { npm: npm23 } = detectPackageManager();
|
|
74301
74319
|
if ((0, import_fs6.existsSync)(import_path6.default.resolve("node_modules", "wrangler"))) {
|
|
74302
74320
|
return;
|
|
74303
74321
|
}
|
|
@@ -74307,7 +74325,7 @@ var installWrangler = async () => {
|
|
|
74307
74325
|
"A command line tool for building Cloudflare Workers"
|
|
74308
74326
|
)}`,
|
|
74309
74327
|
doneText: `${brandColor("installed")} ${dim(
|
|
74310
|
-
`via \`${
|
|
74328
|
+
`via \`${npm23} install wrangler --save-dev\``
|
|
74311
74329
|
)}`
|
|
74312
74330
|
});
|
|
74313
74331
|
};
|
|
@@ -74461,189 +74479,6 @@ var usesEslint = (ctx) => {
|
|
|
74461
74479
|
// templates-experimental/angular/c3.ts
|
|
74462
74480
|
var import_node_path3 = require("node:path");
|
|
74463
74481
|
|
|
74464
|
-
// ../wrangler/package.json
|
|
74465
|
-
var version2 = "0.0.0-8c7c3b56b";
|
|
74466
|
-
|
|
74467
|
-
// src/git.ts
|
|
74468
|
-
var offerGit = async (ctx) => {
|
|
74469
|
-
const gitInstalled = await isGitInstalled();
|
|
74470
|
-
if (!gitInstalled) {
|
|
74471
|
-
if (ctx.args.git) {
|
|
74472
|
-
updateStatus(
|
|
74473
|
-
"Couldn't find `git` installed on your machine. Continuing without git."
|
|
74474
|
-
);
|
|
74475
|
-
}
|
|
74476
|
-
ctx.args.git = false;
|
|
74477
|
-
return;
|
|
74478
|
-
}
|
|
74479
|
-
const insideGitRepo = await isInsideGitRepo(ctx.project.path);
|
|
74480
|
-
if (insideGitRepo) {
|
|
74481
|
-
ctx.args.git = true;
|
|
74482
|
-
return;
|
|
74483
|
-
}
|
|
74484
|
-
ctx.args.git = await processArgument(ctx.args, "git", {
|
|
74485
|
-
type: "confirm",
|
|
74486
|
-
question: "Do you want to use git for version control?",
|
|
74487
|
-
label: "git",
|
|
74488
|
-
defaultValue: C3_DEFAULTS.git
|
|
74489
|
-
});
|
|
74490
|
-
if (!ctx.args.git) {
|
|
74491
|
-
return;
|
|
74492
|
-
}
|
|
74493
|
-
const gitConfigured = await isGitConfigured();
|
|
74494
|
-
if (!gitConfigured) {
|
|
74495
|
-
updateStatus(
|
|
74496
|
-
"Must configure `user.name` and user.email` to use git. Continuing without git."
|
|
74497
|
-
);
|
|
74498
|
-
ctx.args.git = false;
|
|
74499
|
-
return;
|
|
74500
|
-
}
|
|
74501
|
-
await initializeGit(ctx.project.path);
|
|
74502
|
-
};
|
|
74503
|
-
var gitCommit = async (ctx) => {
|
|
74504
|
-
const commitMessage = await createCommitMessage(ctx);
|
|
74505
|
-
if (!ctx.args.git) {
|
|
74506
|
-
return;
|
|
74507
|
-
}
|
|
74508
|
-
if (ctx.gitRepoAlreadyExisted) {
|
|
74509
|
-
return;
|
|
74510
|
-
}
|
|
74511
|
-
const gitInstalled = await isGitInstalled();
|
|
74512
|
-
const gitInitialized = await isInsideGitRepo(ctx.project.path);
|
|
74513
|
-
if (!gitInstalled || !gitInitialized) {
|
|
74514
|
-
return;
|
|
74515
|
-
}
|
|
74516
|
-
const s = spinner();
|
|
74517
|
-
s.start("Committing new files");
|
|
74518
|
-
await runCommand(["git", "add", "."], {
|
|
74519
|
-
silent: true,
|
|
74520
|
-
cwd: ctx.project.path
|
|
74521
|
-
});
|
|
74522
|
-
await runCommand(["git", "commit", "-m", commitMessage], {
|
|
74523
|
-
silent: true,
|
|
74524
|
-
cwd: ctx.project.path
|
|
74525
|
-
});
|
|
74526
|
-
s.stop(`${brandColor("git")} ${dim(`commit`)}`);
|
|
74527
|
-
};
|
|
74528
|
-
var createCommitMessage = async (ctx) => {
|
|
74529
|
-
const framework = ctx.template.frameworkCli;
|
|
74530
|
-
const header = framework ? "Initialize web application via create-cloudflare CLI" : "Initial commit (by create-cloudflare CLI)";
|
|
74531
|
-
const packageManager = detectPackageManager();
|
|
74532
|
-
const gitVersion = await getGitVersion();
|
|
74533
|
-
const insideRepo = await isInsideGitRepo(ctx.project.path);
|
|
74534
|
-
const details = [
|
|
74535
|
-
{ key: "C3", value: `create-cloudflare@${version}` },
|
|
74536
|
-
{ key: "project name", value: ctx.project.name },
|
|
74537
|
-
...framework ? [{ key: "framework", value: ctx.template.id }] : [],
|
|
74538
|
-
...framework ? [{ key: "framework cli", value: getFrameworkCli(ctx) }] : [],
|
|
74539
|
-
{
|
|
74540
|
-
key: "package manager",
|
|
74541
|
-
value: `${packageManager.name}@${packageManager.version}`
|
|
74542
|
-
},
|
|
74543
|
-
{
|
|
74544
|
-
key: "wrangler",
|
|
74545
|
-
value: `wrangler@${version2}`
|
|
74546
|
-
},
|
|
74547
|
-
{
|
|
74548
|
-
key: "git",
|
|
74549
|
-
value: insideRepo ? gitVersion : "N/A"
|
|
74550
|
-
}
|
|
74551
|
-
];
|
|
74552
|
-
const body = `Details:
|
|
74553
|
-
${details.map(({ key, value }) => ` ${key} = ${value}`).join("\n")}
|
|
74554
|
-
`;
|
|
74555
|
-
const commitMessage = `${header}
|
|
74556
|
-
|
|
74557
|
-
${body}
|
|
74558
|
-
`;
|
|
74559
|
-
ctx.commitMessage = commitMessage;
|
|
74560
|
-
return commitMessage;
|
|
74561
|
-
};
|
|
74562
|
-
async function getGitVersion() {
|
|
74563
|
-
try {
|
|
74564
|
-
const rawGitVersion = await runCommand(["git", "--version"], {
|
|
74565
|
-
useSpinner: false,
|
|
74566
|
-
silent: true
|
|
74567
|
-
});
|
|
74568
|
-
const gitVersion = rawGitVersion.replace(/^git\s+version\s+/, "");
|
|
74569
|
-
return gitVersion;
|
|
74570
|
-
} catch {
|
|
74571
|
-
return null;
|
|
74572
|
-
}
|
|
74573
|
-
}
|
|
74574
|
-
async function isGitInstalled() {
|
|
74575
|
-
return await getGitVersion() !== null;
|
|
74576
|
-
}
|
|
74577
|
-
async function isGitConfigured() {
|
|
74578
|
-
try {
|
|
74579
|
-
const userName = await runCommand(["git", "config", "user.name"], {
|
|
74580
|
-
useSpinner: false,
|
|
74581
|
-
silent: true
|
|
74582
|
-
});
|
|
74583
|
-
if (!userName) {
|
|
74584
|
-
return false;
|
|
74585
|
-
}
|
|
74586
|
-
const email = await runCommand(["git", "config", "user.email"], {
|
|
74587
|
-
useSpinner: false,
|
|
74588
|
-
silent: true
|
|
74589
|
-
});
|
|
74590
|
-
if (!email) {
|
|
74591
|
-
return false;
|
|
74592
|
-
}
|
|
74593
|
-
return true;
|
|
74594
|
-
} catch {
|
|
74595
|
-
return false;
|
|
74596
|
-
}
|
|
74597
|
-
}
|
|
74598
|
-
async function isInsideGitRepo(cwd) {
|
|
74599
|
-
try {
|
|
74600
|
-
const output = await runCommand(["git", "status"], {
|
|
74601
|
-
cwd,
|
|
74602
|
-
useSpinner: false,
|
|
74603
|
-
silent: true,
|
|
74604
|
-
captureOutput: true
|
|
74605
|
-
});
|
|
74606
|
-
return output.includes("not a git repository") === false;
|
|
74607
|
-
} catch (err) {
|
|
74608
|
-
return false;
|
|
74609
|
-
}
|
|
74610
|
-
}
|
|
74611
|
-
async function initializeGit(cwd) {
|
|
74612
|
-
const s = spinner();
|
|
74613
|
-
s.start("Initializing git repo");
|
|
74614
|
-
try {
|
|
74615
|
-
const defaultBranchName = await runCommand(
|
|
74616
|
-
["git", "config", "--get", "init.defaultBranch"],
|
|
74617
|
-
{ useSpinner: false, silent: true, cwd }
|
|
74618
|
-
);
|
|
74619
|
-
await runCommand(
|
|
74620
|
-
["git", "init", "--initial-branch", defaultBranchName.trim() ?? "main"],
|
|
74621
|
-
// branch names can't contain spaces, so this is safe
|
|
74622
|
-
{ useSpinner: false, silent: true, cwd }
|
|
74623
|
-
);
|
|
74624
|
-
} catch {
|
|
74625
|
-
await runCommand(["git", "init"], { useSpinner: false, silent: true, cwd });
|
|
74626
|
-
} finally {
|
|
74627
|
-
s.stop(`${brandColor("initialized")} ${dim(`git`)}`);
|
|
74628
|
-
}
|
|
74629
|
-
}
|
|
74630
|
-
async function getProductionBranch(cwd) {
|
|
74631
|
-
try {
|
|
74632
|
-
const productionBranch = await runCommand(
|
|
74633
|
-
["git", "branch", "--show-current"],
|
|
74634
|
-
{
|
|
74635
|
-
silent: true,
|
|
74636
|
-
cwd,
|
|
74637
|
-
useSpinner: false,
|
|
74638
|
-
captureOutput: true
|
|
74639
|
-
}
|
|
74640
|
-
);
|
|
74641
|
-
return productionBranch.trim();
|
|
74642
|
-
} catch (err) {
|
|
74643
|
-
}
|
|
74644
|
-
return "main";
|
|
74645
|
-
}
|
|
74646
|
-
|
|
74647
74482
|
// src/frameworks/package.json
|
|
74648
74483
|
var package_default = {
|
|
74649
74484
|
name: "frameworks_clis_info",
|
|
@@ -74652,20 +74487,20 @@ var package_default = {
|
|
|
74652
74487
|
"so that we can use dependabot to update these dependencies automatically."
|
|
74653
74488
|
],
|
|
74654
74489
|
dependencies: {
|
|
74655
|
-
"create-astro": "4.
|
|
74490
|
+
"create-astro": "4.10.0",
|
|
74656
74491
|
"create-analog": "1.8.1",
|
|
74657
|
-
"@angular/create": "
|
|
74658
|
-
"create-docusaurus": "3.
|
|
74659
|
-
"create-hono": "0.14.
|
|
74492
|
+
"@angular/create": "19.0.0",
|
|
74493
|
+
"create-docusaurus": "3.6.3",
|
|
74494
|
+
"create-hono": "0.14.2",
|
|
74660
74495
|
"create-next-app": "14.2.5",
|
|
74661
|
-
"create-qwik": "1.
|
|
74662
|
-
"create-vite": "
|
|
74663
|
-
"create-remix": "2.
|
|
74664
|
-
"create-solid": "0.5.
|
|
74665
|
-
"create-
|
|
74666
|
-
|
|
74667
|
-
|
|
74668
|
-
|
|
74496
|
+
"create-qwik": "1.11.0",
|
|
74497
|
+
"create-vite": "6.0.1",
|
|
74498
|
+
"create-remix": "2.15.0",
|
|
74499
|
+
"create-solid": "0.5.14",
|
|
74500
|
+
"create-vue": "3.12.1",
|
|
74501
|
+
gatsby: "5.14.0",
|
|
74502
|
+
nuxi: "3.16.0",
|
|
74503
|
+
sv: "0.6.1"
|
|
74669
74504
|
}
|
|
74670
74505
|
};
|
|
74671
74506
|
|
|
@@ -74680,9 +74515,9 @@ var getFrameworkCli = (ctx, withVersion = true) => {
|
|
|
74680
74515
|
};
|
|
74681
74516
|
var runFrameworkGenerator = async (ctx, args) => {
|
|
74682
74517
|
const cli = getFrameworkCli(ctx, true);
|
|
74683
|
-
const { npm:
|
|
74684
|
-
const cmd = [...
|
|
74685
|
-
const env3 =
|
|
74518
|
+
const { npm: npm23, dlx } = detectPackageManager();
|
|
74519
|
+
const cmd = [...npm23 === "yarn" ? ["npx"] : dlx, cli, ...args];
|
|
74520
|
+
const env3 = npm23 === "yarn" ? { npm_config_user_agent: "yarn" } : {};
|
|
74686
74521
|
if (ctx.args.additionalArgs?.length) {
|
|
74687
74522
|
cmd.push(...ctx.args.additionalArgs);
|
|
74688
74523
|
}
|
|
@@ -74693,24 +74528,16 @@ var runFrameworkGenerator = async (ctx, args) => {
|
|
|
74693
74528
|
);
|
|
74694
74529
|
logRaw("");
|
|
74695
74530
|
await runCommand(cmd, { env: env3 });
|
|
74696
|
-
if (process.env.SAVE_DIFFS) {
|
|
74697
|
-
const cmdEnv = {
|
|
74698
|
-
silent: true,
|
|
74699
|
-
cwd: ctx.project.path
|
|
74700
|
-
};
|
|
74701
|
-
if (!isInsideGitRepo(ctx.project.path)) {
|
|
74702
|
-
await runCommand(["git", "init"], cmdEnv);
|
|
74703
|
-
await runCommand(["git", "add", "."], cmdEnv);
|
|
74704
|
-
const commitMessage = `Initial commit by ${cli}`;
|
|
74705
|
-
await runCommand(["git", "commit", "-m", commitMessage], cmdEnv);
|
|
74706
|
-
}
|
|
74707
|
-
}
|
|
74708
74531
|
};
|
|
74709
74532
|
|
|
74710
74533
|
// templates-experimental/angular/c3.ts
|
|
74711
74534
|
var { npm } = detectPackageManager();
|
|
74712
74535
|
var generate = async (ctx) => {
|
|
74713
|
-
await runFrameworkGenerator(ctx, [
|
|
74536
|
+
await runFrameworkGenerator(ctx, [
|
|
74537
|
+
ctx.project.name,
|
|
74538
|
+
"--ssr",
|
|
74539
|
+
"--server-routing"
|
|
74540
|
+
]);
|
|
74714
74541
|
logRaw("");
|
|
74715
74542
|
};
|
|
74716
74543
|
var configure = async (ctx) => {
|
|
@@ -74719,9 +74546,9 @@ var configure = async (ctx) => {
|
|
|
74719
74546
|
await installCFWorker();
|
|
74720
74547
|
};
|
|
74721
74548
|
async function installCFWorker() {
|
|
74722
|
-
await installPackages(["
|
|
74549
|
+
await installPackages(["xhr2"], {
|
|
74723
74550
|
dev: true,
|
|
74724
|
-
startText: "Installing
|
|
74551
|
+
startText: "Installing additional dependencies",
|
|
74725
74552
|
doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`
|
|
74726
74553
|
});
|
|
74727
74554
|
}
|
|
@@ -74736,10 +74563,17 @@ async function updateAppCode() {
|
|
|
74736
74563
|
);
|
|
74737
74564
|
writeFile2((0, import_node_path3.resolve)(appConfigPath), newAppConfig);
|
|
74738
74565
|
s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`);
|
|
74566
|
+
const appServerRoutesPath = "src/app/app.routes.server.ts";
|
|
74567
|
+
const appRoutes = readFile((0, import_node_path3.resolve)(appServerRoutesPath));
|
|
74568
|
+
const newAppRoutes = appRoutes.replace(
|
|
74569
|
+
"RenderMode.Prerender",
|
|
74570
|
+
"RenderMode.Server"
|
|
74571
|
+
);
|
|
74572
|
+
writeFile2((0, import_node_path3.resolve)(appServerRoutesPath), newAppRoutes);
|
|
74573
|
+
s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`);
|
|
74739
74574
|
s.start(`Updating package.json`);
|
|
74740
74575
|
const packageJsonPath = (0, import_node_path3.resolve)("package.json");
|
|
74741
74576
|
const packageManifest = readJSON(packageJsonPath);
|
|
74742
|
-
delete packageManifest["dependencies"]["@angular/ssr"];
|
|
74743
74577
|
delete packageManifest["dependencies"]["express"];
|
|
74744
74578
|
delete packageManifest["devDependencies"]["@types/express"];
|
|
74745
74579
|
writeFile2(packageJsonPath, JSON.stringify(packageManifest, null, 2));
|
|
@@ -74751,7 +74585,8 @@ function updateAngularJson(ctx) {
|
|
|
74751
74585
|
const angularJson = readJSON((0, import_node_path3.resolve)("angular.json"));
|
|
74752
74586
|
const architectSection = angularJson.projects[ctx.project.name].architect;
|
|
74753
74587
|
architectSection.build.options.outputPath = "dist";
|
|
74754
|
-
architectSection.build.options.
|
|
74588
|
+
architectSection.build.options.outputMode = "server";
|
|
74589
|
+
architectSection.build.options.ssr.experimentalPlatform = "neutral";
|
|
74755
74590
|
writeFile2((0, import_node_path3.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
74756
74591
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
74757
74592
|
}
|
|
@@ -74767,13 +74602,13 @@ var config = {
|
|
|
74767
74602
|
path: "templates-experimental/angular",
|
|
74768
74603
|
devScript: "start",
|
|
74769
74604
|
deployScript: "deploy",
|
|
74605
|
+
previewScript: "start",
|
|
74770
74606
|
generate,
|
|
74771
74607
|
configure,
|
|
74772
74608
|
transformPackageJson: async () => ({
|
|
74773
74609
|
scripts: {
|
|
74774
74610
|
start: `${npm} run build && wrangler dev`,
|
|
74775
|
-
build: `ng build
|
|
74776
|
-
process: "node ./tools/alter-polyfills.mjs",
|
|
74611
|
+
build: `ng build`,
|
|
74777
74612
|
deploy: `${npm} run build && wrangler deploy`
|
|
74778
74613
|
}
|
|
74779
74614
|
})
|
|
@@ -75253,7 +75088,7 @@ var updateNuxtConfig = () => {
|
|
|
75253
75088
|
b2.objectExpression([
|
|
75254
75089
|
b2.objectProperty(
|
|
75255
75090
|
b2.identifier("preset"),
|
|
75256
|
-
b2.stringLiteral("
|
|
75091
|
+
b2.stringLiteral("cloudflare_module")
|
|
75257
75092
|
)
|
|
75258
75093
|
])
|
|
75259
75094
|
);
|
|
@@ -75417,7 +75252,7 @@ var generate9 = async (ctx) => {
|
|
|
75417
75252
|
await runFrameworkGenerator(ctx, [
|
|
75418
75253
|
ctx.project.name,
|
|
75419
75254
|
"--template",
|
|
75420
|
-
"https://github.com/remix-run/remix/tree/main/templates/cloudflare"
|
|
75255
|
+
"https://github.com/remix-run/remix/tree/main/templates/cloudflare-workers"
|
|
75421
75256
|
]);
|
|
75422
75257
|
logRaw("");
|
|
75423
75258
|
};
|
|
@@ -75427,19 +75262,6 @@ var configure6 = async () => {
|
|
|
75427
75262
|
startText: "Updating the Wrangler version",
|
|
75428
75263
|
doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`
|
|
75429
75264
|
});
|
|
75430
|
-
const typeDefsPath = "load-context.ts";
|
|
75431
|
-
const s = spinner();
|
|
75432
|
-
s.start(`Updating \`${typeDefsPath}\``);
|
|
75433
|
-
transformFile(typeDefsPath, {
|
|
75434
|
-
visitTSInterfaceDeclaration(n2) {
|
|
75435
|
-
if (n2.node.id.type === "Identifier" && n2.node.id.name !== "Env") {
|
|
75436
|
-
return this.traverse(n2);
|
|
75437
|
-
}
|
|
75438
|
-
n2.replace();
|
|
75439
|
-
return false;
|
|
75440
|
-
}
|
|
75441
|
-
});
|
|
75442
|
-
s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
|
|
75443
75265
|
};
|
|
75444
75266
|
var config10 = {
|
|
75445
75267
|
configVersion: 1,
|
|
@@ -75455,7 +75277,6 @@ var config10 = {
|
|
|
75455
75277
|
configure: configure6,
|
|
75456
75278
|
transformPackageJson: async () => ({
|
|
75457
75279
|
scripts: {
|
|
75458
|
-
build: "remix vite:build && wrangler pages functions build --outdir build/worker",
|
|
75459
75280
|
deploy: `${npm6} run build && wrangler deploy`,
|
|
75460
75281
|
preview: `${npm6} run build && wrangler dev`,
|
|
75461
75282
|
"cf-typegen": `wrangler types`
|
|
@@ -75483,6 +75304,7 @@ var configure7 = async (ctx) => {
|
|
|
75483
75304
|
});
|
|
75484
75305
|
usesTypescript(ctx);
|
|
75485
75306
|
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
75307
|
+
const compatDate = await getWorkerdCompatibilityDate();
|
|
75486
75308
|
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
75487
75309
|
transformFile(filePath, {
|
|
75488
75310
|
visitCallExpression: function(n2) {
|
|
@@ -75497,60 +75319,14 @@ var configure7 = async (ctx) => {
|
|
|
75497
75319
|
b2.objectProperty(
|
|
75498
75320
|
b2.identifier("server"),
|
|
75499
75321
|
b2.objectExpression([
|
|
75500
|
-
// preset: "
|
|
75322
|
+
// preset: "cloudflare_module"
|
|
75501
75323
|
b2.objectProperty(
|
|
75502
75324
|
b2.identifier("preset"),
|
|
75503
|
-
b2.stringLiteral("
|
|
75325
|
+
b2.stringLiteral("cloudflare_module")
|
|
75504
75326
|
),
|
|
75505
|
-
// output: {
|
|
75506
|
-
// dir: "{{ rootDir }}/dist",
|
|
75507
|
-
// publicDir: "{{ output.dir }}/public",
|
|
75508
|
-
// serverDir: "{{ output.dir }}/worker",
|
|
75509
|
-
// },
|
|
75510
75327
|
b2.objectProperty(
|
|
75511
|
-
b2.identifier("
|
|
75512
|
-
b2.
|
|
75513
|
-
b2.objectProperty(
|
|
75514
|
-
b2.identifier("dir"),
|
|
75515
|
-
b2.stringLiteral("{{ rootDir }}/dist")
|
|
75516
|
-
),
|
|
75517
|
-
b2.objectProperty(
|
|
75518
|
-
b2.identifier("publicDir"),
|
|
75519
|
-
b2.stringLiteral("{{ output.dir }}/public")
|
|
75520
|
-
),
|
|
75521
|
-
b2.objectProperty(
|
|
75522
|
-
b2.identifier("serverDir"),
|
|
75523
|
-
b2.stringLiteral("{{ output.dir }}/worker")
|
|
75524
|
-
)
|
|
75525
|
-
])
|
|
75526
|
-
),
|
|
75527
|
-
// rollupConfig: {
|
|
75528
|
-
// external: ["node:async_hooks"],
|
|
75529
|
-
// },
|
|
75530
|
-
b2.objectProperty(
|
|
75531
|
-
b2.identifier("rollupConfig"),
|
|
75532
|
-
b2.objectExpression([
|
|
75533
|
-
b2.objectProperty(
|
|
75534
|
-
b2.identifier("external"),
|
|
75535
|
-
b2.arrayExpression([b2.stringLiteral("node:async_hooks")])
|
|
75536
|
-
)
|
|
75537
|
-
])
|
|
75538
|
-
),
|
|
75539
|
-
// hooks: {
|
|
75540
|
-
// // Prevent the Pages preset from writing the _routes.json etc.
|
|
75541
|
-
// compiled() {},
|
|
75542
|
-
// },
|
|
75543
|
-
b2.objectProperty(
|
|
75544
|
-
b2.identifier("hooks"),
|
|
75545
|
-
b2.objectExpression([
|
|
75546
|
-
b2.objectMethod(
|
|
75547
|
-
"method",
|
|
75548
|
-
b2.identifier("compiled"),
|
|
75549
|
-
[],
|
|
75550
|
-
b2.blockStatement([]),
|
|
75551
|
-
false
|
|
75552
|
-
)
|
|
75553
|
-
])
|
|
75328
|
+
b2.identifier("compatibilityDate"),
|
|
75329
|
+
b2.stringLiteral(compatDate)
|
|
75554
75330
|
)
|
|
75555
75331
|
])
|
|
75556
75332
|
)
|
|
@@ -75590,7 +75366,7 @@ var import_node_os3 = require("node:os");
|
|
|
75590
75366
|
var recast6 = __toESM(require_main3());
|
|
75591
75367
|
var { npm: npm8 } = detectPackageManager();
|
|
75592
75368
|
var generate11 = async (ctx) => {
|
|
75593
|
-
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
75369
|
+
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
75594
75370
|
logRaw("");
|
|
75595
75371
|
};
|
|
75596
75372
|
var configure8 = async (ctx) => {
|
|
@@ -75655,8 +75431,8 @@ var updateTypeDefinitions = (ctx) => {
|
|
|
75655
75431
|
var config12 = {
|
|
75656
75432
|
configVersion: 1,
|
|
75657
75433
|
id: "svelte",
|
|
75658
|
-
frameworkCli: "
|
|
75659
|
-
displayName: "
|
|
75434
|
+
frameworkCli: "sv",
|
|
75435
|
+
displayName: "SvelteKit",
|
|
75660
75436
|
platform: "workers",
|
|
75661
75437
|
copyFiles: {
|
|
75662
75438
|
variants: {
|
|
@@ -75687,10 +75463,38 @@ var config12 = {
|
|
|
75687
75463
|
};
|
|
75688
75464
|
var c3_default14 = config12;
|
|
75689
75465
|
|
|
75466
|
+
// templates-experimental/vue/c3.ts
|
|
75467
|
+
var { npm: npm9 } = detectPackageManager();
|
|
75468
|
+
var generate12 = async (ctx) => {
|
|
75469
|
+
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
75470
|
+
};
|
|
75471
|
+
var config13 = {
|
|
75472
|
+
configVersion: 1,
|
|
75473
|
+
id: "vue",
|
|
75474
|
+
frameworkCli: "create-vue",
|
|
75475
|
+
platform: "workers",
|
|
75476
|
+
displayName: "Vue",
|
|
75477
|
+
copyFiles: {
|
|
75478
|
+
path: "./templates"
|
|
75479
|
+
},
|
|
75480
|
+
path: "templates-experimental/vue",
|
|
75481
|
+
generate: generate12,
|
|
75482
|
+
transformPackageJson: async () => ({
|
|
75483
|
+
scripts: {
|
|
75484
|
+
deploy: `${npm9} run build && wrangler deploy`,
|
|
75485
|
+
preview: `${npm9} run build && wrangler dev`
|
|
75486
|
+
}
|
|
75487
|
+
}),
|
|
75488
|
+
devScript: "dev",
|
|
75489
|
+
deployScript: "deploy",
|
|
75490
|
+
previewScript: "preview"
|
|
75491
|
+
};
|
|
75492
|
+
var c3_default15 = config13;
|
|
75493
|
+
|
|
75690
75494
|
// templates/analog/c3.ts
|
|
75691
75495
|
var recast7 = __toESM(require_main3());
|
|
75692
|
-
var { npm:
|
|
75693
|
-
var
|
|
75496
|
+
var { npm: npm10, name: pm2 } = detectPackageManager();
|
|
75497
|
+
var generate13 = async (ctx) => {
|
|
75694
75498
|
await runFrameworkGenerator(ctx, [
|
|
75695
75499
|
ctx.project.name,
|
|
75696
75500
|
"--template",
|
|
@@ -75708,7 +75512,7 @@ var configure9 = async (ctx) => {
|
|
|
75708
75512
|
await installPackages(packages, {
|
|
75709
75513
|
dev: true,
|
|
75710
75514
|
startText: `Installing ${packages.join(", ")}`,
|
|
75711
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75515
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
|
|
75712
75516
|
});
|
|
75713
75517
|
}
|
|
75714
75518
|
updateViteConfig(ctx);
|
|
@@ -75766,7 +75570,7 @@ var updateViteConfig = (ctx) => {
|
|
|
75766
75570
|
});
|
|
75767
75571
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
75768
75572
|
};
|
|
75769
|
-
var
|
|
75573
|
+
var config14 = {
|
|
75770
75574
|
configVersion: 1,
|
|
75771
75575
|
id: "analog",
|
|
75772
75576
|
frameworkCli: "create-analog",
|
|
@@ -75775,12 +75579,12 @@ var config13 = {
|
|
|
75775
75579
|
copyFiles: {
|
|
75776
75580
|
path: "./templates"
|
|
75777
75581
|
},
|
|
75778
|
-
generate:
|
|
75582
|
+
generate: generate13,
|
|
75779
75583
|
configure: configure9,
|
|
75780
75584
|
transformPackageJson: async () => ({
|
|
75781
75585
|
scripts: {
|
|
75782
|
-
preview: `${
|
|
75783
|
-
deploy: `${
|
|
75586
|
+
preview: `${npm10} run build && wrangler pages dev`,
|
|
75587
|
+
deploy: `${npm10} run build && wrangler pages deploy`,
|
|
75784
75588
|
"cf-typegen": `wrangler types`
|
|
75785
75589
|
}
|
|
75786
75590
|
}),
|
|
@@ -75788,13 +75592,17 @@ var config13 = {
|
|
|
75788
75592
|
deployScript: "deploy",
|
|
75789
75593
|
previewScript: "preview"
|
|
75790
75594
|
};
|
|
75791
|
-
var
|
|
75595
|
+
var c3_default16 = config14;
|
|
75792
75596
|
|
|
75793
75597
|
// templates/angular/c3.ts
|
|
75794
75598
|
var import_node_path4 = require("node:path");
|
|
75795
|
-
var { npm:
|
|
75796
|
-
var
|
|
75797
|
-
await runFrameworkGenerator(ctx, [
|
|
75599
|
+
var { npm: npm11 } = detectPackageManager();
|
|
75600
|
+
var generate14 = async (ctx) => {
|
|
75601
|
+
await runFrameworkGenerator(ctx, [
|
|
75602
|
+
ctx.project.name,
|
|
75603
|
+
"--ssr",
|
|
75604
|
+
"--server-routing"
|
|
75605
|
+
]);
|
|
75798
75606
|
logRaw("");
|
|
75799
75607
|
};
|
|
75800
75608
|
var configure10 = async (ctx) => {
|
|
@@ -75803,14 +75611,11 @@ var configure10 = async (ctx) => {
|
|
|
75803
75611
|
await installCFWorker2();
|
|
75804
75612
|
};
|
|
75805
75613
|
async function installCFWorker2() {
|
|
75806
|
-
await installPackages(
|
|
75807
|
-
|
|
75808
|
-
|
|
75809
|
-
|
|
75810
|
-
|
|
75811
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
|
|
75812
|
-
}
|
|
75813
|
-
);
|
|
75614
|
+
await installPackages(["xhr2"], {
|
|
75615
|
+
dev: true,
|
|
75616
|
+
startText: "Installing additional dependencies",
|
|
75617
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm11} install\``)}`
|
|
75618
|
+
});
|
|
75814
75619
|
}
|
|
75815
75620
|
async function updateAppCode2() {
|
|
75816
75621
|
const s = spinner();
|
|
@@ -75823,10 +75628,17 @@ async function updateAppCode2() {
|
|
|
75823
75628
|
);
|
|
75824
75629
|
writeFile2((0, import_node_path4.resolve)(appConfigPath), newAppConfig);
|
|
75825
75630
|
s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`);
|
|
75631
|
+
const appServerRoutesPath = "src/app/app.routes.server.ts";
|
|
75632
|
+
const appRoutes = readFile((0, import_node_path4.resolve)(appServerRoutesPath));
|
|
75633
|
+
const newAppRoutes = appRoutes.replace(
|
|
75634
|
+
"RenderMode.Prerender",
|
|
75635
|
+
"RenderMode.Server"
|
|
75636
|
+
);
|
|
75637
|
+
writeFile2((0, import_node_path4.resolve)(appServerRoutesPath), newAppRoutes);
|
|
75638
|
+
s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`);
|
|
75826
75639
|
s.start(`Updating package.json`);
|
|
75827
75640
|
const packageJsonPath = (0, import_node_path4.resolve)("package.json");
|
|
75828
75641
|
const packageManifest = readJSON(packageJsonPath);
|
|
75829
|
-
delete packageManifest["dependencies"]["@angular/ssr"];
|
|
75830
75642
|
delete packageManifest["dependencies"]["express"];
|
|
75831
75643
|
delete packageManifest["devDependencies"]["@types/express"];
|
|
75832
75644
|
writeFile2(packageJsonPath, JSON.stringify(packageManifest, null, 2));
|
|
@@ -75838,11 +75650,13 @@ function updateAngularJson2(ctx) {
|
|
|
75838
75650
|
const angularJson = readJSON((0, import_node_path4.resolve)("angular.json"));
|
|
75839
75651
|
const architectSection = angularJson.projects[ctx.project.name].architect;
|
|
75840
75652
|
architectSection.build.options.outputPath = "dist";
|
|
75653
|
+
architectSection.build.options.outputMode = "server";
|
|
75654
|
+
architectSection.build.options.ssr.experimentalPlatform = "neutral";
|
|
75841
75655
|
architectSection.build.options.assets.push("src/_routes.json");
|
|
75842
75656
|
writeFile2((0, import_node_path4.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
75843
75657
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
75844
75658
|
}
|
|
75845
|
-
var
|
|
75659
|
+
var config15 = {
|
|
75846
75660
|
configVersion: 1,
|
|
75847
75661
|
id: "angular",
|
|
75848
75662
|
frameworkCli: "@angular/create",
|
|
@@ -75853,23 +75667,24 @@ var config14 = {
|
|
|
75853
75667
|
},
|
|
75854
75668
|
devScript: "start",
|
|
75855
75669
|
deployScript: "deploy",
|
|
75856
|
-
|
|
75670
|
+
previewScript: "start",
|
|
75671
|
+
generate: generate14,
|
|
75857
75672
|
configure: configure10,
|
|
75858
75673
|
transformPackageJson: async () => ({
|
|
75859
75674
|
scripts: {
|
|
75860
|
-
start: `${
|
|
75861
|
-
build: `ng build && ${
|
|
75862
|
-
process: "node ./tools/copy-files.mjs
|
|
75863
|
-
deploy: `${
|
|
75675
|
+
start: `${npm11} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}`,
|
|
75676
|
+
build: `ng build && ${npm11} run process`,
|
|
75677
|
+
process: "node ./tools/copy-files.mjs",
|
|
75678
|
+
deploy: `${npm11} run build && wrangler pages deploy dist/cloudflare`
|
|
75864
75679
|
}
|
|
75865
75680
|
})
|
|
75866
75681
|
};
|
|
75867
|
-
var
|
|
75682
|
+
var c3_default17 = config15;
|
|
75868
75683
|
|
|
75869
75684
|
// templates/astro/c3.ts
|
|
75870
75685
|
var recast8 = __toESM(require_main3());
|
|
75871
75686
|
var { npx: npx3 } = detectPackageManager();
|
|
75872
|
-
var
|
|
75687
|
+
var generate15 = async (ctx) => {
|
|
75873
75688
|
await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
|
|
75874
75689
|
logRaw("");
|
|
75875
75690
|
};
|
|
@@ -75928,7 +75743,7 @@ var updateEnvDeclaration2 = (ctx) => {
|
|
|
75928
75743
|
}
|
|
75929
75744
|
});
|
|
75930
75745
|
};
|
|
75931
|
-
var
|
|
75746
|
+
var config16 = {
|
|
75932
75747
|
configVersion: 1,
|
|
75933
75748
|
id: "astro",
|
|
75934
75749
|
frameworkCli: "create-astro",
|
|
@@ -75940,7 +75755,7 @@ var config15 = {
|
|
|
75940
75755
|
devScript: "dev",
|
|
75941
75756
|
deployScript: "deploy",
|
|
75942
75757
|
previewScript: "preview",
|
|
75943
|
-
generate:
|
|
75758
|
+
generate: generate15,
|
|
75944
75759
|
configure: configure11,
|
|
75945
75760
|
transformPackageJson: async (pkgJson, ctx) => ({
|
|
75946
75761
|
scripts: {
|
|
@@ -75950,10 +75765,10 @@ var config15 = {
|
|
|
75950
75765
|
}
|
|
75951
75766
|
})
|
|
75952
75767
|
};
|
|
75953
|
-
var
|
|
75768
|
+
var c3_default18 = config16;
|
|
75954
75769
|
|
|
75955
75770
|
// templates/common/c3.ts
|
|
75956
|
-
var
|
|
75771
|
+
var c3_default19 = {
|
|
75957
75772
|
configVersion: 1,
|
|
75958
75773
|
id: "common",
|
|
75959
75774
|
displayName: "Example router & proxy Worker",
|
|
@@ -75973,31 +75788,31 @@ var c3_default18 = {
|
|
|
75973
75788
|
};
|
|
75974
75789
|
|
|
75975
75790
|
// templates/docusaurus/c3.ts
|
|
75976
|
-
var { npm:
|
|
75977
|
-
var
|
|
75791
|
+
var { npm: npm12 } = detectPackageManager();
|
|
75792
|
+
var generate16 = async (ctx) => {
|
|
75978
75793
|
await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
|
|
75979
75794
|
};
|
|
75980
|
-
var
|
|
75795
|
+
var config17 = {
|
|
75981
75796
|
configVersion: 1,
|
|
75982
75797
|
id: "docusaurus",
|
|
75983
75798
|
frameworkCli: "create-docusaurus",
|
|
75984
75799
|
platform: "pages",
|
|
75985
75800
|
displayName: "Docusaurus",
|
|
75986
|
-
generate:
|
|
75801
|
+
generate: generate16,
|
|
75987
75802
|
transformPackageJson: async () => ({
|
|
75988
75803
|
scripts: {
|
|
75989
|
-
preview: `${
|
|
75990
|
-
deploy: `${
|
|
75804
|
+
preview: `${npm12} run build && wrangler pages dev ./build`,
|
|
75805
|
+
deploy: `${npm12} run build && wrangler pages deploy ./build`
|
|
75991
75806
|
}
|
|
75992
75807
|
}),
|
|
75993
75808
|
devScript: "preview",
|
|
75994
75809
|
deployScript: "deploy"
|
|
75995
75810
|
};
|
|
75996
|
-
var
|
|
75811
|
+
var c3_default20 = config17;
|
|
75997
75812
|
|
|
75998
75813
|
// templates/gatsby/c3.ts
|
|
75999
|
-
var { npm:
|
|
76000
|
-
var
|
|
75814
|
+
var { npm: npm13 } = detectPackageManager();
|
|
75815
|
+
var generate17 = async (ctx) => {
|
|
76001
75816
|
const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
|
|
76002
75817
|
const useTemplate = await inputPrompt({
|
|
76003
75818
|
type: "confirm",
|
|
@@ -76016,27 +75831,27 @@ var generate16 = async (ctx) => {
|
|
|
76016
75831
|
}
|
|
76017
75832
|
await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
|
|
76018
75833
|
};
|
|
76019
|
-
var
|
|
75834
|
+
var config18 = {
|
|
76020
75835
|
configVersion: 1,
|
|
76021
75836
|
id: "gatsby",
|
|
76022
75837
|
frameworkCli: "gatsby",
|
|
76023
75838
|
platform: "pages",
|
|
76024
75839
|
displayName: "Gatsby",
|
|
76025
|
-
generate:
|
|
75840
|
+
generate: generate17,
|
|
76026
75841
|
transformPackageJson: async () => ({
|
|
76027
75842
|
scripts: {
|
|
76028
|
-
deploy: `${
|
|
76029
|
-
preview: `${
|
|
75843
|
+
deploy: `${npm13} run build && wrangler pages deploy ./public`,
|
|
75844
|
+
preview: `${npm13} run build && wrangler pages dev ./public`
|
|
76030
75845
|
}
|
|
76031
75846
|
}),
|
|
76032
75847
|
devScript: "develop",
|
|
76033
75848
|
deployScript: "deploy",
|
|
76034
75849
|
previewScript: "preview"
|
|
76035
75850
|
};
|
|
76036
|
-
var
|
|
75851
|
+
var c3_default21 = config18;
|
|
76037
75852
|
|
|
76038
75853
|
// templates/hello-world-durable-object/c3.ts
|
|
76039
|
-
var
|
|
75854
|
+
var c3_default22 = {
|
|
76040
75855
|
configVersion: 1,
|
|
76041
75856
|
id: "hello-world-durable-object",
|
|
76042
75857
|
displayName: "Hello World Worker Using Durable Objects",
|
|
@@ -76055,7 +75870,7 @@ var c3_default21 = {
|
|
|
76055
75870
|
};
|
|
76056
75871
|
|
|
76057
75872
|
// templates/hello-world/c3.ts
|
|
76058
|
-
var
|
|
75873
|
+
var c3_default23 = {
|
|
76059
75874
|
configVersion: 1,
|
|
76060
75875
|
id: "hello-world",
|
|
76061
75876
|
displayName: "Hello World Worker",
|
|
@@ -76077,7 +75892,7 @@ var c3_default22 = {
|
|
|
76077
75892
|
};
|
|
76078
75893
|
|
|
76079
75894
|
// templates/hono/c3.ts
|
|
76080
|
-
var
|
|
75895
|
+
var generate18 = async (ctx) => {
|
|
76081
75896
|
const { name: pm4 } = detectPackageManager();
|
|
76082
75897
|
await runFrameworkGenerator(ctx, [
|
|
76083
75898
|
ctx.project.name,
|
|
@@ -76104,7 +75919,7 @@ var configure12 = async (ctx) => {
|
|
|
76104
75919
|
});
|
|
76105
75920
|
s.stop(`${brandColor("updated")} \`${dim(indexFile)}\``);
|
|
76106
75921
|
};
|
|
76107
|
-
var
|
|
75922
|
+
var config19 = {
|
|
76108
75923
|
configVersion: 1,
|
|
76109
75924
|
id: "hono",
|
|
76110
75925
|
frameworkCli: "create-hono",
|
|
@@ -76113,7 +75928,7 @@ var config18 = {
|
|
|
76113
75928
|
path: "./templates"
|
|
76114
75929
|
},
|
|
76115
75930
|
platform: "workers",
|
|
76116
|
-
generate:
|
|
75931
|
+
generate: generate18,
|
|
76117
75932
|
configure: configure12,
|
|
76118
75933
|
transformPackageJson: async () => ({
|
|
76119
75934
|
scripts: {
|
|
@@ -76125,12 +75940,12 @@ var config18 = {
|
|
|
76125
75940
|
devScript: "dev",
|
|
76126
75941
|
deployScript: "deploy"
|
|
76127
75942
|
};
|
|
76128
|
-
var
|
|
75943
|
+
var c3_default24 = config19;
|
|
76129
75944
|
|
|
76130
75945
|
// templates/next/c3.ts
|
|
76131
75946
|
var import_path10 = require("path");
|
|
76132
|
-
var { npm:
|
|
76133
|
-
var
|
|
75947
|
+
var { npm: npm14, npx: npx4 } = detectPackageManager();
|
|
75948
|
+
var generate19 = async (ctx) => {
|
|
76134
75949
|
const projectName = ctx.project.name;
|
|
76135
75950
|
await runFrameworkGenerator(ctx, [projectName]);
|
|
76136
75951
|
const wranglerToml = readFile((0, import_path10.join)(getTemplatePath(ctx), "wrangler.toml"));
|
|
@@ -76238,13 +76053,13 @@ var addDevDependencies = async (installEslintPlugin) => {
|
|
|
76238
76053
|
doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
|
|
76239
76054
|
});
|
|
76240
76055
|
};
|
|
76241
|
-
var
|
|
76056
|
+
var c3_default25 = {
|
|
76242
76057
|
configVersion: 1,
|
|
76243
76058
|
id: "next",
|
|
76244
76059
|
frameworkCli: "create-next-app",
|
|
76245
76060
|
platform: "pages",
|
|
76246
76061
|
displayName: "Next",
|
|
76247
|
-
generate:
|
|
76062
|
+
generate: generate19,
|
|
76248
76063
|
configure: configure13,
|
|
76249
76064
|
copyFiles: {
|
|
76250
76065
|
async selectVariant(ctx) {
|
|
@@ -76276,12 +76091,12 @@ var c3_default24 = {
|
|
|
76276
76091
|
}
|
|
76277
76092
|
},
|
|
76278
76093
|
transformPackageJson: async (_3, ctx) => {
|
|
76279
|
-
const isNpm =
|
|
76280
|
-
const isBun =
|
|
76094
|
+
const isNpm = npm14 === "npm";
|
|
76095
|
+
const isBun = npm14 === "bun";
|
|
76281
76096
|
const isNpmOrBun = isNpm || isBun;
|
|
76282
76097
|
const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
|
|
76283
76098
|
const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
|
|
76284
|
-
const pmCommand = isNpmOrBun ? npx4 :
|
|
76099
|
+
const pmCommand = isNpmOrBun ? npx4 : npm14;
|
|
76285
76100
|
const pagesBuildRunCommand = `${isNpm ? "npm run" : isBun ? "bun" : pmCommand} pages:build`;
|
|
76286
76101
|
return {
|
|
76287
76102
|
scripts: {
|
|
@@ -76302,14 +76117,14 @@ var c3_default24 = {
|
|
|
76302
76117
|
|
|
76303
76118
|
// templates/nuxt/c3.ts
|
|
76304
76119
|
var recast9 = __toESM(require_main3());
|
|
76305
|
-
var { npm:
|
|
76306
|
-
var
|
|
76120
|
+
var { npm: npm15, name: pm3 } = detectPackageManager();
|
|
76121
|
+
var generate20 = async (ctx) => {
|
|
76307
76122
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
76308
76123
|
await runFrameworkGenerator(ctx, [
|
|
76309
76124
|
"init",
|
|
76310
76125
|
ctx.project.name,
|
|
76311
76126
|
"--packageManager",
|
|
76312
|
-
|
|
76127
|
+
npm15,
|
|
76313
76128
|
gitFlag
|
|
76314
76129
|
]);
|
|
76315
76130
|
writeFile2("./.node-version", "17");
|
|
@@ -76323,7 +76138,7 @@ var configure14 = async (ctx) => {
|
|
|
76323
76138
|
await installPackages(packages, {
|
|
76324
76139
|
dev: true,
|
|
76325
76140
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
76326
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
76141
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm15} install\``)}`
|
|
76327
76142
|
});
|
|
76328
76143
|
updateNuxtConfig2();
|
|
76329
76144
|
updateEnvTypes3(ctx);
|
|
@@ -76374,7 +76189,7 @@ var updateNuxtConfig2 = () => {
|
|
|
76374
76189
|
});
|
|
76375
76190
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76376
76191
|
};
|
|
76377
|
-
var
|
|
76192
|
+
var config20 = {
|
|
76378
76193
|
configVersion: 1,
|
|
76379
76194
|
id: "nuxt",
|
|
76380
76195
|
frameworkCli: "nuxi",
|
|
@@ -76383,12 +76198,12 @@ var config19 = {
|
|
|
76383
76198
|
copyFiles: {
|
|
76384
76199
|
path: "./templates"
|
|
76385
76200
|
},
|
|
76386
|
-
generate:
|
|
76201
|
+
generate: generate20,
|
|
76387
76202
|
configure: configure14,
|
|
76388
76203
|
transformPackageJson: async () => ({
|
|
76389
76204
|
scripts: {
|
|
76390
|
-
deploy: `${
|
|
76391
|
-
preview: `${
|
|
76205
|
+
deploy: `${npm15} run build && wrangler pages deploy`,
|
|
76206
|
+
preview: `${npm15} run build && wrangler pages dev`,
|
|
76392
76207
|
"cf-typegen": `wrangler types`
|
|
76393
76208
|
}
|
|
76394
76209
|
}),
|
|
@@ -76396,10 +76211,10 @@ var config19 = {
|
|
|
76396
76211
|
deployScript: "deploy",
|
|
76397
76212
|
previewScript: "preview"
|
|
76398
76213
|
};
|
|
76399
|
-
var
|
|
76214
|
+
var c3_default26 = config20;
|
|
76400
76215
|
|
|
76401
76216
|
// templates/openapi/c3.ts
|
|
76402
|
-
var
|
|
76217
|
+
var c3_default27 = {
|
|
76403
76218
|
configVersion: 1,
|
|
76404
76219
|
id: "openapi",
|
|
76405
76220
|
displayName: "API starter (OpenAPI compliant)",
|
|
@@ -76514,7 +76329,6 @@ var isLoggedIn = async () => {
|
|
|
76514
76329
|
// templates/pre-existing/c3.ts
|
|
76515
76330
|
async function copyExistingWorkerFiles(ctx) {
|
|
76516
76331
|
const { dlx } = detectPackageManager();
|
|
76517
|
-
await chooseAccount(ctx);
|
|
76518
76332
|
if (ctx.args.existingScript === void 0) {
|
|
76519
76333
|
ctx.args.existingScript = await processArgument(
|
|
76520
76334
|
ctx.args,
|
|
@@ -76559,7 +76373,7 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
76559
76373
|
(0, import_path11.join)(ctx.project.path, "wrangler.toml")
|
|
76560
76374
|
);
|
|
76561
76375
|
}
|
|
76562
|
-
var
|
|
76376
|
+
var c3_default28 = {
|
|
76563
76377
|
configVersion: 1,
|
|
76564
76378
|
id: "pre-existing",
|
|
76565
76379
|
displayName: "Pre-existing Worker (from Dashboard)",
|
|
@@ -76568,14 +76382,26 @@ var c3_default27 = {
|
|
|
76568
76382
|
copyFiles: {
|
|
76569
76383
|
path: "./js"
|
|
76570
76384
|
},
|
|
76571
|
-
configure:
|
|
76572
|
-
|
|
76573
|
-
|
|
76574
|
-
|
|
76385
|
+
configure: buildConfigure({
|
|
76386
|
+
login: wranglerLogin,
|
|
76387
|
+
chooseAccount,
|
|
76388
|
+
copyFiles: copyExistingWorkerFiles
|
|
76389
|
+
})
|
|
76575
76390
|
};
|
|
76391
|
+
function buildConfigure(params) {
|
|
76392
|
+
return async function configure20(ctx) {
|
|
76393
|
+
const loginSuccess = await params.login(ctx);
|
|
76394
|
+
if (!loginSuccess) {
|
|
76395
|
+
throw new Error("Failed to login to Cloudflare");
|
|
76396
|
+
}
|
|
76397
|
+
await params.chooseAccount(ctx);
|
|
76398
|
+
await params.copyFiles(ctx);
|
|
76399
|
+
ctx.args.deploy = false;
|
|
76400
|
+
};
|
|
76401
|
+
}
|
|
76576
76402
|
|
|
76577
76403
|
// templates/queues/c3.ts
|
|
76578
|
-
var
|
|
76404
|
+
var c3_default29 = {
|
|
76579
76405
|
configVersion: 1,
|
|
76580
76406
|
id: "queues",
|
|
76581
76407
|
displayName: "Queue consumer & producer Worker",
|
|
@@ -76605,8 +76431,8 @@ var c3_default28 = {
|
|
|
76605
76431
|
|
|
76606
76432
|
// templates/qwik/c3.ts
|
|
76607
76433
|
var recast10 = __toESM(require_main3());
|
|
76608
|
-
var { npm:
|
|
76609
|
-
var
|
|
76434
|
+
var { npm: npm16, npx: npx5 } = detectPackageManager();
|
|
76435
|
+
var generate21 = async (ctx) => {
|
|
76610
76436
|
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
76611
76437
|
};
|
|
76612
76438
|
var configure15 = async (ctx) => {
|
|
@@ -76686,7 +76512,7 @@ var populateCloudflareEnv2 = () => {
|
|
|
76686
76512
|
});
|
|
76687
76513
|
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
76688
76514
|
};
|
|
76689
|
-
var
|
|
76515
|
+
var config21 = {
|
|
76690
76516
|
configVersion: 1,
|
|
76691
76517
|
id: "qwik",
|
|
76692
76518
|
frameworkCli: "create-qwik",
|
|
@@ -76695,12 +76521,12 @@ var config20 = {
|
|
|
76695
76521
|
copyFiles: {
|
|
76696
76522
|
path: "./templates"
|
|
76697
76523
|
},
|
|
76698
|
-
generate:
|
|
76524
|
+
generate: generate21,
|
|
76699
76525
|
configure: configure15,
|
|
76700
76526
|
transformPackageJson: async () => ({
|
|
76701
76527
|
scripts: {
|
|
76702
|
-
deploy: `${
|
|
76703
|
-
preview: `${
|
|
76528
|
+
deploy: `${npm16} run build && wrangler pages deploy`,
|
|
76529
|
+
preview: `${npm16} run build && wrangler pages dev`,
|
|
76704
76530
|
"cf-typegen": `wrangler types`
|
|
76705
76531
|
}
|
|
76706
76532
|
}),
|
|
@@ -76708,11 +76534,11 @@ var config20 = {
|
|
|
76708
76534
|
deployScript: "deploy",
|
|
76709
76535
|
previewScript: "preview"
|
|
76710
76536
|
};
|
|
76711
|
-
var
|
|
76537
|
+
var c3_default30 = config21;
|
|
76712
76538
|
|
|
76713
76539
|
// templates/react/c3.ts
|
|
76714
|
-
var { npm:
|
|
76715
|
-
var
|
|
76540
|
+
var { npm: npm17 } = detectPackageManager();
|
|
76541
|
+
var generate22 = async (ctx) => {
|
|
76716
76542
|
const variant = await inputPrompt({
|
|
76717
76543
|
type: "select",
|
|
76718
76544
|
question: "Select a variant:",
|
|
@@ -76741,29 +76567,29 @@ var variantsOptions = [
|
|
|
76741
76567
|
label: "JavaScript + SWC"
|
|
76742
76568
|
}
|
|
76743
76569
|
];
|
|
76744
|
-
var
|
|
76570
|
+
var config22 = {
|
|
76745
76571
|
configVersion: 1,
|
|
76746
76572
|
id: "react",
|
|
76747
76573
|
// React's documentation now recommends using create-vite.
|
|
76748
76574
|
frameworkCli: "create-vite",
|
|
76749
76575
|
displayName: "React",
|
|
76750
76576
|
platform: "pages",
|
|
76751
|
-
generate:
|
|
76577
|
+
generate: generate22,
|
|
76752
76578
|
transformPackageJson: async () => ({
|
|
76753
76579
|
scripts: {
|
|
76754
|
-
deploy: `${
|
|
76755
|
-
preview: `${
|
|
76580
|
+
deploy: `${npm17} run build && wrangler pages deploy ./dist`,
|
|
76581
|
+
preview: `${npm17} run build && wrangler pages dev ./dist`
|
|
76756
76582
|
}
|
|
76757
76583
|
}),
|
|
76758
76584
|
devScript: "dev",
|
|
76759
76585
|
deployScript: "deploy",
|
|
76760
76586
|
previewScript: "preview"
|
|
76761
76587
|
};
|
|
76762
|
-
var
|
|
76588
|
+
var c3_default31 = config22;
|
|
76763
76589
|
|
|
76764
76590
|
// templates/remix/c3.ts
|
|
76765
|
-
var { npm:
|
|
76766
|
-
var
|
|
76591
|
+
var { npm: npm18 } = detectPackageManager();
|
|
76592
|
+
var generate23 = async (ctx) => {
|
|
76767
76593
|
await runFrameworkGenerator(ctx, [
|
|
76768
76594
|
ctx.project.name,
|
|
76769
76595
|
"--template",
|
|
@@ -76786,7 +76612,7 @@ var configure16 = async () => {
|
|
|
76786
76612
|
});
|
|
76787
76613
|
s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
|
|
76788
76614
|
};
|
|
76789
|
-
var
|
|
76615
|
+
var config23 = {
|
|
76790
76616
|
configVersion: 1,
|
|
76791
76617
|
id: "remix",
|
|
76792
76618
|
frameworkCli: "create-remix",
|
|
@@ -76795,12 +76621,12 @@ var config22 = {
|
|
|
76795
76621
|
copyFiles: {
|
|
76796
76622
|
path: "./templates"
|
|
76797
76623
|
},
|
|
76798
|
-
generate:
|
|
76624
|
+
generate: generate23,
|
|
76799
76625
|
configure: configure16,
|
|
76800
76626
|
transformPackageJson: async () => ({
|
|
76801
76627
|
scripts: {
|
|
76802
|
-
deploy: `${
|
|
76803
|
-
preview: `${
|
|
76628
|
+
deploy: `${npm18} run build && wrangler pages deploy`,
|
|
76629
|
+
preview: `${npm18} run build && wrangler pages dev`,
|
|
76804
76630
|
"cf-typegen": `wrangler types`
|
|
76805
76631
|
}
|
|
76806
76632
|
}),
|
|
@@ -76808,10 +76634,10 @@ var config22 = {
|
|
|
76808
76634
|
deployScript: "deploy",
|
|
76809
76635
|
previewScript: "preview"
|
|
76810
76636
|
};
|
|
76811
|
-
var
|
|
76637
|
+
var c3_default32 = config23;
|
|
76812
76638
|
|
|
76813
76639
|
// templates/scheduled/c3.ts
|
|
76814
|
-
var
|
|
76640
|
+
var c3_default33 = {
|
|
76815
76641
|
configVersion: 1,
|
|
76816
76642
|
id: "scheduled",
|
|
76817
76643
|
displayName: "Scheduled Worker (Cron Trigger)",
|
|
@@ -76831,8 +76657,8 @@ var c3_default32 = {
|
|
|
76831
76657
|
|
|
76832
76658
|
// templates/solid/c3.ts
|
|
76833
76659
|
var recast11 = __toESM(require_main3());
|
|
76834
|
-
var { npm:
|
|
76835
|
-
var
|
|
76660
|
+
var { npm: npm19 } = detectPackageManager();
|
|
76661
|
+
var generate24 = async (ctx) => {
|
|
76836
76662
|
await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
|
|
76837
76663
|
logRaw("");
|
|
76838
76664
|
};
|
|
@@ -76874,7 +76700,7 @@ var configure17 = async (ctx) => {
|
|
|
76874
76700
|
}
|
|
76875
76701
|
});
|
|
76876
76702
|
};
|
|
76877
|
-
var
|
|
76703
|
+
var config24 = {
|
|
76878
76704
|
configVersion: 1,
|
|
76879
76705
|
id: "solid",
|
|
76880
76706
|
frameworkCli: "create-solid",
|
|
@@ -76883,12 +76709,12 @@ var config23 = {
|
|
|
76883
76709
|
copyFiles: {
|
|
76884
76710
|
path: "./templates"
|
|
76885
76711
|
},
|
|
76886
|
-
generate:
|
|
76712
|
+
generate: generate24,
|
|
76887
76713
|
configure: configure17,
|
|
76888
76714
|
transformPackageJson: async () => ({
|
|
76889
76715
|
scripts: {
|
|
76890
|
-
preview: `${
|
|
76891
|
-
deploy: `${
|
|
76716
|
+
preview: `${npm19} run build && npx wrangler pages dev`,
|
|
76717
|
+
deploy: `${npm19} run build && wrangler pages deploy`
|
|
76892
76718
|
}
|
|
76893
76719
|
}),
|
|
76894
76720
|
compatibilityFlags: ["nodejs_compat"],
|
|
@@ -76896,14 +76722,15 @@ var config23 = {
|
|
|
76896
76722
|
deployScript: "deploy",
|
|
76897
76723
|
previewScript: "preview"
|
|
76898
76724
|
};
|
|
76899
|
-
var
|
|
76725
|
+
var c3_default34 = config24;
|
|
76900
76726
|
|
|
76901
76727
|
// templates/svelte/c3.ts
|
|
76728
|
+
var import_node_fs3 = require("node:fs");
|
|
76902
76729
|
var import_node_os4 = require("node:os");
|
|
76903
76730
|
var recast12 = __toESM(require_main3());
|
|
76904
|
-
var { npm:
|
|
76905
|
-
var
|
|
76906
|
-
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
76731
|
+
var { npm: npm20 } = detectPackageManager();
|
|
76732
|
+
var generate25 = async (ctx) => {
|
|
76733
|
+
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
76907
76734
|
logRaw("");
|
|
76908
76735
|
};
|
|
76909
76736
|
var configure18 = async (ctx) => {
|
|
@@ -76914,6 +76741,7 @@ var configure18 = async (ctx) => {
|
|
|
76914
76741
|
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
76915
76742
|
});
|
|
76916
76743
|
updateSvelteConfig2();
|
|
76744
|
+
updatePlaywrightConfig(usesTypescript(ctx));
|
|
76917
76745
|
updateTypeDefinitions2(ctx);
|
|
76918
76746
|
};
|
|
76919
76747
|
var updateSvelteConfig2 = () => {
|
|
@@ -76928,6 +76756,28 @@ var updateSvelteConfig2 = () => {
|
|
|
76928
76756
|
}
|
|
76929
76757
|
});
|
|
76930
76758
|
};
|
|
76759
|
+
var updatePlaywrightConfig = (shouldUseTypescript) => {
|
|
76760
|
+
const filePath = `playwright.config.${shouldUseTypescript ? "ts" : "js"}`;
|
|
76761
|
+
if (!(0, import_node_fs3.existsSync)(filePath)) {
|
|
76762
|
+
return;
|
|
76763
|
+
}
|
|
76764
|
+
updateStatus(`Changing webServer port in ${blue(filePath)}`);
|
|
76765
|
+
transformFile(filePath, {
|
|
76766
|
+
visitObjectExpression: function(n2) {
|
|
76767
|
+
const portProp = n2.node.properties.find((prop) => {
|
|
76768
|
+
if (!("key" in prop) || !("name" in prop.key)) {
|
|
76769
|
+
return false;
|
|
76770
|
+
}
|
|
76771
|
+
return prop.key.name === "port";
|
|
76772
|
+
});
|
|
76773
|
+
if (!portProp || !("value" in portProp) || !("value" in portProp.value)) {
|
|
76774
|
+
return this.traverse(n2);
|
|
76775
|
+
}
|
|
76776
|
+
portProp.value.value = 8788;
|
|
76777
|
+
return false;
|
|
76778
|
+
}
|
|
76779
|
+
});
|
|
76780
|
+
};
|
|
76931
76781
|
var updateTypeDefinitions2 = (ctx) => {
|
|
76932
76782
|
if (!usesTypescript(ctx)) {
|
|
76933
76783
|
return;
|
|
@@ -76965,11 +76815,11 @@ var updateTypeDefinitions2 = (ctx) => {
|
|
|
76965
76815
|
}
|
|
76966
76816
|
});
|
|
76967
76817
|
};
|
|
76968
|
-
var
|
|
76818
|
+
var config25 = {
|
|
76969
76819
|
configVersion: 1,
|
|
76970
76820
|
id: "svelte",
|
|
76971
|
-
frameworkCli: "
|
|
76972
|
-
displayName: "
|
|
76821
|
+
frameworkCli: "sv",
|
|
76822
|
+
displayName: "SvelteKit",
|
|
76973
76823
|
platform: "pages",
|
|
76974
76824
|
copyFiles: {
|
|
76975
76825
|
variants: {
|
|
@@ -76977,12 +76827,12 @@ var config24 = {
|
|
|
76977
76827
|
ts: { path: "./ts" }
|
|
76978
76828
|
}
|
|
76979
76829
|
},
|
|
76980
|
-
generate:
|
|
76830
|
+
generate: generate25,
|
|
76981
76831
|
configure: configure18,
|
|
76982
76832
|
transformPackageJson: async (original, ctx) => {
|
|
76983
76833
|
let scripts = {
|
|
76984
|
-
preview: `${
|
|
76985
|
-
deploy: `${
|
|
76834
|
+
preview: `${npm20} run build && wrangler pages dev`,
|
|
76835
|
+
deploy: `${npm20} run build && wrangler pages deploy`
|
|
76986
76836
|
};
|
|
76987
76837
|
if (usesTypescript(ctx)) {
|
|
76988
76838
|
const mv = (0, import_node_os4.platform)() === "win32" ? "move" : "mv";
|
|
@@ -76997,31 +76847,214 @@ var config24 = {
|
|
|
76997
76847
|
deployScript: "deploy",
|
|
76998
76848
|
previewScript: "preview"
|
|
76999
76849
|
};
|
|
77000
|
-
var
|
|
76850
|
+
var c3_default35 = config25;
|
|
77001
76851
|
|
|
77002
76852
|
// templates/vue/c3.ts
|
|
77003
|
-
var { npm:
|
|
77004
|
-
var
|
|
76853
|
+
var { npm: npm21 } = detectPackageManager();
|
|
76854
|
+
var generate26 = async (ctx) => {
|
|
77005
76855
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
77006
76856
|
};
|
|
77007
|
-
var
|
|
76857
|
+
var config26 = {
|
|
77008
76858
|
configVersion: 1,
|
|
77009
76859
|
id: "vue",
|
|
77010
76860
|
frameworkCli: "create-vue",
|
|
77011
76861
|
displayName: "Vue",
|
|
77012
76862
|
platform: "pages",
|
|
77013
|
-
generate:
|
|
76863
|
+
generate: generate26,
|
|
77014
76864
|
transformPackageJson: async () => ({
|
|
77015
76865
|
scripts: {
|
|
77016
|
-
deploy: `${
|
|
77017
|
-
preview: `${
|
|
76866
|
+
deploy: `${npm21} run build && wrangler pages deploy ./dist`,
|
|
76867
|
+
preview: `${npm21} run build && wrangler pages dev ./dist`
|
|
77018
76868
|
}
|
|
77019
76869
|
}),
|
|
77020
76870
|
devScript: "dev",
|
|
77021
76871
|
deployScript: "deploy",
|
|
77022
76872
|
previewScript: "preview"
|
|
77023
76873
|
};
|
|
77024
|
-
var
|
|
76874
|
+
var c3_default36 = config26;
|
|
76875
|
+
|
|
76876
|
+
// ../wrangler/package.json
|
|
76877
|
+
var version2 = "0.0.0-8ca9533f8";
|
|
76878
|
+
|
|
76879
|
+
// src/git.ts
|
|
76880
|
+
var offerGit = async (ctx) => {
|
|
76881
|
+
const gitInstalled = await isGitInstalled();
|
|
76882
|
+
if (!gitInstalled) {
|
|
76883
|
+
if (ctx.args.git) {
|
|
76884
|
+
updateStatus(
|
|
76885
|
+
"Couldn't find `git` installed on your machine. Continuing without git."
|
|
76886
|
+
);
|
|
76887
|
+
}
|
|
76888
|
+
ctx.args.git = false;
|
|
76889
|
+
return;
|
|
76890
|
+
}
|
|
76891
|
+
const insideGitRepo = await isInsideGitRepo(ctx.project.path);
|
|
76892
|
+
if (insideGitRepo) {
|
|
76893
|
+
ctx.args.git = true;
|
|
76894
|
+
return;
|
|
76895
|
+
}
|
|
76896
|
+
ctx.args.git = await processArgument(ctx.args, "git", {
|
|
76897
|
+
type: "confirm",
|
|
76898
|
+
question: "Do you want to use git for version control?",
|
|
76899
|
+
label: "git",
|
|
76900
|
+
defaultValue: C3_DEFAULTS.git
|
|
76901
|
+
});
|
|
76902
|
+
if (!ctx.args.git) {
|
|
76903
|
+
return;
|
|
76904
|
+
}
|
|
76905
|
+
const gitConfigured = await isGitConfigured();
|
|
76906
|
+
if (!gitConfigured) {
|
|
76907
|
+
updateStatus(
|
|
76908
|
+
"Must configure `user.name` and user.email` to use git. Continuing without git."
|
|
76909
|
+
);
|
|
76910
|
+
ctx.args.git = false;
|
|
76911
|
+
return;
|
|
76912
|
+
}
|
|
76913
|
+
await initializeGit(ctx.project.path);
|
|
76914
|
+
};
|
|
76915
|
+
var gitCommit = async (ctx) => {
|
|
76916
|
+
const commitMessage = await createCommitMessage(ctx);
|
|
76917
|
+
if (!ctx.args.git) {
|
|
76918
|
+
return;
|
|
76919
|
+
}
|
|
76920
|
+
if (ctx.gitRepoAlreadyExisted) {
|
|
76921
|
+
return;
|
|
76922
|
+
}
|
|
76923
|
+
const gitInstalled = await isGitInstalled();
|
|
76924
|
+
const gitInitialized = await isInsideGitRepo(ctx.project.path);
|
|
76925
|
+
if (!gitInstalled || !gitInitialized) {
|
|
76926
|
+
return;
|
|
76927
|
+
}
|
|
76928
|
+
const s = spinner();
|
|
76929
|
+
s.start("Committing new files");
|
|
76930
|
+
await runCommand(["git", "add", "."], {
|
|
76931
|
+
silent: true,
|
|
76932
|
+
cwd: ctx.project.path
|
|
76933
|
+
});
|
|
76934
|
+
await runCommand(["git", "commit", "-m", commitMessage], {
|
|
76935
|
+
silent: true,
|
|
76936
|
+
cwd: ctx.project.path
|
|
76937
|
+
});
|
|
76938
|
+
s.stop(`${brandColor("git")} ${dim(`commit`)}`);
|
|
76939
|
+
};
|
|
76940
|
+
var createCommitMessage = async (ctx) => {
|
|
76941
|
+
const framework = ctx.template.frameworkCli;
|
|
76942
|
+
const header = framework ? "Initialize web application via create-cloudflare CLI" : "Initial commit (by create-cloudflare CLI)";
|
|
76943
|
+
const packageManager = detectPackageManager();
|
|
76944
|
+
const gitVersion = await getGitVersion();
|
|
76945
|
+
const insideRepo = await isInsideGitRepo(ctx.project.path);
|
|
76946
|
+
const details = [
|
|
76947
|
+
{ key: "C3", value: `create-cloudflare@${version}` },
|
|
76948
|
+
{ key: "project name", value: ctx.project.name },
|
|
76949
|
+
...framework ? [{ key: "framework", value: ctx.template.id }] : [],
|
|
76950
|
+
...framework ? [{ key: "framework cli", value: getFrameworkCli(ctx) }] : [],
|
|
76951
|
+
{
|
|
76952
|
+
key: "package manager",
|
|
76953
|
+
value: `${packageManager.name}@${packageManager.version}`
|
|
76954
|
+
},
|
|
76955
|
+
{
|
|
76956
|
+
key: "wrangler",
|
|
76957
|
+
value: `wrangler@${version2}`
|
|
76958
|
+
},
|
|
76959
|
+
{
|
|
76960
|
+
key: "git",
|
|
76961
|
+
value: insideRepo ? gitVersion : "N/A"
|
|
76962
|
+
}
|
|
76963
|
+
];
|
|
76964
|
+
const body = `Details:
|
|
76965
|
+
${details.map(({ key, value }) => ` ${key} = ${value}`).join("\n")}
|
|
76966
|
+
`;
|
|
76967
|
+
const commitMessage = `${header}
|
|
76968
|
+
|
|
76969
|
+
${body}
|
|
76970
|
+
`;
|
|
76971
|
+
ctx.commitMessage = commitMessage;
|
|
76972
|
+
return commitMessage;
|
|
76973
|
+
};
|
|
76974
|
+
async function getGitVersion() {
|
|
76975
|
+
try {
|
|
76976
|
+
const rawGitVersion = await runCommand(["git", "--version"], {
|
|
76977
|
+
useSpinner: false,
|
|
76978
|
+
silent: true
|
|
76979
|
+
});
|
|
76980
|
+
const gitVersion = rawGitVersion.replace(/^git\s+version\s+/, "");
|
|
76981
|
+
return gitVersion;
|
|
76982
|
+
} catch {
|
|
76983
|
+
return null;
|
|
76984
|
+
}
|
|
76985
|
+
}
|
|
76986
|
+
async function isGitInstalled() {
|
|
76987
|
+
return await getGitVersion() !== null;
|
|
76988
|
+
}
|
|
76989
|
+
async function isGitConfigured() {
|
|
76990
|
+
try {
|
|
76991
|
+
const userName = await runCommand(["git", "config", "user.name"], {
|
|
76992
|
+
useSpinner: false,
|
|
76993
|
+
silent: true
|
|
76994
|
+
});
|
|
76995
|
+
if (!userName) {
|
|
76996
|
+
return false;
|
|
76997
|
+
}
|
|
76998
|
+
const email = await runCommand(["git", "config", "user.email"], {
|
|
76999
|
+
useSpinner: false,
|
|
77000
|
+
silent: true
|
|
77001
|
+
});
|
|
77002
|
+
if (!email) {
|
|
77003
|
+
return false;
|
|
77004
|
+
}
|
|
77005
|
+
return true;
|
|
77006
|
+
} catch {
|
|
77007
|
+
return false;
|
|
77008
|
+
}
|
|
77009
|
+
}
|
|
77010
|
+
async function isInsideGitRepo(cwd) {
|
|
77011
|
+
try {
|
|
77012
|
+
const output = await runCommand(["git", "status"], {
|
|
77013
|
+
cwd,
|
|
77014
|
+
useSpinner: false,
|
|
77015
|
+
silent: true,
|
|
77016
|
+
captureOutput: true
|
|
77017
|
+
});
|
|
77018
|
+
return output.includes("not a git repository") === false;
|
|
77019
|
+
} catch (err) {
|
|
77020
|
+
return false;
|
|
77021
|
+
}
|
|
77022
|
+
}
|
|
77023
|
+
async function initializeGit(cwd) {
|
|
77024
|
+
const s = spinner();
|
|
77025
|
+
s.start("Initializing git repo");
|
|
77026
|
+
try {
|
|
77027
|
+
const defaultBranchName = await runCommand(
|
|
77028
|
+
["git", "config", "--get", "init.defaultBranch"],
|
|
77029
|
+
{ useSpinner: false, silent: true, cwd }
|
|
77030
|
+
);
|
|
77031
|
+
await runCommand(
|
|
77032
|
+
["git", "init", "--initial-branch", defaultBranchName.trim() ?? "main"],
|
|
77033
|
+
// branch names can't contain spaces, so this is safe
|
|
77034
|
+
{ useSpinner: false, silent: true, cwd }
|
|
77035
|
+
);
|
|
77036
|
+
} catch {
|
|
77037
|
+
await runCommand(["git", "init"], { useSpinner: false, silent: true, cwd });
|
|
77038
|
+
} finally {
|
|
77039
|
+
s.stop(`${brandColor("initialized")} ${dim(`git`)}`);
|
|
77040
|
+
}
|
|
77041
|
+
}
|
|
77042
|
+
async function getProductionBranch(cwd) {
|
|
77043
|
+
try {
|
|
77044
|
+
const productionBranch = await runCommand(
|
|
77045
|
+
["git", "branch", "--show-current"],
|
|
77046
|
+
{
|
|
77047
|
+
silent: true,
|
|
77048
|
+
cwd,
|
|
77049
|
+
useSpinner: false,
|
|
77050
|
+
captureOutput: true
|
|
77051
|
+
}
|
|
77052
|
+
);
|
|
77053
|
+
return productionBranch.trim();
|
|
77054
|
+
} catch (err) {
|
|
77055
|
+
}
|
|
77056
|
+
return "main";
|
|
77057
|
+
}
|
|
77025
77058
|
|
|
77026
77059
|
// src/validators.ts
|
|
77027
77060
|
var import_fs10 = require("fs");
|
|
@@ -77117,24 +77150,25 @@ function getFrameworkMap({ experimental = false }) {
|
|
|
77117
77150
|
qwik: c3_default11,
|
|
77118
77151
|
remix: c3_default12,
|
|
77119
77152
|
solid: c3_default13,
|
|
77120
|
-
svelte: c3_default14
|
|
77153
|
+
svelte: c3_default14,
|
|
77154
|
+
vue: c3_default15
|
|
77121
77155
|
};
|
|
77122
77156
|
} else {
|
|
77123
77157
|
return {
|
|
77124
|
-
analog:
|
|
77125
|
-
angular:
|
|
77126
|
-
astro:
|
|
77127
|
-
docusaurus:
|
|
77128
|
-
gatsby:
|
|
77129
|
-
hono:
|
|
77130
|
-
next:
|
|
77131
|
-
nuxt:
|
|
77132
|
-
qwik:
|
|
77133
|
-
react:
|
|
77134
|
-
remix:
|
|
77135
|
-
solid:
|
|
77136
|
-
svelte:
|
|
77137
|
-
vue:
|
|
77158
|
+
analog: c3_default16,
|
|
77159
|
+
angular: c3_default17,
|
|
77160
|
+
astro: c3_default18,
|
|
77161
|
+
docusaurus: c3_default20,
|
|
77162
|
+
gatsby: c3_default21,
|
|
77163
|
+
hono: c3_default24,
|
|
77164
|
+
next: c3_default25,
|
|
77165
|
+
nuxt: c3_default26,
|
|
77166
|
+
qwik: c3_default30,
|
|
77167
|
+
react: c3_default31,
|
|
77168
|
+
remix: c3_default32,
|
|
77169
|
+
solid: c3_default34,
|
|
77170
|
+
svelte: c3_default35,
|
|
77171
|
+
vue: c3_default36
|
|
77138
77172
|
};
|
|
77139
77173
|
}
|
|
77140
77174
|
}
|
|
@@ -77147,13 +77181,13 @@ function getTemplateMap({ experimental = false }) {
|
|
|
77147
77181
|
};
|
|
77148
77182
|
} else {
|
|
77149
77183
|
return {
|
|
77150
|
-
"hello-world":
|
|
77151
|
-
common:
|
|
77152
|
-
scheduled:
|
|
77153
|
-
queues:
|
|
77154
|
-
"hello-world-durable-object":
|
|
77155
|
-
openapi:
|
|
77156
|
-
"pre-existing":
|
|
77184
|
+
"hello-world": c3_default23,
|
|
77185
|
+
common: c3_default19,
|
|
77186
|
+
scheduled: c3_default33,
|
|
77187
|
+
queues: c3_default29,
|
|
77188
|
+
"hello-world-durable-object": c3_default22,
|
|
77189
|
+
openapi: c3_default27,
|
|
77190
|
+
"pre-existing": c3_default28
|
|
77157
77191
|
};
|
|
77158
77192
|
}
|
|
77159
77193
|
}
|
|
@@ -77300,8 +77334,8 @@ var createContext = async (args, prevArgs) => {
|
|
|
77300
77334
|
experimental: args.experimental
|
|
77301
77335
|
});
|
|
77302
77336
|
const frameworkOptions = Object.entries(frameworkMap).map(
|
|
77303
|
-
([key,
|
|
77304
|
-
label:
|
|
77337
|
+
([key, config27]) => ({
|
|
77338
|
+
label: config27.displayName,
|
|
77305
77339
|
value: key
|
|
77306
77340
|
})
|
|
77307
77341
|
);
|
|
@@ -77439,28 +77473,28 @@ var processRemoteTemplate = async (args) => {
|
|
|
77439
77473
|
src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
|
|
77440
77474
|
}
|
|
77441
77475
|
const path6 = await downloadRemoteTemplate(src);
|
|
77442
|
-
const
|
|
77443
|
-
validateTemplate(path6,
|
|
77476
|
+
const config27 = inferTemplateConfig(path6);
|
|
77477
|
+
validateTemplate(path6, config27);
|
|
77444
77478
|
updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
|
|
77445
77479
|
return {
|
|
77446
77480
|
path: path6,
|
|
77447
|
-
...
|
|
77481
|
+
...config27
|
|
77448
77482
|
};
|
|
77449
77483
|
};
|
|
77450
|
-
var validateTemplate = (path6,
|
|
77451
|
-
if (!
|
|
77484
|
+
var validateTemplate = (path6, config27) => {
|
|
77485
|
+
if (!config27.copyFiles) {
|
|
77452
77486
|
return;
|
|
77453
77487
|
}
|
|
77454
|
-
if (isVariantInfo(
|
|
77455
|
-
validateTemplateSrcDirectory((0, import_path13.resolve)(path6,
|
|
77488
|
+
if (isVariantInfo(config27.copyFiles)) {
|
|
77489
|
+
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config27.copyFiles.path), config27);
|
|
77456
77490
|
} else {
|
|
77457
|
-
for (const variant of Object.values(
|
|
77458
|
-
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path),
|
|
77491
|
+
for (const variant of Object.values(config27.copyFiles.variants)) {
|
|
77492
|
+
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path), config27);
|
|
77459
77493
|
}
|
|
77460
77494
|
}
|
|
77461
77495
|
};
|
|
77462
|
-
var validateTemplateSrcDirectory = (path6,
|
|
77463
|
-
if (
|
|
77496
|
+
var validateTemplateSrcDirectory = (path6, config27) => {
|
|
77497
|
+
if (config27.platform === "workers") {
|
|
77464
77498
|
const wranglerTomlPath = (0, import_path13.resolve)(path6, "wrangler.toml");
|
|
77465
77499
|
if (!(0, import_fs11.existsSync)(wranglerTomlPath)) {
|
|
77466
77500
|
throw new Error(
|
|
@@ -77912,11 +77946,13 @@ var processArgument = async (args, key, promptConfig) => {
|
|
|
77912
77946
|
disableTelemetry: args[key] !== void 0,
|
|
77913
77947
|
async promise() {
|
|
77914
77948
|
const value = args[key];
|
|
77949
|
+
const error2 = promptConfig.validate?.(value) ?? null;
|
|
77915
77950
|
const result = await inputPrompt({
|
|
77916
77951
|
...promptConfig,
|
|
77917
77952
|
// Accept the default value if the arg is already set
|
|
77918
|
-
acceptDefault: promptConfig.acceptDefault ?? value !== void 0,
|
|
77953
|
+
acceptDefault: promptConfig.acceptDefault ?? (value !== void 0 && !error2),
|
|
77919
77954
|
defaultValue: value ?? promptConfig.defaultValue,
|
|
77955
|
+
initialErrorMessage: error2,
|
|
77920
77956
|
throwOnError: true
|
|
77921
77957
|
});
|
|
77922
77958
|
args[key] = result;
|
|
@@ -77928,6 +77964,9 @@ var processArgument = async (args, key, promptConfig) => {
|
|
|
77928
77964
|
};
|
|
77929
77965
|
|
|
77930
77966
|
// src/deploy.ts
|
|
77967
|
+
var import_promises4 = require("node:fs/promises");
|
|
77968
|
+
var import_node_os5 = require("node:os");
|
|
77969
|
+
var import_node_path5 = require("node:path");
|
|
77931
77970
|
var import_toml2 = __toESM(require_toml());
|
|
77932
77971
|
|
|
77933
77972
|
// src/helpers/poll.ts
|
|
@@ -79161,14 +79200,16 @@ var updateWranglerToml = async (ctx) => {
|
|
|
79161
79200
|
}
|
|
79162
79201
|
} else {
|
|
79163
79202
|
newToml.prepend(
|
|
79164
|
-
`compatibility_date = "${await getWorkerdCompatibilityDate()}"
|
|
79203
|
+
`compatibility_date = "${await getWorkerdCompatibilityDate()}"
|
|
79204
|
+
`
|
|
79165
79205
|
);
|
|
79166
79206
|
}
|
|
79167
79207
|
const nameRe = /^name\s*=.*/m;
|
|
79168
79208
|
if (wranglerToml.match(nameRe)) {
|
|
79169
79209
|
newToml.replace(nameRe, `name = "${ctx.project.name}"`);
|
|
79170
79210
|
} else {
|
|
79171
|
-
newToml.prepend(`name = "${ctx.project.name}"
|
|
79211
|
+
newToml.prepend(`name = "${ctx.project.name}"
|
|
79212
|
+
`);
|
|
79172
79213
|
}
|
|
79173
79214
|
writeWranglerToml(ctx, newToml.toString());
|
|
79174
79215
|
};
|
|
@@ -79190,7 +79231,7 @@ var writeWranglerToml = (ctx, contents) => {
|
|
|
79190
79231
|
|
|
79191
79232
|
// src/deploy.ts
|
|
79192
79233
|
var offerToDeploy = async (ctx) => {
|
|
79193
|
-
const { npm:
|
|
79234
|
+
const { npm: npm23 } = detectPackageManager();
|
|
79194
79235
|
startSection(`Deploy with Cloudflare`, `Step 3 of 3`);
|
|
79195
79236
|
if (!await isDeployable(ctx)) {
|
|
79196
79237
|
ctx.args.deploy = false;
|
|
@@ -79201,7 +79242,7 @@ var offerToDeploy = async (ctx) => {
|
|
|
79201
79242
|
);
|
|
79202
79243
|
}
|
|
79203
79244
|
const label = `deploy via \`${quoteShellArgs([
|
|
79204
|
-
|
|
79245
|
+
npm23,
|
|
79205
79246
|
"run",
|
|
79206
79247
|
ctx.template.deployScript ?? "deploy"
|
|
79207
79248
|
])}\``;
|
|
@@ -79231,11 +79272,11 @@ var isDeployable = async (ctx) => {
|
|
|
79231
79272
|
return !hasBinding(wranglerToml);
|
|
79232
79273
|
};
|
|
79233
79274
|
var runDeploy = async (ctx) => {
|
|
79234
|
-
const { npm:
|
|
79275
|
+
const { npm: npm23, name: pm4 } = detectPackageManager();
|
|
79235
79276
|
if (!ctx.account?.id) {
|
|
79236
79277
|
throw new Error("Failed to read Cloudflare account.");
|
|
79237
79278
|
}
|
|
79238
|
-
const baseDeployCmd = [
|
|
79279
|
+
const baseDeployCmd = [npm23, "run", ctx.template.deployScript ?? "deploy"];
|
|
79239
79280
|
const insideGitRepo = await isInsideGitRepo(ctx.project.path);
|
|
79240
79281
|
const deployCmd = [
|
|
79241
79282
|
...baseDeployCmd,
|
|
@@ -79246,23 +79287,34 @@ var runDeploy = async (ctx) => {
|
|
|
79246
79287
|
JSON.stringify(ctx.commitMessage)
|
|
79247
79288
|
] : []
|
|
79248
79289
|
];
|
|
79249
|
-
const
|
|
79250
|
-
|
|
79290
|
+
const outputFile = (0, import_node_path5.join)(
|
|
79291
|
+
await (0, import_promises4.mkdtemp)((0, import_node_path5.join)((0, import_node_os5.tmpdir)(), "c3-wrangler-deploy-")),
|
|
79292
|
+
"output.json"
|
|
79293
|
+
);
|
|
79294
|
+
await runCommand(deployCmd, {
|
|
79251
79295
|
cwd: ctx.project.path,
|
|
79252
79296
|
env: {
|
|
79253
79297
|
CLOUDFLARE_ACCOUNT_ID: ctx.account.id,
|
|
79254
|
-
NODE_ENV: "production"
|
|
79298
|
+
NODE_ENV: "production",
|
|
79299
|
+
WRANGLER_OUTPUT_FILE_PATH: outputFile
|
|
79255
79300
|
},
|
|
79256
79301
|
startText: "Deploying your application",
|
|
79257
79302
|
doneText: `${brandColor("deployed")} ${dim(
|
|
79258
79303
|
`via \`${quoteShellArgs(baseDeployCmd)}\``
|
|
79259
79304
|
)}`
|
|
79260
79305
|
});
|
|
79261
|
-
|
|
79262
|
-
|
|
79263
|
-
|
|
79264
|
-
|
|
79265
|
-
|
|
79306
|
+
try {
|
|
79307
|
+
const contents = readFile(outputFile);
|
|
79308
|
+
const entries = contents.split("\n").filter(Boolean).map((entry) => JSON.parse(entry));
|
|
79309
|
+
const url = entries.find((entry) => entry.type === "deploy")?.targets?.[0] ?? entries.find((entry) => entry.type === "pages-deploy")?.url;
|
|
79310
|
+
const deployedUrlRegex = /https:\/\/.+\.(pages|workers)\.dev/;
|
|
79311
|
+
const deployedUrlMatch = url?.match(deployedUrlRegex);
|
|
79312
|
+
if (deployedUrlMatch) {
|
|
79313
|
+
ctx.deployment.url = deployedUrlMatch[0];
|
|
79314
|
+
} else {
|
|
79315
|
+
throw new Error("Failed to find deployment url.");
|
|
79316
|
+
}
|
|
79317
|
+
} catch {
|
|
79266
79318
|
throw new Error("Failed to find deployment url.");
|
|
79267
79319
|
}
|
|
79268
79320
|
if (ctx.deployment.url?.endsWith(".pages.dev")) {
|
|
@@ -79314,16 +79366,22 @@ function createDialog(lines) {
|
|
|
79314
79366
|
""
|
|
79315
79367
|
].join("\n");
|
|
79316
79368
|
}
|
|
79317
|
-
function printWelcomeMessage(version3, telemetryEnabled) {
|
|
79369
|
+
function printWelcomeMessage(version3, telemetryEnabled, args) {
|
|
79318
79370
|
const lines = [
|
|
79319
79371
|
`\u{1F44B} Welcome to create-cloudflare v${version3}!`,
|
|
79320
79372
|
`\u{1F9E1} Let's get started.`
|
|
79321
79373
|
];
|
|
79374
|
+
if (args.experimental) {
|
|
79375
|
+
lines.push("", blue`🧪 Running in experimental mode`);
|
|
79376
|
+
}
|
|
79322
79377
|
if (telemetryEnabled) {
|
|
79378
|
+
if (args.experimental) {
|
|
79379
|
+
lines.push("");
|
|
79380
|
+
}
|
|
79323
79381
|
const telemetryDocsUrl = `https://github.com/cloudflare/workers-sdk/blob/main/packages/create-cloudflare/telemetry.md`;
|
|
79324
79382
|
lines.push(
|
|
79325
79383
|
`\u{1F4CA} Cloudflare collects telemetry about your usage of Create-Cloudflare.`,
|
|
79326
|
-
|
|
79384
|
+
"",
|
|
79327
79385
|
`Learn more at: ${blue.underline(hyperlink(telemetryDocsUrl))}`
|
|
79328
79386
|
);
|
|
79329
79387
|
}
|
|
@@ -79334,19 +79392,20 @@ var printSummary = (ctx) => {
|
|
|
79334
79392
|
const dashboardUrl = ctx.account ? `https://dash.cloudflare.com/?to=/:account/workers/services/view/${ctx.project.name}` : null;
|
|
79335
79393
|
const relativePath = (0, import_path15.relative)(ctx.originalCWD, ctx.project.path);
|
|
79336
79394
|
const cdCommand = relativePath ? `cd ${relativePath}` : null;
|
|
79337
|
-
const { npm:
|
|
79395
|
+
const { npm: npm23 } = detectPackageManager();
|
|
79338
79396
|
const devServerCommand = quoteShellArgs([
|
|
79339
|
-
|
|
79397
|
+
npm23,
|
|
79340
79398
|
"run",
|
|
79341
79399
|
ctx.template.devScript ?? "start"
|
|
79342
79400
|
]);
|
|
79343
79401
|
const deployCommand = quoteShellArgs([
|
|
79344
|
-
|
|
79402
|
+
npm23,
|
|
79345
79403
|
"run",
|
|
79346
79404
|
ctx.template.deployScript ?? "deploy"
|
|
79347
79405
|
]);
|
|
79348
79406
|
const documentationUrl = `https://developers.cloudflare.com/${ctx.template.platform}`;
|
|
79349
79407
|
const discordUrl = `https://discord.cloudflare.com`;
|
|
79408
|
+
const reportIssueUrl = "https://github.com/cloudflare/workers-sdk/issues/new/choose";
|
|
79350
79409
|
const lines = [
|
|
79351
79410
|
`\u{1F389} ${bgGreen(" SUCCESS ")} Application ${ctx.deployment.url ? "deployed" : "created"} successfully!`,
|
|
79352
79411
|
``
|
|
@@ -79368,6 +79427,9 @@ var printSummary = (ctx) => {
|
|
|
79368
79427
|
`\u{1F4D6} Explore Documentation`,
|
|
79369
79428
|
`${blue.underline(hyperlink(documentationUrl))}`,
|
|
79370
79429
|
``,
|
|
79430
|
+
`\u{1F41B} Report an Issue`,
|
|
79431
|
+
`${blue.underline(hyperlink(reportIssueUrl))}`,
|
|
79432
|
+
``,
|
|
79371
79433
|
`\u{1F4AC} Join our Community`,
|
|
79372
79434
|
`${blue.underline(hyperlink(discordUrl))}`
|
|
79373
79435
|
);
|
|
@@ -79705,8 +79767,8 @@ var renderValues = (values) => {
|
|
|
79705
79767
|
};
|
|
79706
79768
|
|
|
79707
79769
|
// src/helpers/retry.ts
|
|
79708
|
-
var retry = async (
|
|
79709
|
-
let { times } =
|
|
79770
|
+
var retry = async (config27, fn) => {
|
|
79771
|
+
let { times } = config27;
|
|
79710
79772
|
let error2 = null;
|
|
79711
79773
|
while (times > 0) {
|
|
79712
79774
|
try {
|
|
@@ -79714,10 +79776,10 @@ var retry = async (config26, fn) => {
|
|
|
79714
79776
|
} catch (e) {
|
|
79715
79777
|
error2 = e;
|
|
79716
79778
|
times--;
|
|
79717
|
-
if (
|
|
79779
|
+
if (config27.exitCondition?.(e)) {
|
|
79718
79780
|
break;
|
|
79719
79781
|
}
|
|
79720
|
-
await sleep(
|
|
79782
|
+
await sleep(config27.sleepMs ?? 1e3);
|
|
79721
79783
|
}
|
|
79722
79784
|
}
|
|
79723
79785
|
throw error2;
|
|
@@ -81114,14 +81176,14 @@ function applyEdits(text, edits) {
|
|
|
81114
81176
|
|
|
81115
81177
|
// src/workers.ts
|
|
81116
81178
|
async function installWorkersTypes(ctx) {
|
|
81117
|
-
const { npm:
|
|
81179
|
+
const { npm: npm23 } = detectPackageManager();
|
|
81118
81180
|
if (!usesTypescript(ctx)) {
|
|
81119
81181
|
return;
|
|
81120
81182
|
}
|
|
81121
81183
|
await installPackages(["@cloudflare/workers-types"], {
|
|
81122
81184
|
dev: true,
|
|
81123
81185
|
startText: "Installing @cloudflare/workers-types",
|
|
81124
|
-
doneText: `${brandColor("installed")} ${dim(`via ${
|
|
81186
|
+
doneText: `${brandColor("installed")} ${dim(`via ${npm23}`)}`
|
|
81125
81187
|
});
|
|
81126
81188
|
await addWorkersTypesToTsConfig(ctx);
|
|
81127
81189
|
}
|
|
@@ -81144,8 +81206,8 @@ async function addWorkersTypesToTsConfig(ctx) {
|
|
|
81144
81206
|
}
|
|
81145
81207
|
const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`;
|
|
81146
81208
|
try {
|
|
81147
|
-
const
|
|
81148
|
-
const currentTypes =
|
|
81209
|
+
const config27 = parse3(tsconfig);
|
|
81210
|
+
const currentTypes = config27.compilerOptions?.types ?? [];
|
|
81149
81211
|
const explicitEntrypoint = currentTypes.some(
|
|
81150
81212
|
(t) => t.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/)
|
|
81151
81213
|
);
|
|
@@ -81175,7 +81237,7 @@ async function addWorkersTypesToTsConfig(ctx) {
|
|
|
81175
81237
|
}
|
|
81176
81238
|
|
|
81177
81239
|
// src/cli.ts
|
|
81178
|
-
var { npm:
|
|
81240
|
+
var { npm: npm22 } = detectPackageManager();
|
|
81179
81241
|
var main = async (argv) => {
|
|
81180
81242
|
const result = await parseArgs(argv);
|
|
81181
81243
|
if (result.type === "unknown") {
|
|
@@ -81211,13 +81273,13 @@ ${result.errorMessage}`);
|
|
|
81211
81273
|
};
|
|
81212
81274
|
var runLatest = async () => {
|
|
81213
81275
|
const args = process.argv.slice(2);
|
|
81214
|
-
if (
|
|
81276
|
+
if (npm22 === "npm") {
|
|
81215
81277
|
args.unshift("--");
|
|
81216
81278
|
}
|
|
81217
|
-
await runCommand([
|
|
81279
|
+
await runCommand([npm22, "create", "cloudflare@latest", ...args]);
|
|
81218
81280
|
};
|
|
81219
81281
|
var runCli = async (args) => {
|
|
81220
|
-
printBanner();
|
|
81282
|
+
printBanner(args);
|
|
81221
81283
|
const ctx = await createContext(args);
|
|
81222
81284
|
await create(ctx);
|
|
81223
81285
|
await configure19(ctx);
|
|
@@ -81271,8 +81333,8 @@ var deploy = async (ctx) => {
|
|
|
81271
81333
|
await maybeOpenBrowser(ctx);
|
|
81272
81334
|
endSection("Done");
|
|
81273
81335
|
};
|
|
81274
|
-
var printBanner = () => {
|
|
81275
|
-
printWelcomeMessage(version, reporter.isEnabled);
|
|
81336
|
+
var printBanner = (args) => {
|
|
81337
|
+
printWelcomeMessage(version, reporter.isEnabled, args);
|
|
81276
81338
|
startSection(`Create an application with Cloudflare`, "Step 1 of 3");
|
|
81277
81339
|
};
|
|
81278
81340
|
main(process.argv).catch((e) => {
|