create-cloudflare 0.0.0-b8ab8093b → 0.0.0-b8af06128
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 +707 -643
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- 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 +34 -7
- 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 +4 -7
- package/templates-experimental/vue/c3.ts +33 -0
- package/templates-experimental/{svelte/ts → vue/templates}/wrangler.toml +1 -2
- 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/svelte/ts/wrangler.toml +0 -85
- 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/templates-experimental/svelte/ts/static/.assetsignore +0 -4
- /package/templates/svelte/{js → templates}/wrangler.toml +0 -0
- /package/templates-experimental/svelte/{js → templates}/static/.assetsignore +0 -0
- /package/templates-experimental/svelte/{js → templates}/wrangler.toml +0 -0
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-b8af06128";
|
|
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-b8ab8093b";
|
|
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.11.0",
|
|
74656
74491
|
"create-analog": "1.8.1",
|
|
74657
|
-
"@angular/create": "
|
|
74658
|
-
"create-docusaurus": "3.
|
|
74659
|
-
"create-hono": "0.
|
|
74492
|
+
"@angular/create": "19.0.4",
|
|
74493
|
+
"create-docusaurus": "3.6.3",
|
|
74494
|
+
"create-hono": "0.14.3",
|
|
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
|
-
nuxi: "3.
|
|
74496
|
+
"create-qwik": "1.11.0",
|
|
74497
|
+
"create-vite": "6.0.1",
|
|
74498
|
+
"create-remix": "2.15.1",
|
|
74499
|
+
"create-solid": "0.5.14",
|
|
74500
|
+
"create-vue": "3.12.2",
|
|
74501
|
+
gatsby: "5.14.0",
|
|
74502
|
+
sv: "0.6.7",
|
|
74503
|
+
nuxi: "3.16.0"
|
|
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("
|
|
75504
|
-
),
|
|
75505
|
-
// output: {
|
|
75506
|
-
// dir: "{{ rootDir }}/dist",
|
|
75507
|
-
// publicDir: "{{ output.dir }}/public",
|
|
75508
|
-
// serverDir: "{{ output.dir }}/worker",
|
|
75509
|
-
// },
|
|
75510
|
-
b2.objectProperty(
|
|
75511
|
-
b2.identifier("output"),
|
|
75512
|
-
b2.objectExpression([
|
|
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
|
-
])
|
|
75325
|
+
b2.stringLiteral("cloudflare_module")
|
|
75538
75326
|
),
|
|
75539
|
-
// hooks: {
|
|
75540
|
-
// // Prevent the Pages preset from writing the _routes.json etc.
|
|
75541
|
-
// compiled() {},
|
|
75542
|
-
// },
|
|
75543
75327
|
b2.objectProperty(
|
|
75544
|
-
b2.identifier("
|
|
75545
|
-
b2.
|
|
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,14 +75431,11 @@ 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
|
-
|
|
75663
|
-
js: { path: "./js" },
|
|
75664
|
-
ts: { path: "./ts" }
|
|
75665
|
-
}
|
|
75438
|
+
path: "./templates"
|
|
75666
75439
|
},
|
|
75667
75440
|
path: "templates-experimental/svelte",
|
|
75668
75441
|
generate: generate11,
|
|
@@ -75687,10 +75460,38 @@ var config12 = {
|
|
|
75687
75460
|
};
|
|
75688
75461
|
var c3_default14 = config12;
|
|
75689
75462
|
|
|
75463
|
+
// templates-experimental/vue/c3.ts
|
|
75464
|
+
var { npm: npm9 } = detectPackageManager();
|
|
75465
|
+
var generate12 = async (ctx) => {
|
|
75466
|
+
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
75467
|
+
};
|
|
75468
|
+
var config13 = {
|
|
75469
|
+
configVersion: 1,
|
|
75470
|
+
id: "vue",
|
|
75471
|
+
frameworkCli: "create-vue",
|
|
75472
|
+
platform: "workers",
|
|
75473
|
+
displayName: "Vue",
|
|
75474
|
+
copyFiles: {
|
|
75475
|
+
path: "./templates"
|
|
75476
|
+
},
|
|
75477
|
+
path: "templates-experimental/vue",
|
|
75478
|
+
generate: generate12,
|
|
75479
|
+
transformPackageJson: async () => ({
|
|
75480
|
+
scripts: {
|
|
75481
|
+
deploy: `${npm9} run build && wrangler deploy`,
|
|
75482
|
+
preview: `${npm9} run build && wrangler dev`
|
|
75483
|
+
}
|
|
75484
|
+
}),
|
|
75485
|
+
devScript: "dev",
|
|
75486
|
+
deployScript: "deploy",
|
|
75487
|
+
previewScript: "preview"
|
|
75488
|
+
};
|
|
75489
|
+
var c3_default15 = config13;
|
|
75490
|
+
|
|
75690
75491
|
// templates/analog/c3.ts
|
|
75691
75492
|
var recast7 = __toESM(require_main3());
|
|
75692
|
-
var { npm:
|
|
75693
|
-
var
|
|
75493
|
+
var { npm: npm10, name: pm2 } = detectPackageManager();
|
|
75494
|
+
var generate13 = async (ctx) => {
|
|
75694
75495
|
await runFrameworkGenerator(ctx, [
|
|
75695
75496
|
ctx.project.name,
|
|
75696
75497
|
"--template",
|
|
@@ -75708,7 +75509,7 @@ var configure9 = async (ctx) => {
|
|
|
75708
75509
|
await installPackages(packages, {
|
|
75709
75510
|
dev: true,
|
|
75710
75511
|
startText: `Installing ${packages.join(", ")}`,
|
|
75711
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75512
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
|
|
75712
75513
|
});
|
|
75713
75514
|
}
|
|
75714
75515
|
updateViteConfig(ctx);
|
|
@@ -75766,7 +75567,7 @@ var updateViteConfig = (ctx) => {
|
|
|
75766
75567
|
});
|
|
75767
75568
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
75768
75569
|
};
|
|
75769
|
-
var
|
|
75570
|
+
var config14 = {
|
|
75770
75571
|
configVersion: 1,
|
|
75771
75572
|
id: "analog",
|
|
75772
75573
|
frameworkCli: "create-analog",
|
|
@@ -75775,12 +75576,12 @@ var config13 = {
|
|
|
75775
75576
|
copyFiles: {
|
|
75776
75577
|
path: "./templates"
|
|
75777
75578
|
},
|
|
75778
|
-
generate:
|
|
75579
|
+
generate: generate13,
|
|
75779
75580
|
configure: configure9,
|
|
75780
75581
|
transformPackageJson: async () => ({
|
|
75781
75582
|
scripts: {
|
|
75782
|
-
preview: `${
|
|
75783
|
-
deploy: `${
|
|
75583
|
+
preview: `${npm10} run build && wrangler pages dev`,
|
|
75584
|
+
deploy: `${npm10} run build && wrangler pages deploy`,
|
|
75784
75585
|
"cf-typegen": `wrangler types`
|
|
75785
75586
|
}
|
|
75786
75587
|
}),
|
|
@@ -75788,13 +75589,17 @@ var config13 = {
|
|
|
75788
75589
|
deployScript: "deploy",
|
|
75789
75590
|
previewScript: "preview"
|
|
75790
75591
|
};
|
|
75791
|
-
var
|
|
75592
|
+
var c3_default16 = config14;
|
|
75792
75593
|
|
|
75793
75594
|
// templates/angular/c3.ts
|
|
75794
75595
|
var import_node_path4 = require("node:path");
|
|
75795
|
-
var { npm:
|
|
75796
|
-
var
|
|
75797
|
-
await runFrameworkGenerator(ctx, [
|
|
75596
|
+
var { npm: npm11 } = detectPackageManager();
|
|
75597
|
+
var generate14 = async (ctx) => {
|
|
75598
|
+
await runFrameworkGenerator(ctx, [
|
|
75599
|
+
ctx.project.name,
|
|
75600
|
+
"--ssr",
|
|
75601
|
+
"--server-routing"
|
|
75602
|
+
]);
|
|
75798
75603
|
logRaw("");
|
|
75799
75604
|
};
|
|
75800
75605
|
var configure10 = async (ctx) => {
|
|
@@ -75803,14 +75608,11 @@ var configure10 = async (ctx) => {
|
|
|
75803
75608
|
await installCFWorker2();
|
|
75804
75609
|
};
|
|
75805
75610
|
async function installCFWorker2() {
|
|
75806
|
-
await installPackages(
|
|
75807
|
-
|
|
75808
|
-
|
|
75809
|
-
|
|
75810
|
-
|
|
75811
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
|
|
75812
|
-
}
|
|
75813
|
-
);
|
|
75611
|
+
await installPackages(["xhr2"], {
|
|
75612
|
+
dev: true,
|
|
75613
|
+
startText: "Installing additional dependencies",
|
|
75614
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm11} install\``)}`
|
|
75615
|
+
});
|
|
75814
75616
|
}
|
|
75815
75617
|
async function updateAppCode2() {
|
|
75816
75618
|
const s = spinner();
|
|
@@ -75823,10 +75625,17 @@ async function updateAppCode2() {
|
|
|
75823
75625
|
);
|
|
75824
75626
|
writeFile2((0, import_node_path4.resolve)(appConfigPath), newAppConfig);
|
|
75825
75627
|
s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`);
|
|
75628
|
+
const appServerRoutesPath = "src/app/app.routes.server.ts";
|
|
75629
|
+
const appRoutes = readFile((0, import_node_path4.resolve)(appServerRoutesPath));
|
|
75630
|
+
const newAppRoutes = appRoutes.replace(
|
|
75631
|
+
"RenderMode.Prerender",
|
|
75632
|
+
"RenderMode.Server"
|
|
75633
|
+
);
|
|
75634
|
+
writeFile2((0, import_node_path4.resolve)(appServerRoutesPath), newAppRoutes);
|
|
75635
|
+
s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`);
|
|
75826
75636
|
s.start(`Updating package.json`);
|
|
75827
75637
|
const packageJsonPath = (0, import_node_path4.resolve)("package.json");
|
|
75828
75638
|
const packageManifest = readJSON(packageJsonPath);
|
|
75829
|
-
delete packageManifest["dependencies"]["@angular/ssr"];
|
|
75830
75639
|
delete packageManifest["dependencies"]["express"];
|
|
75831
75640
|
delete packageManifest["devDependencies"]["@types/express"];
|
|
75832
75641
|
writeFile2(packageJsonPath, JSON.stringify(packageManifest, null, 2));
|
|
@@ -75838,11 +75647,13 @@ function updateAngularJson2(ctx) {
|
|
|
75838
75647
|
const angularJson = readJSON((0, import_node_path4.resolve)("angular.json"));
|
|
75839
75648
|
const architectSection = angularJson.projects[ctx.project.name].architect;
|
|
75840
75649
|
architectSection.build.options.outputPath = "dist";
|
|
75650
|
+
architectSection.build.options.outputMode = "server";
|
|
75651
|
+
architectSection.build.options.ssr.experimentalPlatform = "neutral";
|
|
75841
75652
|
architectSection.build.options.assets.push("src/_routes.json");
|
|
75842
75653
|
writeFile2((0, import_node_path4.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
75843
75654
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
75844
75655
|
}
|
|
75845
|
-
var
|
|
75656
|
+
var config15 = {
|
|
75846
75657
|
configVersion: 1,
|
|
75847
75658
|
id: "angular",
|
|
75848
75659
|
frameworkCli: "@angular/create",
|
|
@@ -75853,23 +75664,24 @@ var config14 = {
|
|
|
75853
75664
|
},
|
|
75854
75665
|
devScript: "start",
|
|
75855
75666
|
deployScript: "deploy",
|
|
75856
|
-
|
|
75667
|
+
previewScript: "start",
|
|
75668
|
+
generate: generate14,
|
|
75857
75669
|
configure: configure10,
|
|
75858
75670
|
transformPackageJson: async () => ({
|
|
75859
75671
|
scripts: {
|
|
75860
|
-
start: `${
|
|
75861
|
-
build: `ng build && ${
|
|
75862
|
-
process: "node ./tools/copy-files.mjs
|
|
75863
|
-
deploy: `${
|
|
75672
|
+
start: `${npm11} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}`,
|
|
75673
|
+
build: `ng build && ${npm11} run process`,
|
|
75674
|
+
process: "node ./tools/copy-files.mjs",
|
|
75675
|
+
deploy: `${npm11} run build && wrangler pages deploy dist/cloudflare`
|
|
75864
75676
|
}
|
|
75865
75677
|
})
|
|
75866
75678
|
};
|
|
75867
|
-
var
|
|
75679
|
+
var c3_default17 = config15;
|
|
75868
75680
|
|
|
75869
75681
|
// templates/astro/c3.ts
|
|
75870
75682
|
var recast8 = __toESM(require_main3());
|
|
75871
75683
|
var { npx: npx3 } = detectPackageManager();
|
|
75872
|
-
var
|
|
75684
|
+
var generate15 = async (ctx) => {
|
|
75873
75685
|
await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
|
|
75874
75686
|
logRaw("");
|
|
75875
75687
|
};
|
|
@@ -75928,7 +75740,7 @@ var updateEnvDeclaration2 = (ctx) => {
|
|
|
75928
75740
|
}
|
|
75929
75741
|
});
|
|
75930
75742
|
};
|
|
75931
|
-
var
|
|
75743
|
+
var config16 = {
|
|
75932
75744
|
configVersion: 1,
|
|
75933
75745
|
id: "astro",
|
|
75934
75746
|
frameworkCli: "create-astro",
|
|
@@ -75940,7 +75752,7 @@ var config15 = {
|
|
|
75940
75752
|
devScript: "dev",
|
|
75941
75753
|
deployScript: "deploy",
|
|
75942
75754
|
previewScript: "preview",
|
|
75943
|
-
generate:
|
|
75755
|
+
generate: generate15,
|
|
75944
75756
|
configure: configure11,
|
|
75945
75757
|
transformPackageJson: async (pkgJson, ctx) => ({
|
|
75946
75758
|
scripts: {
|
|
@@ -75950,10 +75762,10 @@ var config15 = {
|
|
|
75950
75762
|
}
|
|
75951
75763
|
})
|
|
75952
75764
|
};
|
|
75953
|
-
var
|
|
75765
|
+
var c3_default18 = config16;
|
|
75954
75766
|
|
|
75955
75767
|
// templates/common/c3.ts
|
|
75956
|
-
var
|
|
75768
|
+
var c3_default19 = {
|
|
75957
75769
|
configVersion: 1,
|
|
75958
75770
|
id: "common",
|
|
75959
75771
|
displayName: "Example router & proxy Worker",
|
|
@@ -75973,31 +75785,31 @@ var c3_default18 = {
|
|
|
75973
75785
|
};
|
|
75974
75786
|
|
|
75975
75787
|
// templates/docusaurus/c3.ts
|
|
75976
|
-
var { npm:
|
|
75977
|
-
var
|
|
75788
|
+
var { npm: npm12 } = detectPackageManager();
|
|
75789
|
+
var generate16 = async (ctx) => {
|
|
75978
75790
|
await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
|
|
75979
75791
|
};
|
|
75980
|
-
var
|
|
75792
|
+
var config17 = {
|
|
75981
75793
|
configVersion: 1,
|
|
75982
75794
|
id: "docusaurus",
|
|
75983
75795
|
frameworkCli: "create-docusaurus",
|
|
75984
75796
|
platform: "pages",
|
|
75985
75797
|
displayName: "Docusaurus",
|
|
75986
|
-
generate:
|
|
75798
|
+
generate: generate16,
|
|
75987
75799
|
transformPackageJson: async () => ({
|
|
75988
75800
|
scripts: {
|
|
75989
|
-
preview: `${
|
|
75990
|
-
deploy: `${
|
|
75801
|
+
preview: `${npm12} run build && wrangler pages dev ./build`,
|
|
75802
|
+
deploy: `${npm12} run build && wrangler pages deploy ./build`
|
|
75991
75803
|
}
|
|
75992
75804
|
}),
|
|
75993
75805
|
devScript: "preview",
|
|
75994
75806
|
deployScript: "deploy"
|
|
75995
75807
|
};
|
|
75996
|
-
var
|
|
75808
|
+
var c3_default20 = config17;
|
|
75997
75809
|
|
|
75998
75810
|
// templates/gatsby/c3.ts
|
|
75999
|
-
var { npm:
|
|
76000
|
-
var
|
|
75811
|
+
var { npm: npm13 } = detectPackageManager();
|
|
75812
|
+
var generate17 = async (ctx) => {
|
|
76001
75813
|
const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
|
|
76002
75814
|
const useTemplate = await inputPrompt({
|
|
76003
75815
|
type: "confirm",
|
|
@@ -76016,27 +75828,27 @@ var generate16 = async (ctx) => {
|
|
|
76016
75828
|
}
|
|
76017
75829
|
await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
|
|
76018
75830
|
};
|
|
76019
|
-
var
|
|
75831
|
+
var config18 = {
|
|
76020
75832
|
configVersion: 1,
|
|
76021
75833
|
id: "gatsby",
|
|
76022
75834
|
frameworkCli: "gatsby",
|
|
76023
75835
|
platform: "pages",
|
|
76024
75836
|
displayName: "Gatsby",
|
|
76025
|
-
generate:
|
|
75837
|
+
generate: generate17,
|
|
76026
75838
|
transformPackageJson: async () => ({
|
|
76027
75839
|
scripts: {
|
|
76028
|
-
deploy: `${
|
|
76029
|
-
preview: `${
|
|
75840
|
+
deploy: `${npm13} run build && wrangler pages deploy ./public`,
|
|
75841
|
+
preview: `${npm13} run build && wrangler pages dev ./public`
|
|
76030
75842
|
}
|
|
76031
75843
|
}),
|
|
76032
75844
|
devScript: "develop",
|
|
76033
75845
|
deployScript: "deploy",
|
|
76034
75846
|
previewScript: "preview"
|
|
76035
75847
|
};
|
|
76036
|
-
var
|
|
75848
|
+
var c3_default21 = config18;
|
|
76037
75849
|
|
|
76038
75850
|
// templates/hello-world-durable-object/c3.ts
|
|
76039
|
-
var
|
|
75851
|
+
var c3_default22 = {
|
|
76040
75852
|
configVersion: 1,
|
|
76041
75853
|
id: "hello-world-durable-object",
|
|
76042
75854
|
displayName: "Hello World Worker Using Durable Objects",
|
|
@@ -76055,7 +75867,7 @@ var c3_default21 = {
|
|
|
76055
75867
|
};
|
|
76056
75868
|
|
|
76057
75869
|
// templates/hello-world/c3.ts
|
|
76058
|
-
var
|
|
75870
|
+
var c3_default23 = {
|
|
76059
75871
|
configVersion: 1,
|
|
76060
75872
|
id: "hello-world",
|
|
76061
75873
|
displayName: "Hello World Worker",
|
|
@@ -76077,7 +75889,7 @@ var c3_default22 = {
|
|
|
76077
75889
|
};
|
|
76078
75890
|
|
|
76079
75891
|
// templates/hono/c3.ts
|
|
76080
|
-
var
|
|
75892
|
+
var generate18 = async (ctx) => {
|
|
76081
75893
|
const { name: pm4 } = detectPackageManager();
|
|
76082
75894
|
await runFrameworkGenerator(ctx, [
|
|
76083
75895
|
ctx.project.name,
|
|
@@ -76104,7 +75916,7 @@ var configure12 = async (ctx) => {
|
|
|
76104
75916
|
});
|
|
76105
75917
|
s.stop(`${brandColor("updated")} \`${dim(indexFile)}\``);
|
|
76106
75918
|
};
|
|
76107
|
-
var
|
|
75919
|
+
var config19 = {
|
|
76108
75920
|
configVersion: 1,
|
|
76109
75921
|
id: "hono",
|
|
76110
75922
|
frameworkCli: "create-hono",
|
|
@@ -76113,7 +75925,7 @@ var config18 = {
|
|
|
76113
75925
|
path: "./templates"
|
|
76114
75926
|
},
|
|
76115
75927
|
platform: "workers",
|
|
76116
|
-
generate:
|
|
75928
|
+
generate: generate18,
|
|
76117
75929
|
configure: configure12,
|
|
76118
75930
|
transformPackageJson: async () => ({
|
|
76119
75931
|
scripts: {
|
|
@@ -76125,12 +75937,12 @@ var config18 = {
|
|
|
76125
75937
|
devScript: "dev",
|
|
76126
75938
|
deployScript: "deploy"
|
|
76127
75939
|
};
|
|
76128
|
-
var
|
|
75940
|
+
var c3_default24 = config19;
|
|
76129
75941
|
|
|
76130
75942
|
// templates/next/c3.ts
|
|
76131
75943
|
var import_path10 = require("path");
|
|
76132
|
-
var { npm:
|
|
76133
|
-
var
|
|
75944
|
+
var { npm: npm14, npx: npx4 } = detectPackageManager();
|
|
75945
|
+
var generate19 = async (ctx) => {
|
|
76134
75946
|
const projectName = ctx.project.name;
|
|
76135
75947
|
await runFrameworkGenerator(ctx, [projectName]);
|
|
76136
75948
|
const wranglerToml = readFile((0, import_path10.join)(getTemplatePath(ctx), "wrangler.toml"));
|
|
@@ -76238,13 +76050,13 @@ var addDevDependencies = async (installEslintPlugin) => {
|
|
|
76238
76050
|
doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
|
|
76239
76051
|
});
|
|
76240
76052
|
};
|
|
76241
|
-
var
|
|
76053
|
+
var c3_default25 = {
|
|
76242
76054
|
configVersion: 1,
|
|
76243
76055
|
id: "next",
|
|
76244
76056
|
frameworkCli: "create-next-app",
|
|
76245
76057
|
platform: "pages",
|
|
76246
76058
|
displayName: "Next",
|
|
76247
|
-
generate:
|
|
76059
|
+
generate: generate19,
|
|
76248
76060
|
configure: configure13,
|
|
76249
76061
|
copyFiles: {
|
|
76250
76062
|
async selectVariant(ctx) {
|
|
@@ -76276,12 +76088,12 @@ var c3_default24 = {
|
|
|
76276
76088
|
}
|
|
76277
76089
|
},
|
|
76278
76090
|
transformPackageJson: async (_3, ctx) => {
|
|
76279
|
-
const isNpm =
|
|
76280
|
-
const isBun =
|
|
76091
|
+
const isNpm = npm14 === "npm";
|
|
76092
|
+
const isBun = npm14 === "bun";
|
|
76281
76093
|
const isNpmOrBun = isNpm || isBun;
|
|
76282
76094
|
const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
|
|
76283
76095
|
const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
|
|
76284
|
-
const pmCommand = isNpmOrBun ? npx4 :
|
|
76096
|
+
const pmCommand = isNpmOrBun ? npx4 : npm14;
|
|
76285
76097
|
const pagesBuildRunCommand = `${isNpm ? "npm run" : isBun ? "bun" : pmCommand} pages:build`;
|
|
76286
76098
|
return {
|
|
76287
76099
|
scripts: {
|
|
@@ -76302,14 +76114,14 @@ var c3_default24 = {
|
|
|
76302
76114
|
|
|
76303
76115
|
// templates/nuxt/c3.ts
|
|
76304
76116
|
var recast9 = __toESM(require_main3());
|
|
76305
|
-
var { npm:
|
|
76306
|
-
var
|
|
76117
|
+
var { npm: npm15, name: pm3 } = detectPackageManager();
|
|
76118
|
+
var generate20 = async (ctx) => {
|
|
76307
76119
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
76308
76120
|
await runFrameworkGenerator(ctx, [
|
|
76309
76121
|
"init",
|
|
76310
76122
|
ctx.project.name,
|
|
76311
76123
|
"--packageManager",
|
|
76312
|
-
|
|
76124
|
+
npm15,
|
|
76313
76125
|
gitFlag
|
|
76314
76126
|
]);
|
|
76315
76127
|
writeFile2("./.node-version", "17");
|
|
@@ -76323,7 +76135,7 @@ var configure14 = async (ctx) => {
|
|
|
76323
76135
|
await installPackages(packages, {
|
|
76324
76136
|
dev: true,
|
|
76325
76137
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
76326
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
76138
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm15} install\``)}`
|
|
76327
76139
|
});
|
|
76328
76140
|
updateNuxtConfig2();
|
|
76329
76141
|
updateEnvTypes3(ctx);
|
|
@@ -76374,7 +76186,7 @@ var updateNuxtConfig2 = () => {
|
|
|
76374
76186
|
});
|
|
76375
76187
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76376
76188
|
};
|
|
76377
|
-
var
|
|
76189
|
+
var config20 = {
|
|
76378
76190
|
configVersion: 1,
|
|
76379
76191
|
id: "nuxt",
|
|
76380
76192
|
frameworkCli: "nuxi",
|
|
@@ -76383,12 +76195,12 @@ var config19 = {
|
|
|
76383
76195
|
copyFiles: {
|
|
76384
76196
|
path: "./templates"
|
|
76385
76197
|
},
|
|
76386
|
-
generate:
|
|
76198
|
+
generate: generate20,
|
|
76387
76199
|
configure: configure14,
|
|
76388
76200
|
transformPackageJson: async () => ({
|
|
76389
76201
|
scripts: {
|
|
76390
|
-
deploy: `${
|
|
76391
|
-
preview: `${
|
|
76202
|
+
deploy: `${npm15} run build && wrangler pages deploy`,
|
|
76203
|
+
preview: `${npm15} run build && wrangler pages dev`,
|
|
76392
76204
|
"cf-typegen": `wrangler types`
|
|
76393
76205
|
}
|
|
76394
76206
|
}),
|
|
@@ -76396,10 +76208,10 @@ var config19 = {
|
|
|
76396
76208
|
deployScript: "deploy",
|
|
76397
76209
|
previewScript: "preview"
|
|
76398
76210
|
};
|
|
76399
|
-
var
|
|
76211
|
+
var c3_default26 = config20;
|
|
76400
76212
|
|
|
76401
76213
|
// templates/openapi/c3.ts
|
|
76402
|
-
var
|
|
76214
|
+
var c3_default27 = {
|
|
76403
76215
|
configVersion: 1,
|
|
76404
76216
|
id: "openapi",
|
|
76405
76217
|
displayName: "API starter (OpenAPI compliant)",
|
|
@@ -76514,7 +76326,6 @@ var isLoggedIn = async () => {
|
|
|
76514
76326
|
// templates/pre-existing/c3.ts
|
|
76515
76327
|
async function copyExistingWorkerFiles(ctx) {
|
|
76516
76328
|
const { dlx } = detectPackageManager();
|
|
76517
|
-
await chooseAccount(ctx);
|
|
76518
76329
|
if (ctx.args.existingScript === void 0) {
|
|
76519
76330
|
ctx.args.existingScript = await processArgument(
|
|
76520
76331
|
ctx.args,
|
|
@@ -76559,7 +76370,7 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
76559
76370
|
(0, import_path11.join)(ctx.project.path, "wrangler.toml")
|
|
76560
76371
|
);
|
|
76561
76372
|
}
|
|
76562
|
-
var
|
|
76373
|
+
var c3_default28 = {
|
|
76563
76374
|
configVersion: 1,
|
|
76564
76375
|
id: "pre-existing",
|
|
76565
76376
|
displayName: "Pre-existing Worker (from Dashboard)",
|
|
@@ -76568,14 +76379,26 @@ var c3_default27 = {
|
|
|
76568
76379
|
copyFiles: {
|
|
76569
76380
|
path: "./js"
|
|
76570
76381
|
},
|
|
76571
|
-
configure:
|
|
76572
|
-
|
|
76573
|
-
|
|
76574
|
-
|
|
76382
|
+
configure: buildConfigure({
|
|
76383
|
+
login: wranglerLogin,
|
|
76384
|
+
chooseAccount,
|
|
76385
|
+
copyFiles: copyExistingWorkerFiles
|
|
76386
|
+
})
|
|
76575
76387
|
};
|
|
76388
|
+
function buildConfigure(params) {
|
|
76389
|
+
return async function configure20(ctx) {
|
|
76390
|
+
const loginSuccess = await params.login(ctx);
|
|
76391
|
+
if (!loginSuccess) {
|
|
76392
|
+
throw new Error("Failed to login to Cloudflare");
|
|
76393
|
+
}
|
|
76394
|
+
await params.chooseAccount(ctx);
|
|
76395
|
+
await params.copyFiles(ctx);
|
|
76396
|
+
ctx.args.deploy = false;
|
|
76397
|
+
};
|
|
76398
|
+
}
|
|
76576
76399
|
|
|
76577
76400
|
// templates/queues/c3.ts
|
|
76578
|
-
var
|
|
76401
|
+
var c3_default29 = {
|
|
76579
76402
|
configVersion: 1,
|
|
76580
76403
|
id: "queues",
|
|
76581
76404
|
displayName: "Queue consumer & producer Worker",
|
|
@@ -76605,8 +76428,8 @@ var c3_default28 = {
|
|
|
76605
76428
|
|
|
76606
76429
|
// templates/qwik/c3.ts
|
|
76607
76430
|
var recast10 = __toESM(require_main3());
|
|
76608
|
-
var { npm:
|
|
76609
|
-
var
|
|
76431
|
+
var { npm: npm16, npx: npx5 } = detectPackageManager();
|
|
76432
|
+
var generate21 = async (ctx) => {
|
|
76610
76433
|
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
76611
76434
|
};
|
|
76612
76435
|
var configure15 = async (ctx) => {
|
|
@@ -76686,7 +76509,7 @@ var populateCloudflareEnv2 = () => {
|
|
|
76686
76509
|
});
|
|
76687
76510
|
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
76688
76511
|
};
|
|
76689
|
-
var
|
|
76512
|
+
var config21 = {
|
|
76690
76513
|
configVersion: 1,
|
|
76691
76514
|
id: "qwik",
|
|
76692
76515
|
frameworkCli: "create-qwik",
|
|
@@ -76695,12 +76518,12 @@ var config20 = {
|
|
|
76695
76518
|
copyFiles: {
|
|
76696
76519
|
path: "./templates"
|
|
76697
76520
|
},
|
|
76698
|
-
generate:
|
|
76521
|
+
generate: generate21,
|
|
76699
76522
|
configure: configure15,
|
|
76700
76523
|
transformPackageJson: async () => ({
|
|
76701
76524
|
scripts: {
|
|
76702
|
-
deploy: `${
|
|
76703
|
-
preview: `${
|
|
76525
|
+
deploy: `${npm16} run build && wrangler pages deploy`,
|
|
76526
|
+
preview: `${npm16} run build && wrangler pages dev`,
|
|
76704
76527
|
"cf-typegen": `wrangler types`
|
|
76705
76528
|
}
|
|
76706
76529
|
}),
|
|
@@ -76708,11 +76531,11 @@ var config20 = {
|
|
|
76708
76531
|
deployScript: "deploy",
|
|
76709
76532
|
previewScript: "preview"
|
|
76710
76533
|
};
|
|
76711
|
-
var
|
|
76534
|
+
var c3_default30 = config21;
|
|
76712
76535
|
|
|
76713
76536
|
// templates/react/c3.ts
|
|
76714
|
-
var { npm:
|
|
76715
|
-
var
|
|
76537
|
+
var { npm: npm17 } = detectPackageManager();
|
|
76538
|
+
var generate22 = async (ctx) => {
|
|
76716
76539
|
const variant = await inputPrompt({
|
|
76717
76540
|
type: "select",
|
|
76718
76541
|
question: "Select a variant:",
|
|
@@ -76741,29 +76564,29 @@ var variantsOptions = [
|
|
|
76741
76564
|
label: "JavaScript + SWC"
|
|
76742
76565
|
}
|
|
76743
76566
|
];
|
|
76744
|
-
var
|
|
76567
|
+
var config22 = {
|
|
76745
76568
|
configVersion: 1,
|
|
76746
76569
|
id: "react",
|
|
76747
76570
|
// React's documentation now recommends using create-vite.
|
|
76748
76571
|
frameworkCli: "create-vite",
|
|
76749
76572
|
displayName: "React",
|
|
76750
76573
|
platform: "pages",
|
|
76751
|
-
generate:
|
|
76574
|
+
generate: generate22,
|
|
76752
76575
|
transformPackageJson: async () => ({
|
|
76753
76576
|
scripts: {
|
|
76754
|
-
deploy: `${
|
|
76755
|
-
preview: `${
|
|
76577
|
+
deploy: `${npm17} run build && wrangler pages deploy ./dist`,
|
|
76578
|
+
preview: `${npm17} run build && wrangler pages dev ./dist`
|
|
76756
76579
|
}
|
|
76757
76580
|
}),
|
|
76758
76581
|
devScript: "dev",
|
|
76759
76582
|
deployScript: "deploy",
|
|
76760
76583
|
previewScript: "preview"
|
|
76761
76584
|
};
|
|
76762
|
-
var
|
|
76585
|
+
var c3_default31 = config22;
|
|
76763
76586
|
|
|
76764
76587
|
// templates/remix/c3.ts
|
|
76765
|
-
var { npm:
|
|
76766
|
-
var
|
|
76588
|
+
var { npm: npm18 } = detectPackageManager();
|
|
76589
|
+
var generate23 = async (ctx) => {
|
|
76767
76590
|
await runFrameworkGenerator(ctx, [
|
|
76768
76591
|
ctx.project.name,
|
|
76769
76592
|
"--template",
|
|
@@ -76786,7 +76609,7 @@ var configure16 = async () => {
|
|
|
76786
76609
|
});
|
|
76787
76610
|
s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
|
|
76788
76611
|
};
|
|
76789
|
-
var
|
|
76612
|
+
var config23 = {
|
|
76790
76613
|
configVersion: 1,
|
|
76791
76614
|
id: "remix",
|
|
76792
76615
|
frameworkCli: "create-remix",
|
|
@@ -76795,12 +76618,12 @@ var config22 = {
|
|
|
76795
76618
|
copyFiles: {
|
|
76796
76619
|
path: "./templates"
|
|
76797
76620
|
},
|
|
76798
|
-
generate:
|
|
76621
|
+
generate: generate23,
|
|
76799
76622
|
configure: configure16,
|
|
76800
76623
|
transformPackageJson: async () => ({
|
|
76801
76624
|
scripts: {
|
|
76802
|
-
deploy: `${
|
|
76803
|
-
preview: `${
|
|
76625
|
+
deploy: `${npm18} run build && wrangler pages deploy`,
|
|
76626
|
+
preview: `${npm18} run build && wrangler pages dev`,
|
|
76804
76627
|
"cf-typegen": `wrangler types`
|
|
76805
76628
|
}
|
|
76806
76629
|
}),
|
|
@@ -76808,10 +76631,10 @@ var config22 = {
|
|
|
76808
76631
|
deployScript: "deploy",
|
|
76809
76632
|
previewScript: "preview"
|
|
76810
76633
|
};
|
|
76811
|
-
var
|
|
76634
|
+
var c3_default32 = config23;
|
|
76812
76635
|
|
|
76813
76636
|
// templates/scheduled/c3.ts
|
|
76814
|
-
var
|
|
76637
|
+
var c3_default33 = {
|
|
76815
76638
|
configVersion: 1,
|
|
76816
76639
|
id: "scheduled",
|
|
76817
76640
|
displayName: "Scheduled Worker (Cron Trigger)",
|
|
@@ -76831,8 +76654,8 @@ var c3_default32 = {
|
|
|
76831
76654
|
|
|
76832
76655
|
// templates/solid/c3.ts
|
|
76833
76656
|
var recast11 = __toESM(require_main3());
|
|
76834
|
-
var { npm:
|
|
76835
|
-
var
|
|
76657
|
+
var { npm: npm19 } = detectPackageManager();
|
|
76658
|
+
var generate24 = async (ctx) => {
|
|
76836
76659
|
await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
|
|
76837
76660
|
logRaw("");
|
|
76838
76661
|
};
|
|
@@ -76874,7 +76697,7 @@ var configure17 = async (ctx) => {
|
|
|
76874
76697
|
}
|
|
76875
76698
|
});
|
|
76876
76699
|
};
|
|
76877
|
-
var
|
|
76700
|
+
var config24 = {
|
|
76878
76701
|
configVersion: 1,
|
|
76879
76702
|
id: "solid",
|
|
76880
76703
|
frameworkCli: "create-solid",
|
|
@@ -76883,12 +76706,12 @@ var config23 = {
|
|
|
76883
76706
|
copyFiles: {
|
|
76884
76707
|
path: "./templates"
|
|
76885
76708
|
},
|
|
76886
|
-
generate:
|
|
76709
|
+
generate: generate24,
|
|
76887
76710
|
configure: configure17,
|
|
76888
76711
|
transformPackageJson: async () => ({
|
|
76889
76712
|
scripts: {
|
|
76890
|
-
preview: `${
|
|
76891
|
-
deploy: `${
|
|
76713
|
+
preview: `${npm19} run build && npx wrangler pages dev`,
|
|
76714
|
+
deploy: `${npm19} run build && wrangler pages deploy`
|
|
76892
76715
|
}
|
|
76893
76716
|
}),
|
|
76894
76717
|
compatibilityFlags: ["nodejs_compat"],
|
|
@@ -76896,14 +76719,15 @@ var config23 = {
|
|
|
76896
76719
|
deployScript: "deploy",
|
|
76897
76720
|
previewScript: "preview"
|
|
76898
76721
|
};
|
|
76899
|
-
var
|
|
76722
|
+
var c3_default34 = config24;
|
|
76900
76723
|
|
|
76901
76724
|
// templates/svelte/c3.ts
|
|
76725
|
+
var import_node_fs3 = require("node:fs");
|
|
76902
76726
|
var import_node_os4 = require("node:os");
|
|
76903
76727
|
var recast12 = __toESM(require_main3());
|
|
76904
|
-
var { npm:
|
|
76905
|
-
var
|
|
76906
|
-
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
76728
|
+
var { npm: npm20 } = detectPackageManager();
|
|
76729
|
+
var generate25 = async (ctx) => {
|
|
76730
|
+
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
76907
76731
|
logRaw("");
|
|
76908
76732
|
};
|
|
76909
76733
|
var configure18 = async (ctx) => {
|
|
@@ -76914,6 +76738,7 @@ var configure18 = async (ctx) => {
|
|
|
76914
76738
|
doneText: `${brandColor(`installed`)} ${dim(pkg)}`
|
|
76915
76739
|
});
|
|
76916
76740
|
updateSvelteConfig2();
|
|
76741
|
+
updatePlaywrightConfig(usesTypescript(ctx));
|
|
76917
76742
|
updateTypeDefinitions2(ctx);
|
|
76918
76743
|
};
|
|
76919
76744
|
var updateSvelteConfig2 = () => {
|
|
@@ -76928,6 +76753,28 @@ var updateSvelteConfig2 = () => {
|
|
|
76928
76753
|
}
|
|
76929
76754
|
});
|
|
76930
76755
|
};
|
|
76756
|
+
var updatePlaywrightConfig = (shouldUseTypescript) => {
|
|
76757
|
+
const filePath = `playwright.config.${shouldUseTypescript ? "ts" : "js"}`;
|
|
76758
|
+
if (!(0, import_node_fs3.existsSync)(filePath)) {
|
|
76759
|
+
return;
|
|
76760
|
+
}
|
|
76761
|
+
updateStatus(`Changing webServer port in ${blue(filePath)}`);
|
|
76762
|
+
transformFile(filePath, {
|
|
76763
|
+
visitObjectExpression: function(n2) {
|
|
76764
|
+
const portProp = n2.node.properties.find((prop) => {
|
|
76765
|
+
if (!("key" in prop) || !("name" in prop.key)) {
|
|
76766
|
+
return false;
|
|
76767
|
+
}
|
|
76768
|
+
return prop.key.name === "port";
|
|
76769
|
+
});
|
|
76770
|
+
if (!portProp || !("value" in portProp) || !("value" in portProp.value)) {
|
|
76771
|
+
return this.traverse(n2);
|
|
76772
|
+
}
|
|
76773
|
+
portProp.value.value = 8788;
|
|
76774
|
+
return false;
|
|
76775
|
+
}
|
|
76776
|
+
});
|
|
76777
|
+
};
|
|
76931
76778
|
var updateTypeDefinitions2 = (ctx) => {
|
|
76932
76779
|
if (!usesTypescript(ctx)) {
|
|
76933
76780
|
return;
|
|
@@ -76965,24 +76812,21 @@ var updateTypeDefinitions2 = (ctx) => {
|
|
|
76965
76812
|
}
|
|
76966
76813
|
});
|
|
76967
76814
|
};
|
|
76968
|
-
var
|
|
76815
|
+
var config25 = {
|
|
76969
76816
|
configVersion: 1,
|
|
76970
76817
|
id: "svelte",
|
|
76971
|
-
frameworkCli: "
|
|
76972
|
-
displayName: "
|
|
76818
|
+
frameworkCli: "sv",
|
|
76819
|
+
displayName: "SvelteKit",
|
|
76973
76820
|
platform: "pages",
|
|
76974
76821
|
copyFiles: {
|
|
76975
|
-
|
|
76976
|
-
js: { path: "./js" },
|
|
76977
|
-
ts: { path: "./ts" }
|
|
76978
|
-
}
|
|
76822
|
+
path: "./templates"
|
|
76979
76823
|
},
|
|
76980
|
-
generate:
|
|
76824
|
+
generate: generate25,
|
|
76981
76825
|
configure: configure18,
|
|
76982
76826
|
transformPackageJson: async (original, ctx) => {
|
|
76983
76827
|
let scripts = {
|
|
76984
|
-
preview: `${
|
|
76985
|
-
deploy: `${
|
|
76828
|
+
preview: `${npm20} run build && wrangler pages dev`,
|
|
76829
|
+
deploy: `${npm20} run build && wrangler pages deploy`
|
|
76986
76830
|
};
|
|
76987
76831
|
if (usesTypescript(ctx)) {
|
|
76988
76832
|
const mv = (0, import_node_os4.platform)() === "win32" ? "move" : "mv";
|
|
@@ -76997,31 +76841,214 @@ var config24 = {
|
|
|
76997
76841
|
deployScript: "deploy",
|
|
76998
76842
|
previewScript: "preview"
|
|
76999
76843
|
};
|
|
77000
|
-
var
|
|
76844
|
+
var c3_default35 = config25;
|
|
77001
76845
|
|
|
77002
76846
|
// templates/vue/c3.ts
|
|
77003
|
-
var { npm:
|
|
77004
|
-
var
|
|
76847
|
+
var { npm: npm21 } = detectPackageManager();
|
|
76848
|
+
var generate26 = async (ctx) => {
|
|
77005
76849
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
77006
76850
|
};
|
|
77007
|
-
var
|
|
76851
|
+
var config26 = {
|
|
77008
76852
|
configVersion: 1,
|
|
77009
76853
|
id: "vue",
|
|
77010
76854
|
frameworkCli: "create-vue",
|
|
77011
76855
|
displayName: "Vue",
|
|
77012
76856
|
platform: "pages",
|
|
77013
|
-
generate:
|
|
76857
|
+
generate: generate26,
|
|
77014
76858
|
transformPackageJson: async () => ({
|
|
77015
76859
|
scripts: {
|
|
77016
|
-
deploy: `${
|
|
77017
|
-
preview: `${
|
|
76860
|
+
deploy: `${npm21} run build && wrangler pages deploy ./dist`,
|
|
76861
|
+
preview: `${npm21} run build && wrangler pages dev ./dist`
|
|
77018
76862
|
}
|
|
77019
76863
|
}),
|
|
77020
76864
|
devScript: "dev",
|
|
77021
76865
|
deployScript: "deploy",
|
|
77022
76866
|
previewScript: "preview"
|
|
77023
76867
|
};
|
|
77024
|
-
var
|
|
76868
|
+
var c3_default36 = config26;
|
|
76869
|
+
|
|
76870
|
+
// ../wrangler/package.json
|
|
76871
|
+
var version2 = "0.0.0-b8af06128";
|
|
76872
|
+
|
|
76873
|
+
// src/git.ts
|
|
76874
|
+
var offerGit = async (ctx) => {
|
|
76875
|
+
const gitInstalled = await isGitInstalled();
|
|
76876
|
+
if (!gitInstalled) {
|
|
76877
|
+
if (ctx.args.git) {
|
|
76878
|
+
updateStatus(
|
|
76879
|
+
"Couldn't find `git` installed on your machine. Continuing without git."
|
|
76880
|
+
);
|
|
76881
|
+
}
|
|
76882
|
+
ctx.args.git = false;
|
|
76883
|
+
return;
|
|
76884
|
+
}
|
|
76885
|
+
const insideGitRepo = await isInsideGitRepo(ctx.project.path);
|
|
76886
|
+
if (insideGitRepo) {
|
|
76887
|
+
ctx.args.git = true;
|
|
76888
|
+
return;
|
|
76889
|
+
}
|
|
76890
|
+
ctx.args.git = await processArgument(ctx.args, "git", {
|
|
76891
|
+
type: "confirm",
|
|
76892
|
+
question: "Do you want to use git for version control?",
|
|
76893
|
+
label: "git",
|
|
76894
|
+
defaultValue: C3_DEFAULTS.git
|
|
76895
|
+
});
|
|
76896
|
+
if (!ctx.args.git) {
|
|
76897
|
+
return;
|
|
76898
|
+
}
|
|
76899
|
+
const gitConfigured = await isGitConfigured();
|
|
76900
|
+
if (!gitConfigured) {
|
|
76901
|
+
updateStatus(
|
|
76902
|
+
"Must configure `user.name` and user.email` to use git. Continuing without git."
|
|
76903
|
+
);
|
|
76904
|
+
ctx.args.git = false;
|
|
76905
|
+
return;
|
|
76906
|
+
}
|
|
76907
|
+
await initializeGit(ctx.project.path);
|
|
76908
|
+
};
|
|
76909
|
+
var gitCommit = async (ctx) => {
|
|
76910
|
+
const commitMessage = await createCommitMessage(ctx);
|
|
76911
|
+
if (!ctx.args.git) {
|
|
76912
|
+
return;
|
|
76913
|
+
}
|
|
76914
|
+
if (ctx.gitRepoAlreadyExisted) {
|
|
76915
|
+
return;
|
|
76916
|
+
}
|
|
76917
|
+
const gitInstalled = await isGitInstalled();
|
|
76918
|
+
const gitInitialized = await isInsideGitRepo(ctx.project.path);
|
|
76919
|
+
if (!gitInstalled || !gitInitialized) {
|
|
76920
|
+
return;
|
|
76921
|
+
}
|
|
76922
|
+
const s = spinner();
|
|
76923
|
+
s.start("Committing new files");
|
|
76924
|
+
await runCommand(["git", "add", "."], {
|
|
76925
|
+
silent: true,
|
|
76926
|
+
cwd: ctx.project.path
|
|
76927
|
+
});
|
|
76928
|
+
await runCommand(["git", "commit", "-m", commitMessage], {
|
|
76929
|
+
silent: true,
|
|
76930
|
+
cwd: ctx.project.path
|
|
76931
|
+
});
|
|
76932
|
+
s.stop(`${brandColor("git")} ${dim(`commit`)}`);
|
|
76933
|
+
};
|
|
76934
|
+
var createCommitMessage = async (ctx) => {
|
|
76935
|
+
const framework = ctx.template.frameworkCli;
|
|
76936
|
+
const header = framework ? "Initialize web application via create-cloudflare CLI" : "Initial commit (by create-cloudflare CLI)";
|
|
76937
|
+
const packageManager = detectPackageManager();
|
|
76938
|
+
const gitVersion = await getGitVersion();
|
|
76939
|
+
const insideRepo = await isInsideGitRepo(ctx.project.path);
|
|
76940
|
+
const details = [
|
|
76941
|
+
{ key: "C3", value: `create-cloudflare@${version}` },
|
|
76942
|
+
{ key: "project name", value: ctx.project.name },
|
|
76943
|
+
...framework ? [{ key: "framework", value: ctx.template.id }] : [],
|
|
76944
|
+
...framework ? [{ key: "framework cli", value: getFrameworkCli(ctx) }] : [],
|
|
76945
|
+
{
|
|
76946
|
+
key: "package manager",
|
|
76947
|
+
value: `${packageManager.name}@${packageManager.version}`
|
|
76948
|
+
},
|
|
76949
|
+
{
|
|
76950
|
+
key: "wrangler",
|
|
76951
|
+
value: `wrangler@${version2}`
|
|
76952
|
+
},
|
|
76953
|
+
{
|
|
76954
|
+
key: "git",
|
|
76955
|
+
value: insideRepo ? gitVersion : "N/A"
|
|
76956
|
+
}
|
|
76957
|
+
];
|
|
76958
|
+
const body = `Details:
|
|
76959
|
+
${details.map(({ key, value }) => ` ${key} = ${value}`).join("\n")}
|
|
76960
|
+
`;
|
|
76961
|
+
const commitMessage = `${header}
|
|
76962
|
+
|
|
76963
|
+
${body}
|
|
76964
|
+
`;
|
|
76965
|
+
ctx.commitMessage = commitMessage;
|
|
76966
|
+
return commitMessage;
|
|
76967
|
+
};
|
|
76968
|
+
async function getGitVersion() {
|
|
76969
|
+
try {
|
|
76970
|
+
const rawGitVersion = await runCommand(["git", "--version"], {
|
|
76971
|
+
useSpinner: false,
|
|
76972
|
+
silent: true
|
|
76973
|
+
});
|
|
76974
|
+
const gitVersion = rawGitVersion.replace(/^git\s+version\s+/, "");
|
|
76975
|
+
return gitVersion;
|
|
76976
|
+
} catch {
|
|
76977
|
+
return null;
|
|
76978
|
+
}
|
|
76979
|
+
}
|
|
76980
|
+
async function isGitInstalled() {
|
|
76981
|
+
return await getGitVersion() !== null;
|
|
76982
|
+
}
|
|
76983
|
+
async function isGitConfigured() {
|
|
76984
|
+
try {
|
|
76985
|
+
const userName = await runCommand(["git", "config", "user.name"], {
|
|
76986
|
+
useSpinner: false,
|
|
76987
|
+
silent: true
|
|
76988
|
+
});
|
|
76989
|
+
if (!userName) {
|
|
76990
|
+
return false;
|
|
76991
|
+
}
|
|
76992
|
+
const email = await runCommand(["git", "config", "user.email"], {
|
|
76993
|
+
useSpinner: false,
|
|
76994
|
+
silent: true
|
|
76995
|
+
});
|
|
76996
|
+
if (!email) {
|
|
76997
|
+
return false;
|
|
76998
|
+
}
|
|
76999
|
+
return true;
|
|
77000
|
+
} catch {
|
|
77001
|
+
return false;
|
|
77002
|
+
}
|
|
77003
|
+
}
|
|
77004
|
+
async function isInsideGitRepo(cwd) {
|
|
77005
|
+
try {
|
|
77006
|
+
const output = await runCommand(["git", "status"], {
|
|
77007
|
+
cwd,
|
|
77008
|
+
useSpinner: false,
|
|
77009
|
+
silent: true,
|
|
77010
|
+
captureOutput: true
|
|
77011
|
+
});
|
|
77012
|
+
return output.includes("not a git repository") === false;
|
|
77013
|
+
} catch (err) {
|
|
77014
|
+
return false;
|
|
77015
|
+
}
|
|
77016
|
+
}
|
|
77017
|
+
async function initializeGit(cwd) {
|
|
77018
|
+
const s = spinner();
|
|
77019
|
+
s.start("Initializing git repo");
|
|
77020
|
+
try {
|
|
77021
|
+
const defaultBranchName = await runCommand(
|
|
77022
|
+
["git", "config", "--get", "init.defaultBranch"],
|
|
77023
|
+
{ useSpinner: false, silent: true, cwd }
|
|
77024
|
+
);
|
|
77025
|
+
await runCommand(
|
|
77026
|
+
["git", "init", "--initial-branch", defaultBranchName.trim() ?? "main"],
|
|
77027
|
+
// branch names can't contain spaces, so this is safe
|
|
77028
|
+
{ useSpinner: false, silent: true, cwd }
|
|
77029
|
+
);
|
|
77030
|
+
} catch {
|
|
77031
|
+
await runCommand(["git", "init"], { useSpinner: false, silent: true, cwd });
|
|
77032
|
+
} finally {
|
|
77033
|
+
s.stop(`${brandColor("initialized")} ${dim(`git`)}`);
|
|
77034
|
+
}
|
|
77035
|
+
}
|
|
77036
|
+
async function getProductionBranch(cwd) {
|
|
77037
|
+
try {
|
|
77038
|
+
const productionBranch = await runCommand(
|
|
77039
|
+
["git", "branch", "--show-current"],
|
|
77040
|
+
{
|
|
77041
|
+
silent: true,
|
|
77042
|
+
cwd,
|
|
77043
|
+
useSpinner: false,
|
|
77044
|
+
captureOutput: true
|
|
77045
|
+
}
|
|
77046
|
+
);
|
|
77047
|
+
return productionBranch.trim();
|
|
77048
|
+
} catch (err) {
|
|
77049
|
+
}
|
|
77050
|
+
return "main";
|
|
77051
|
+
}
|
|
77025
77052
|
|
|
77026
77053
|
// src/validators.ts
|
|
77027
77054
|
var import_fs10 = require("fs");
|
|
@@ -77117,24 +77144,25 @@ function getFrameworkMap({ experimental = false }) {
|
|
|
77117
77144
|
qwik: c3_default11,
|
|
77118
77145
|
remix: c3_default12,
|
|
77119
77146
|
solid: c3_default13,
|
|
77120
|
-
svelte: c3_default14
|
|
77147
|
+
svelte: c3_default14,
|
|
77148
|
+
vue: c3_default15
|
|
77121
77149
|
};
|
|
77122
77150
|
} else {
|
|
77123
77151
|
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:
|
|
77152
|
+
analog: c3_default16,
|
|
77153
|
+
angular: c3_default17,
|
|
77154
|
+
astro: c3_default18,
|
|
77155
|
+
docusaurus: c3_default20,
|
|
77156
|
+
gatsby: c3_default21,
|
|
77157
|
+
hono: c3_default24,
|
|
77158
|
+
next: c3_default25,
|
|
77159
|
+
nuxt: c3_default26,
|
|
77160
|
+
qwik: c3_default30,
|
|
77161
|
+
react: c3_default31,
|
|
77162
|
+
remix: c3_default32,
|
|
77163
|
+
solid: c3_default34,
|
|
77164
|
+
svelte: c3_default35,
|
|
77165
|
+
vue: c3_default36
|
|
77138
77166
|
};
|
|
77139
77167
|
}
|
|
77140
77168
|
}
|
|
@@ -77147,13 +77175,13 @@ function getTemplateMap({ experimental = false }) {
|
|
|
77147
77175
|
};
|
|
77148
77176
|
} else {
|
|
77149
77177
|
return {
|
|
77150
|
-
"hello-world":
|
|
77151
|
-
common:
|
|
77152
|
-
scheduled:
|
|
77153
|
-
queues:
|
|
77154
|
-
"hello-world-durable-object":
|
|
77155
|
-
openapi:
|
|
77156
|
-
"pre-existing":
|
|
77178
|
+
"hello-world": c3_default23,
|
|
77179
|
+
common: c3_default19,
|
|
77180
|
+
scheduled: c3_default33,
|
|
77181
|
+
queues: c3_default29,
|
|
77182
|
+
"hello-world-durable-object": c3_default22,
|
|
77183
|
+
openapi: c3_default27,
|
|
77184
|
+
"pre-existing": c3_default28
|
|
77157
77185
|
};
|
|
77158
77186
|
}
|
|
77159
77187
|
}
|
|
@@ -77217,6 +77245,10 @@ var createContext = async (args, prevArgs) => {
|
|
|
77217
77245
|
const currentArgs = { ...args };
|
|
77218
77246
|
let linesPrinted = 0;
|
|
77219
77247
|
switch (from) {
|
|
77248
|
+
case "category":
|
|
77249
|
+
linesPrinted = 6;
|
|
77250
|
+
args.projectName = void 0;
|
|
77251
|
+
break;
|
|
77220
77252
|
case "type":
|
|
77221
77253
|
linesPrinted = 9;
|
|
77222
77254
|
args.category = void 0;
|
|
@@ -77250,7 +77282,7 @@ var createContext = async (args, prevArgs) => {
|
|
|
77250
77282
|
type: "text",
|
|
77251
77283
|
question: `In which directory do you want to create your application?`,
|
|
77252
77284
|
helpText: "also used as application name",
|
|
77253
|
-
defaultValue: defaultName,
|
|
77285
|
+
defaultValue: prevArgs?.projectName ?? defaultName,
|
|
77254
77286
|
label: "dir",
|
|
77255
77287
|
validate: (value) => validateProjectDirectory(String(value) || C3_DEFAULTS.projectName, args),
|
|
77256
77288
|
format: (val) => `./${val}`
|
|
@@ -77277,7 +77309,8 @@ var createContext = async (args, prevArgs) => {
|
|
|
77277
77309
|
description: "Start from an existing GitHub repo link"
|
|
77278
77310
|
},
|
|
77279
77311
|
// This is used only if the type is `pre-existing`
|
|
77280
|
-
{ label: "Others", value: "others", hidden: true }
|
|
77312
|
+
{ label: "Others", value: "others", hidden: true },
|
|
77313
|
+
backOption
|
|
77281
77314
|
];
|
|
77282
77315
|
const category = await processArgument(args, "category", {
|
|
77283
77316
|
type: "select",
|
|
@@ -77286,14 +77319,17 @@ var createContext = async (args, prevArgs) => {
|
|
|
77286
77319
|
options: categoryOptions,
|
|
77287
77320
|
defaultValue: prevArgs?.category ?? C3_DEFAULTS.category
|
|
77288
77321
|
});
|
|
77322
|
+
if (category === BACK_VALUE) {
|
|
77323
|
+
return goBack("category");
|
|
77324
|
+
}
|
|
77289
77325
|
let template;
|
|
77290
77326
|
if (category === "web-framework") {
|
|
77291
77327
|
const frameworkMap = getFrameworkMap({
|
|
77292
77328
|
experimental: args.experimental
|
|
77293
77329
|
});
|
|
77294
77330
|
const frameworkOptions = Object.entries(frameworkMap).map(
|
|
77295
|
-
([key,
|
|
77296
|
-
label:
|
|
77331
|
+
([key, config27]) => ({
|
|
77332
|
+
label: config27.displayName,
|
|
77297
77333
|
value: key
|
|
77298
77334
|
})
|
|
77299
77335
|
);
|
|
@@ -77431,28 +77467,28 @@ var processRemoteTemplate = async (args) => {
|
|
|
77431
77467
|
src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
|
|
77432
77468
|
}
|
|
77433
77469
|
const path6 = await downloadRemoteTemplate(src);
|
|
77434
|
-
const
|
|
77435
|
-
validateTemplate(path6,
|
|
77470
|
+
const config27 = inferTemplateConfig(path6);
|
|
77471
|
+
validateTemplate(path6, config27);
|
|
77436
77472
|
updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
|
|
77437
77473
|
return {
|
|
77438
77474
|
path: path6,
|
|
77439
|
-
...
|
|
77475
|
+
...config27
|
|
77440
77476
|
};
|
|
77441
77477
|
};
|
|
77442
|
-
var validateTemplate = (path6,
|
|
77443
|
-
if (!
|
|
77478
|
+
var validateTemplate = (path6, config27) => {
|
|
77479
|
+
if (!config27.copyFiles) {
|
|
77444
77480
|
return;
|
|
77445
77481
|
}
|
|
77446
|
-
if (isVariantInfo(
|
|
77447
|
-
validateTemplateSrcDirectory((0, import_path13.resolve)(path6,
|
|
77482
|
+
if (isVariantInfo(config27.copyFiles)) {
|
|
77483
|
+
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config27.copyFiles.path), config27);
|
|
77448
77484
|
} else {
|
|
77449
|
-
for (const variant of Object.values(
|
|
77450
|
-
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path),
|
|
77485
|
+
for (const variant of Object.values(config27.copyFiles.variants)) {
|
|
77486
|
+
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path), config27);
|
|
77451
77487
|
}
|
|
77452
77488
|
}
|
|
77453
77489
|
};
|
|
77454
|
-
var validateTemplateSrcDirectory = (path6,
|
|
77455
|
-
if (
|
|
77490
|
+
var validateTemplateSrcDirectory = (path6, config27) => {
|
|
77491
|
+
if (config27.platform === "workers") {
|
|
77456
77492
|
const wranglerTomlPath = (0, import_path13.resolve)(path6, "wrangler.toml");
|
|
77457
77493
|
if (!(0, import_fs11.existsSync)(wranglerTomlPath)) {
|
|
77458
77494
|
throw new Error(
|
|
@@ -77904,11 +77940,13 @@ var processArgument = async (args, key, promptConfig) => {
|
|
|
77904
77940
|
disableTelemetry: args[key] !== void 0,
|
|
77905
77941
|
async promise() {
|
|
77906
77942
|
const value = args[key];
|
|
77943
|
+
const error2 = promptConfig.validate?.(value) ?? null;
|
|
77907
77944
|
const result = await inputPrompt({
|
|
77908
77945
|
...promptConfig,
|
|
77909
77946
|
// Accept the default value if the arg is already set
|
|
77910
|
-
acceptDefault: promptConfig.acceptDefault ?? value !== void 0,
|
|
77947
|
+
acceptDefault: promptConfig.acceptDefault ?? (value !== void 0 && !error2),
|
|
77911
77948
|
defaultValue: value ?? promptConfig.defaultValue,
|
|
77949
|
+
initialErrorMessage: error2,
|
|
77912
77950
|
throwOnError: true
|
|
77913
77951
|
});
|
|
77914
77952
|
args[key] = result;
|
|
@@ -77920,6 +77958,9 @@ var processArgument = async (args, key, promptConfig) => {
|
|
|
77920
77958
|
};
|
|
77921
77959
|
|
|
77922
77960
|
// src/deploy.ts
|
|
77961
|
+
var import_promises4 = require("node:fs/promises");
|
|
77962
|
+
var import_node_os5 = require("node:os");
|
|
77963
|
+
var import_node_path5 = require("node:path");
|
|
77923
77964
|
var import_toml2 = __toESM(require_toml());
|
|
77924
77965
|
|
|
77925
77966
|
// src/helpers/poll.ts
|
|
@@ -79153,14 +79194,16 @@ var updateWranglerToml = async (ctx) => {
|
|
|
79153
79194
|
}
|
|
79154
79195
|
} else {
|
|
79155
79196
|
newToml.prepend(
|
|
79156
|
-
`compatibility_date = "${await getWorkerdCompatibilityDate()}"
|
|
79197
|
+
`compatibility_date = "${await getWorkerdCompatibilityDate()}"
|
|
79198
|
+
`
|
|
79157
79199
|
);
|
|
79158
79200
|
}
|
|
79159
79201
|
const nameRe = /^name\s*=.*/m;
|
|
79160
79202
|
if (wranglerToml.match(nameRe)) {
|
|
79161
79203
|
newToml.replace(nameRe, `name = "${ctx.project.name}"`);
|
|
79162
79204
|
} else {
|
|
79163
|
-
newToml.prepend(`name = "${ctx.project.name}"
|
|
79205
|
+
newToml.prepend(`name = "${ctx.project.name}"
|
|
79206
|
+
`);
|
|
79164
79207
|
}
|
|
79165
79208
|
writeWranglerToml(ctx, newToml.toString());
|
|
79166
79209
|
};
|
|
@@ -79182,7 +79225,7 @@ var writeWranglerToml = (ctx, contents) => {
|
|
|
79182
79225
|
|
|
79183
79226
|
// src/deploy.ts
|
|
79184
79227
|
var offerToDeploy = async (ctx) => {
|
|
79185
|
-
const { npm:
|
|
79228
|
+
const { npm: npm23 } = detectPackageManager();
|
|
79186
79229
|
startSection(`Deploy with Cloudflare`, `Step 3 of 3`);
|
|
79187
79230
|
if (!await isDeployable(ctx)) {
|
|
79188
79231
|
ctx.args.deploy = false;
|
|
@@ -79193,7 +79236,7 @@ var offerToDeploy = async (ctx) => {
|
|
|
79193
79236
|
);
|
|
79194
79237
|
}
|
|
79195
79238
|
const label = `deploy via \`${quoteShellArgs([
|
|
79196
|
-
|
|
79239
|
+
npm23,
|
|
79197
79240
|
"run",
|
|
79198
79241
|
ctx.template.deployScript ?? "deploy"
|
|
79199
79242
|
])}\``;
|
|
@@ -79223,11 +79266,11 @@ var isDeployable = async (ctx) => {
|
|
|
79223
79266
|
return !hasBinding(wranglerToml);
|
|
79224
79267
|
};
|
|
79225
79268
|
var runDeploy = async (ctx) => {
|
|
79226
|
-
const { npm:
|
|
79269
|
+
const { npm: npm23, name: pm4 } = detectPackageManager();
|
|
79227
79270
|
if (!ctx.account?.id) {
|
|
79228
79271
|
throw new Error("Failed to read Cloudflare account.");
|
|
79229
79272
|
}
|
|
79230
|
-
const baseDeployCmd = [
|
|
79273
|
+
const baseDeployCmd = [npm23, "run", ctx.template.deployScript ?? "deploy"];
|
|
79231
79274
|
const insideGitRepo = await isInsideGitRepo(ctx.project.path);
|
|
79232
79275
|
const deployCmd = [
|
|
79233
79276
|
...baseDeployCmd,
|
|
@@ -79238,23 +79281,34 @@ var runDeploy = async (ctx) => {
|
|
|
79238
79281
|
JSON.stringify(ctx.commitMessage)
|
|
79239
79282
|
] : []
|
|
79240
79283
|
];
|
|
79241
|
-
const
|
|
79242
|
-
|
|
79284
|
+
const outputFile = (0, import_node_path5.join)(
|
|
79285
|
+
await (0, import_promises4.mkdtemp)((0, import_node_path5.join)((0, import_node_os5.tmpdir)(), "c3-wrangler-deploy-")),
|
|
79286
|
+
"output.json"
|
|
79287
|
+
);
|
|
79288
|
+
await runCommand(deployCmd, {
|
|
79243
79289
|
cwd: ctx.project.path,
|
|
79244
79290
|
env: {
|
|
79245
79291
|
CLOUDFLARE_ACCOUNT_ID: ctx.account.id,
|
|
79246
|
-
NODE_ENV: "production"
|
|
79292
|
+
NODE_ENV: "production",
|
|
79293
|
+
WRANGLER_OUTPUT_FILE_PATH: outputFile
|
|
79247
79294
|
},
|
|
79248
79295
|
startText: "Deploying your application",
|
|
79249
79296
|
doneText: `${brandColor("deployed")} ${dim(
|
|
79250
79297
|
`via \`${quoteShellArgs(baseDeployCmd)}\``
|
|
79251
79298
|
)}`
|
|
79252
79299
|
});
|
|
79253
|
-
|
|
79254
|
-
|
|
79255
|
-
|
|
79256
|
-
|
|
79257
|
-
|
|
79300
|
+
try {
|
|
79301
|
+
const contents = readFile(outputFile);
|
|
79302
|
+
const entries = contents.split("\n").filter(Boolean).map((entry) => JSON.parse(entry));
|
|
79303
|
+
const url = entries.find((entry) => entry.type === "deploy")?.targets?.[0] ?? entries.find((entry) => entry.type === "pages-deploy")?.url;
|
|
79304
|
+
const deployedUrlRegex = /https:\/\/.+\.(pages|workers)\.dev/;
|
|
79305
|
+
const deployedUrlMatch = url?.match(deployedUrlRegex);
|
|
79306
|
+
if (deployedUrlMatch) {
|
|
79307
|
+
ctx.deployment.url = deployedUrlMatch[0];
|
|
79308
|
+
} else {
|
|
79309
|
+
throw new Error("Failed to find deployment url.");
|
|
79310
|
+
}
|
|
79311
|
+
} catch {
|
|
79258
79312
|
throw new Error("Failed to find deployment url.");
|
|
79259
79313
|
}
|
|
79260
79314
|
if (ctx.deployment.url?.endsWith(".pages.dev")) {
|
|
@@ -79306,16 +79360,22 @@ function createDialog(lines) {
|
|
|
79306
79360
|
""
|
|
79307
79361
|
].join("\n");
|
|
79308
79362
|
}
|
|
79309
|
-
function printWelcomeMessage(version3, telemetryEnabled) {
|
|
79363
|
+
function printWelcomeMessage(version3, telemetryEnabled, args) {
|
|
79310
79364
|
const lines = [
|
|
79311
79365
|
`\u{1F44B} Welcome to create-cloudflare v${version3}!`,
|
|
79312
79366
|
`\u{1F9E1} Let's get started.`
|
|
79313
79367
|
];
|
|
79368
|
+
if (args.experimental) {
|
|
79369
|
+
lines.push("", blue`🧪 Running in experimental mode`);
|
|
79370
|
+
}
|
|
79314
79371
|
if (telemetryEnabled) {
|
|
79372
|
+
if (args.experimental) {
|
|
79373
|
+
lines.push("");
|
|
79374
|
+
}
|
|
79315
79375
|
const telemetryDocsUrl = `https://github.com/cloudflare/workers-sdk/blob/main/packages/create-cloudflare/telemetry.md`;
|
|
79316
79376
|
lines.push(
|
|
79317
79377
|
`\u{1F4CA} Cloudflare collects telemetry about your usage of Create-Cloudflare.`,
|
|
79318
|
-
|
|
79378
|
+
"",
|
|
79319
79379
|
`Learn more at: ${blue.underline(hyperlink(telemetryDocsUrl))}`
|
|
79320
79380
|
);
|
|
79321
79381
|
}
|
|
@@ -79326,19 +79386,20 @@ var printSummary = (ctx) => {
|
|
|
79326
79386
|
const dashboardUrl = ctx.account ? `https://dash.cloudflare.com/?to=/:account/workers/services/view/${ctx.project.name}` : null;
|
|
79327
79387
|
const relativePath = (0, import_path15.relative)(ctx.originalCWD, ctx.project.path);
|
|
79328
79388
|
const cdCommand = relativePath ? `cd ${relativePath}` : null;
|
|
79329
|
-
const { npm:
|
|
79389
|
+
const { npm: npm23 } = detectPackageManager();
|
|
79330
79390
|
const devServerCommand = quoteShellArgs([
|
|
79331
|
-
|
|
79391
|
+
npm23,
|
|
79332
79392
|
"run",
|
|
79333
79393
|
ctx.template.devScript ?? "start"
|
|
79334
79394
|
]);
|
|
79335
79395
|
const deployCommand = quoteShellArgs([
|
|
79336
|
-
|
|
79396
|
+
npm23,
|
|
79337
79397
|
"run",
|
|
79338
79398
|
ctx.template.deployScript ?? "deploy"
|
|
79339
79399
|
]);
|
|
79340
79400
|
const documentationUrl = `https://developers.cloudflare.com/${ctx.template.platform}`;
|
|
79341
79401
|
const discordUrl = `https://discord.cloudflare.com`;
|
|
79402
|
+
const reportIssueUrl = "https://github.com/cloudflare/workers-sdk/issues/new/choose";
|
|
79342
79403
|
const lines = [
|
|
79343
79404
|
`\u{1F389} ${bgGreen(" SUCCESS ")} Application ${ctx.deployment.url ? "deployed" : "created"} successfully!`,
|
|
79344
79405
|
``
|
|
@@ -79360,6 +79421,9 @@ var printSummary = (ctx) => {
|
|
|
79360
79421
|
`\u{1F4D6} Explore Documentation`,
|
|
79361
79422
|
`${blue.underline(hyperlink(documentationUrl))}`,
|
|
79362
79423
|
``,
|
|
79424
|
+
`\u{1F41B} Report an Issue`,
|
|
79425
|
+
`${blue.underline(hyperlink(reportIssueUrl))}`,
|
|
79426
|
+
``,
|
|
79363
79427
|
`\u{1F4AC} Join our Community`,
|
|
79364
79428
|
`${blue.underline(hyperlink(discordUrl))}`
|
|
79365
79429
|
);
|
|
@@ -79697,8 +79761,8 @@ var renderValues = (values) => {
|
|
|
79697
79761
|
};
|
|
79698
79762
|
|
|
79699
79763
|
// src/helpers/retry.ts
|
|
79700
|
-
var retry = async (
|
|
79701
|
-
let { times } =
|
|
79764
|
+
var retry = async (config27, fn) => {
|
|
79765
|
+
let { times } = config27;
|
|
79702
79766
|
let error2 = null;
|
|
79703
79767
|
while (times > 0) {
|
|
79704
79768
|
try {
|
|
@@ -79706,10 +79770,10 @@ var retry = async (config26, fn) => {
|
|
|
79706
79770
|
} catch (e) {
|
|
79707
79771
|
error2 = e;
|
|
79708
79772
|
times--;
|
|
79709
|
-
if (
|
|
79773
|
+
if (config27.exitCondition?.(e)) {
|
|
79710
79774
|
break;
|
|
79711
79775
|
}
|
|
79712
|
-
await sleep(
|
|
79776
|
+
await sleep(config27.sleepMs ?? 1e3);
|
|
79713
79777
|
}
|
|
79714
79778
|
}
|
|
79715
79779
|
throw error2;
|
|
@@ -81106,14 +81170,14 @@ function applyEdits(text, edits) {
|
|
|
81106
81170
|
|
|
81107
81171
|
// src/workers.ts
|
|
81108
81172
|
async function installWorkersTypes(ctx) {
|
|
81109
|
-
const { npm:
|
|
81173
|
+
const { npm: npm23 } = detectPackageManager();
|
|
81110
81174
|
if (!usesTypescript(ctx)) {
|
|
81111
81175
|
return;
|
|
81112
81176
|
}
|
|
81113
81177
|
await installPackages(["@cloudflare/workers-types"], {
|
|
81114
81178
|
dev: true,
|
|
81115
81179
|
startText: "Installing @cloudflare/workers-types",
|
|
81116
|
-
doneText: `${brandColor("installed")} ${dim(`via ${
|
|
81180
|
+
doneText: `${brandColor("installed")} ${dim(`via ${npm23}`)}`
|
|
81117
81181
|
});
|
|
81118
81182
|
await addWorkersTypesToTsConfig(ctx);
|
|
81119
81183
|
}
|
|
@@ -81136,8 +81200,8 @@ async function addWorkersTypesToTsConfig(ctx) {
|
|
|
81136
81200
|
}
|
|
81137
81201
|
const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`;
|
|
81138
81202
|
try {
|
|
81139
|
-
const
|
|
81140
|
-
const currentTypes =
|
|
81203
|
+
const config27 = parse3(tsconfig);
|
|
81204
|
+
const currentTypes = config27.compilerOptions?.types ?? [];
|
|
81141
81205
|
const explicitEntrypoint = currentTypes.some(
|
|
81142
81206
|
(t) => t.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/)
|
|
81143
81207
|
);
|
|
@@ -81167,7 +81231,7 @@ async function addWorkersTypesToTsConfig(ctx) {
|
|
|
81167
81231
|
}
|
|
81168
81232
|
|
|
81169
81233
|
// src/cli.ts
|
|
81170
|
-
var { npm:
|
|
81234
|
+
var { npm: npm22 } = detectPackageManager();
|
|
81171
81235
|
var main = async (argv) => {
|
|
81172
81236
|
const result = await parseArgs(argv);
|
|
81173
81237
|
if (result.type === "unknown") {
|
|
@@ -81203,13 +81267,13 @@ ${result.errorMessage}`);
|
|
|
81203
81267
|
};
|
|
81204
81268
|
var runLatest = async () => {
|
|
81205
81269
|
const args = process.argv.slice(2);
|
|
81206
|
-
if (
|
|
81270
|
+
if (npm22 === "npm") {
|
|
81207
81271
|
args.unshift("--");
|
|
81208
81272
|
}
|
|
81209
|
-
await runCommand([
|
|
81273
|
+
await runCommand([npm22, "create", "cloudflare@latest", ...args]);
|
|
81210
81274
|
};
|
|
81211
81275
|
var runCli = async (args) => {
|
|
81212
|
-
printBanner();
|
|
81276
|
+
printBanner(args);
|
|
81213
81277
|
const ctx = await createContext(args);
|
|
81214
81278
|
await create(ctx);
|
|
81215
81279
|
await configure19(ctx);
|
|
@@ -81263,8 +81327,8 @@ var deploy = async (ctx) => {
|
|
|
81263
81327
|
await maybeOpenBrowser(ctx);
|
|
81264
81328
|
endSection("Done");
|
|
81265
81329
|
};
|
|
81266
|
-
var printBanner = () => {
|
|
81267
|
-
printWelcomeMessage(version, reporter.isEnabled);
|
|
81330
|
+
var printBanner = (args) => {
|
|
81331
|
+
printWelcomeMessage(version, reporter.isEnabled, args);
|
|
81268
81332
|
startSection(`Create an application with Cloudflare`, "Step 1 of 3");
|
|
81269
81333
|
};
|
|
81270
81334
|
main(process.argv).catch((e) => {
|