@donotdev/cli 0.2.2 → 0.2.3
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/dependencies-matrix.json +39 -38
- package/dist/bin/commands/agent-setup.js +135 -67
- package/dist/bin/commands/build.js +288 -232
- package/dist/bin/commands/bump.js +293 -250
- package/dist/bin/commands/cacheout.js +59 -49
- package/dist/bin/commands/coach.js +80 -50
- package/dist/bin/commands/create-app.js +501 -228
- package/dist/bin/commands/create-project.js +377 -241
- package/dist/bin/commands/db.js +1873 -1804
- package/dist/bin/commands/deploy.js +476 -287
- package/dist/bin/commands/dev.js +139 -108
- package/dist/bin/commands/doctor.js +91 -57
- package/dist/bin/commands/emu.js +196 -154
- package/dist/bin/commands/format.js +83 -50
- package/dist/bin/commands/get-demo.js +422 -197
- package/dist/bin/commands/make-admin.js +813 -707
- package/dist/bin/commands/preview.js +139 -108
- package/dist/bin/commands/seed.js +1874 -1809
- package/dist/bin/commands/setup-cicd.js +258 -204
- package/dist/bin/commands/setup.js +346 -247
- package/dist/bin/commands/staging.js +476 -287
- package/dist/bin/commands/sync-secrets.js +472 -141
- package/dist/bin/commands/type-check.js +163 -119
- package/dist/bin/commands/wai.js +53 -46
- package/dist/bin/dndev.js +10 -1
- package/dist/bin/donotdev.js +18 -8
- package/dist/index.js +590 -373
- package/package.json +2 -2
- package/templates/app-dndev/src/pages/legal/LegalNoticePage.tsx.example +1 -1
- package/templates/app-dndev/src/pages/legal/PrivacyPage.tsx.example +1 -1
- package/templates/app-dndev/src/pages/legal/TermsPage.tsx.example +1 -1
- package/templates/app-next/src/app/AppDocument.tsx.example +57 -0
- package/templates/app-next/src/app/ClientLayout.tsx.example +6 -2
- package/templates/app-next/src/pages/legal/LegalNoticePage.tsx.example +1 -1
- package/templates/app-next/src/pages/legal/PrivacyPage.tsx.example +1 -1
- package/templates/app-next/src/pages/legal/TermsPage.tsx.example +1 -1
- package/templates/app-vite/src/pages/FormPageExample.tsx.example +21 -16
- package/templates/app-vite/src/pages/legal/LegalNoticePage.tsx.example +1 -1
- package/templates/app-vite/src/pages/legal/PrivacyPage.tsx.example +1 -1
- package/templates/app-vite/src/pages/legal/TermsPage.tsx.example +1 -1
- package/templates/overlay-supabase/src/config/providers.nextjs.ts.example +37 -0
- package/templates/root-consumer/.claude/hooks/guard-write.sh.example +5 -1
- package/templates/root-consumer/.gitignore.example +7 -1
- package/templates/app-next/src/app/layout.tsx.example +0 -80
- package/templates/app-next/src/app/not-found.tsx.example +0 -40
package/dist/index.js
CHANGED
|
@@ -143,7 +143,7 @@ var init_dist = __esm({
|
|
|
143
143
|
if (index >= length) {
|
|
144
144
|
break outer;
|
|
145
145
|
}
|
|
146
|
-
for (let i2 = 0,
|
|
146
|
+
for (let i2 = 0, l = PARSE_BLOCKS.length; i2 < l; i2++) {
|
|
147
147
|
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
|
|
148
148
|
BLOCK_RE.lastIndex = index;
|
|
149
149
|
if (BLOCK_RE.test(input)) {
|
|
@@ -409,25 +409,29 @@ var init_main = __esm({
|
|
|
409
409
|
}
|
|
410
410
|
});
|
|
411
411
|
|
|
412
|
-
// node_modules/.bun/sisteransi@
|
|
413
|
-
var
|
|
414
|
-
|
|
415
|
-
|
|
412
|
+
// node_modules/.bun/sisteransi@2.0.0/node_modules/sisteransi/dist/index.js
|
|
413
|
+
var ESC2, CSI2, cursor, erase, clear;
|
|
414
|
+
var init_dist3 = __esm({
|
|
415
|
+
"node_modules/.bun/sisteransi@2.0.0/node_modules/sisteransi/dist/index.js"() {
|
|
416
416
|
init_utils2();
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
return `${CSI2}${
|
|
417
|
+
ESC2 = "\x1B";
|
|
418
|
+
CSI2 = `${ESC2}[`;
|
|
419
|
+
cursor = {
|
|
420
|
+
to(x, y) {
|
|
421
|
+
if (!y)
|
|
422
|
+
return `${CSI2}${x + 1}G`;
|
|
423
|
+
return `${CSI2}${y + 1};${x + 1}H`;
|
|
424
424
|
},
|
|
425
|
-
move(x,
|
|
425
|
+
move(x, y) {
|
|
426
426
|
let ret = "";
|
|
427
|
-
if (x < 0)
|
|
428
|
-
|
|
429
|
-
if (
|
|
430
|
-
|
|
427
|
+
if (x < 0)
|
|
428
|
+
ret += `${CSI2}${-x}D`;
|
|
429
|
+
else if (x > 0)
|
|
430
|
+
ret += `${CSI2}${x}C`;
|
|
431
|
+
if (y < 0)
|
|
432
|
+
ret += `${CSI2}${-y}A`;
|
|
433
|
+
else if (y > 0)
|
|
434
|
+
ret += `${CSI2}${y}B`;
|
|
431
435
|
return ret;
|
|
432
436
|
},
|
|
433
437
|
up: (count = 1) => `${CSI2}${count}A`,
|
|
@@ -442,11 +446,7 @@ var require_src = __commonJS({
|
|
|
442
446
|
save: `${ESC2}7`,
|
|
443
447
|
restore: `${ESC2}8`
|
|
444
448
|
};
|
|
445
|
-
|
|
446
|
-
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
447
|
-
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
448
|
-
};
|
|
449
|
-
var erase3 = {
|
|
449
|
+
erase = {
|
|
450
450
|
screen: `${CSI2}2J`,
|
|
451
451
|
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
452
452
|
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
@@ -454,29 +454,31 @@ var require_src = __commonJS({
|
|
|
454
454
|
lineEnd: `${CSI2}K`,
|
|
455
455
|
lineStart: `${CSI2}1K`,
|
|
456
456
|
lines(count) {
|
|
457
|
-
let
|
|
457
|
+
let clear2 = "";
|
|
458
458
|
for (let i2 = 0; i2 < count; i2++)
|
|
459
|
-
|
|
459
|
+
clear2 += this.line + (i2 < count - 1 ? cursor.up() : "");
|
|
460
460
|
if (count)
|
|
461
|
-
|
|
462
|
-
return
|
|
461
|
+
clear2 += cursor.left;
|
|
462
|
+
return clear2;
|
|
463
463
|
}
|
|
464
464
|
};
|
|
465
|
-
|
|
465
|
+
clear = {
|
|
466
|
+
screen: `${ESC2}c`
|
|
467
|
+
};
|
|
466
468
|
}
|
|
467
469
|
});
|
|
468
470
|
|
|
469
|
-
// node_modules/.bun/@clack+core@1.
|
|
471
|
+
// node_modules/.bun/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs
|
|
470
472
|
import { styleText } from "node:util";
|
|
471
473
|
import { stdout, stdin } from "node:process";
|
|
472
|
-
import * as
|
|
473
|
-
import
|
|
474
|
+
import * as f$1 from "node:readline";
|
|
475
|
+
import f__default from "node:readline";
|
|
474
476
|
import { ReadStream } from "node:tty";
|
|
475
|
-
function findCursor(
|
|
476
|
-
if (!
|
|
477
|
-
return
|
|
478
|
-
const t2 =
|
|
479
|
-
return
|
|
477
|
+
function findCursor(o, s, l) {
|
|
478
|
+
if (!l.some((r2) => !r2.disabled))
|
|
479
|
+
return o;
|
|
480
|
+
const t2 = o + s, n3 = Math.max(l.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
|
|
481
|
+
return l[e]?.disabled ? findCursor(e, s < 0 ? -1 : 1, l) : e;
|
|
480
482
|
}
|
|
481
483
|
function isAccessible(n3) {
|
|
482
484
|
if (n3 !== void 0) return n3;
|
|
@@ -519,40 +521,40 @@ function block({
|
|
|
519
521
|
overwrite: o = true,
|
|
520
522
|
hideCursor: n3 = true
|
|
521
523
|
} = {}) {
|
|
522
|
-
const s =
|
|
524
|
+
const s = f$1.createInterface({
|
|
523
525
|
input: e,
|
|
524
526
|
output: r2,
|
|
525
527
|
prompt: "",
|
|
526
528
|
tabSize: 1
|
|
527
529
|
});
|
|
528
|
-
|
|
529
|
-
const t2 = (
|
|
530
|
-
const
|
|
531
|
-
if (isActionKey([
|
|
532
|
-
n3 && r2.write(
|
|
530
|
+
f$1.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
|
|
531
|
+
const t2 = (l, { name: i2, sequence: p }) => {
|
|
532
|
+
const w = String(l);
|
|
533
|
+
if (isActionKey([w, i2, p], "cancel")) {
|
|
534
|
+
n3 && r2.write(cursor.show), process.exit(0);
|
|
533
535
|
return;
|
|
534
536
|
}
|
|
535
537
|
if (!o) return;
|
|
536
|
-
const
|
|
537
|
-
|
|
538
|
-
|
|
538
|
+
const c3 = i2 === "return" ? 0 : -1, a2 = i2 === "return" ? -1 : 0;
|
|
539
|
+
f$1.moveCursor(r2, c3, a2, () => {
|
|
540
|
+
f$1.clearLine(r2, 1, () => {
|
|
539
541
|
e.once("keypress", t2);
|
|
540
542
|
});
|
|
541
543
|
});
|
|
542
544
|
};
|
|
543
|
-
return n3 && r2.write(
|
|
544
|
-
e.off("keypress", t2), n3 && r2.write(
|
|
545
|
+
return n3 && r2.write(cursor.hide), e.once("keypress", t2), () => {
|
|
546
|
+
e.off("keypress", t2), n3 && r2.write(cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
|
|
545
547
|
};
|
|
546
548
|
}
|
|
547
549
|
function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
|
|
548
|
-
const
|
|
549
|
-
return wrapAnsi(r2,
|
|
550
|
+
const l = getColumns(e ?? stdout), i2 = dist_default2(o);
|
|
551
|
+
return wrapAnsi(r2, l - i2, {
|
|
550
552
|
hard: true,
|
|
551
553
|
trim: false
|
|
552
554
|
}).split(`
|
|
553
|
-
`).map((
|
|
554
|
-
const
|
|
555
|
-
return
|
|
555
|
+
`).map((c3, a2, g) => {
|
|
556
|
+
const m2 = t2 ? t2(c3, a2) : c3;
|
|
557
|
+
return a2 === 0 ? `${n3}${m2}` : a2 === g.length - 1 ? `${s}${m2}` : `${o}${m2}`;
|
|
556
558
|
}).join(`
|
|
557
559
|
`);
|
|
558
560
|
}
|
|
@@ -563,12 +565,13 @@ function runValidation(e, a2) {
|
|
|
563
565
|
}
|
|
564
566
|
return e(a2);
|
|
565
567
|
}
|
|
566
|
-
var
|
|
567
|
-
var
|
|
568
|
-
"node_modules/.bun/@clack+core@1.
|
|
568
|
+
var a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, C$1, r, a, n$1, n2;
|
|
569
|
+
var init_dist4 = __esm({
|
|
570
|
+
"node_modules/.bun/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs"() {
|
|
569
571
|
init_utils2();
|
|
570
572
|
init_main();
|
|
571
|
-
|
|
573
|
+
init_dist3();
|
|
574
|
+
init_dist2();
|
|
572
575
|
a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
573
576
|
t = [
|
|
574
577
|
"January",
|
|
@@ -617,7 +620,7 @@ var init_dist3 = __esm({
|
|
|
617
620
|
CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
|
|
618
621
|
getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
619
622
|
getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
620
|
-
|
|
623
|
+
C$1 = class C {
|
|
621
624
|
input;
|
|
622
625
|
output;
|
|
623
626
|
_abortSignal;
|
|
@@ -699,16 +702,16 @@ var init_dist3 = __esm({
|
|
|
699
702
|
{ once: true }
|
|
700
703
|
);
|
|
701
704
|
}
|
|
702
|
-
this.rl =
|
|
705
|
+
this.rl = f__default.createInterface({
|
|
703
706
|
input: this.input,
|
|
704
707
|
tabSize: 2,
|
|
705
708
|
prompt: "",
|
|
706
709
|
escapeCodeTimeout: 50,
|
|
707
710
|
terminal: true
|
|
708
711
|
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
709
|
-
this.output.write(
|
|
712
|
+
this.output.write(cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
710
713
|
}), this.once("cancel", () => {
|
|
711
|
-
this.output.write(
|
|
714
|
+
this.output.write(cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
712
715
|
});
|
|
713
716
|
});
|
|
714
717
|
}
|
|
@@ -745,18 +748,18 @@ var init_dist3 = __esm({
|
|
|
745
748
|
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
746
749
|
}
|
|
747
750
|
restoreCursor() {
|
|
748
|
-
const t2 = wrapAnsi(this._prevFrame,
|
|
751
|
+
const t2 = wrapAnsi(this._prevFrame, getColumns(this.output), { hard: true, trim: false }).split(`
|
|
749
752
|
`).length - 1;
|
|
750
|
-
this.output.write(
|
|
753
|
+
this.output.write(cursor.move(-999, t2 * -1));
|
|
751
754
|
}
|
|
752
755
|
render() {
|
|
753
|
-
const t2 = wrapAnsi(this._render(this) ?? "",
|
|
756
|
+
const t2 = wrapAnsi(this._render(this) ?? "", getColumns(this.output), {
|
|
754
757
|
hard: true,
|
|
755
758
|
trim: false
|
|
756
759
|
});
|
|
757
760
|
if (t2 !== this._prevFrame) {
|
|
758
761
|
if (this.state === "initial")
|
|
759
|
-
this.output.write(
|
|
762
|
+
this.output.write(cursor.hide);
|
|
760
763
|
else {
|
|
761
764
|
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
762
765
|
if (this.restoreCursor(), e) {
|
|
@@ -767,33 +770,33 @@ var init_dist3 = __esm({
|
|
|
767
770
|
return;
|
|
768
771
|
}
|
|
769
772
|
if (e.lines.length === 1) {
|
|
770
|
-
this.output.write(
|
|
773
|
+
this.output.write(cursor.move(0, n3 - r2)), this.output.write(erase.lines(1));
|
|
771
774
|
const o = t2.split(`
|
|
772
775
|
`);
|
|
773
|
-
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(
|
|
776
|
+
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(cursor.move(0, o.length - n3 - 1));
|
|
774
777
|
return;
|
|
775
778
|
} else if (e.lines.length > 1) {
|
|
776
779
|
if (s < r2)
|
|
777
780
|
n3 = s;
|
|
778
781
|
else {
|
|
779
782
|
const h2 = n3 - r2;
|
|
780
|
-
h2 > 0 && this.output.write(
|
|
783
|
+
h2 > 0 && this.output.write(cursor.move(0, h2));
|
|
781
784
|
}
|
|
782
|
-
this.output.write(
|
|
783
|
-
const
|
|
785
|
+
this.output.write(erase.down());
|
|
786
|
+
const m2 = t2.split(`
|
|
784
787
|
`).slice(n3);
|
|
785
|
-
this.output.write(
|
|
788
|
+
this.output.write(m2.join(`
|
|
786
789
|
`)), this._prevFrame = t2;
|
|
787
790
|
return;
|
|
788
791
|
}
|
|
789
792
|
}
|
|
790
|
-
this.output.write(
|
|
793
|
+
this.output.write(erase.down());
|
|
791
794
|
}
|
|
792
795
|
this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
|
|
793
796
|
}
|
|
794
797
|
}
|
|
795
798
|
};
|
|
796
|
-
r = class extends
|
|
799
|
+
r = class extends C$1 {
|
|
797
800
|
get cursor() {
|
|
798
801
|
return this.value ? 0 : 1;
|
|
799
802
|
}
|
|
@@ -804,13 +807,13 @@ var init_dist3 = __esm({
|
|
|
804
807
|
super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
|
|
805
808
|
this.value = this._value;
|
|
806
809
|
}), this.on("confirm", (i2) => {
|
|
807
|
-
this.output.write(
|
|
810
|
+
this.output.write(cursor.move(0, -1)), this.value = i2, this.state = "submit", this.close();
|
|
808
811
|
}), this.on("cursor", () => {
|
|
809
812
|
this.value = !this.value;
|
|
810
813
|
});
|
|
811
814
|
}
|
|
812
815
|
};
|
|
813
|
-
a = class extends
|
|
816
|
+
a = class extends C$1 {
|
|
814
817
|
options;
|
|
815
818
|
cursor = 0;
|
|
816
819
|
get _value() {
|
|
@@ -841,8 +844,8 @@ var init_dist3 = __esm({
|
|
|
841
844
|
this.options.findIndex(({ value: t2 }) => t2 === e.cursorAt),
|
|
842
845
|
0
|
|
843
846
|
);
|
|
844
|
-
this.cursor = this.options[i2]?.disabled ? findCursor(i2, 1, this.options) : i2, this.on("key", (t2,
|
|
845
|
-
|
|
847
|
+
this.cursor = this.options[i2]?.disabled ? findCursor(i2, 1, this.options) : i2, this.on("key", (t2, s) => {
|
|
848
|
+
s.name === "a" && this.toggleAll(), s.name === "i" && this.toggleInvert(), s.name === void 0 && t2 === "\u3000" && this.toggleValue();
|
|
846
849
|
}), this.on("cursor", (t2) => {
|
|
847
850
|
switch (t2) {
|
|
848
851
|
case "left":
|
|
@@ -860,7 +863,7 @@ var init_dist3 = __esm({
|
|
|
860
863
|
});
|
|
861
864
|
}
|
|
862
865
|
};
|
|
863
|
-
n$1 = class n extends
|
|
866
|
+
n$1 = class n extends C$1 {
|
|
864
867
|
options;
|
|
865
868
|
cursor = 0;
|
|
866
869
|
get _selectedValue() {
|
|
@@ -888,7 +891,7 @@ var init_dist3 = __esm({
|
|
|
888
891
|
});
|
|
889
892
|
}
|
|
890
893
|
};
|
|
891
|
-
n2 = class extends
|
|
894
|
+
n2 = class extends C$1 {
|
|
892
895
|
get userInputWithCursor() {
|
|
893
896
|
if (this.state === "submit")
|
|
894
897
|
return this.userInput;
|
|
@@ -915,7 +918,7 @@ var init_dist3 = __esm({
|
|
|
915
918
|
}
|
|
916
919
|
});
|
|
917
920
|
|
|
918
|
-
// node_modules/.bun/@clack+prompts@1.
|
|
921
|
+
// node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs
|
|
919
922
|
import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
920
923
|
import process$1 from "node:process";
|
|
921
924
|
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
@@ -926,22 +929,23 @@ function isUnicodeSupported() {
|
|
|
926
929
|
}
|
|
927
930
|
return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
928
931
|
}
|
|
929
|
-
function formatInstructionFooter(o,
|
|
930
|
-
const
|
|
931
|
-
|
|
932
|
+
function formatInstructionFooter(e, o, r2) {
|
|
933
|
+
const s = r2 ? `${styleText2("cyan", S_BAR)} ` : "", n3 = wrapTextWithPrefix(e, o.join(" \u2022 "), s).split(`
|
|
934
|
+
`);
|
|
935
|
+
return r2 && n3.push(styleText2("cyan", S_BAR_END)), n3;
|
|
932
936
|
}
|
|
933
|
-
var
|
|
934
|
-
var
|
|
935
|
-
"node_modules/.bun/@clack+prompts@1.
|
|
937
|
+
var unicode, isCI, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol, symbolBar, E$1, limitOptions, confirm, MULTISELECT_INSTRUCTIONS, m, multiselect, log, cancel, intro, outro, W, C2, note, Y, Z, spinner, u2, SELECT_INSTRUCTIONS, c2, select, i, text;
|
|
938
|
+
var init_dist5 = __esm({
|
|
939
|
+
"node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs"() {
|
|
936
940
|
init_utils2();
|
|
937
|
-
|
|
938
|
-
|
|
941
|
+
init_dist4();
|
|
942
|
+
init_dist4();
|
|
939
943
|
init_main();
|
|
940
944
|
init_dist2();
|
|
941
|
-
|
|
945
|
+
init_dist3();
|
|
942
946
|
unicode = isUnicodeSupported();
|
|
943
947
|
isCI = () => process.env.CI === "true";
|
|
944
|
-
unicodeOr = (
|
|
948
|
+
unicodeOr = (e, o) => unicode ? e : o;
|
|
945
949
|
S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
946
950
|
S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
947
951
|
S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
@@ -967,8 +971,8 @@ var init_dist4 = __esm({
|
|
|
967
971
|
S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
968
972
|
S_WARN = unicodeOr("\u25B2", "!");
|
|
969
973
|
S_ERROR = unicodeOr("\u25A0", "x");
|
|
970
|
-
symbol = (
|
|
971
|
-
switch (
|
|
974
|
+
symbol = (e) => {
|
|
975
|
+
switch (e) {
|
|
972
976
|
case "initial":
|
|
973
977
|
case "active":
|
|
974
978
|
return styleText2("cyan", S_STEP_ACTIVE);
|
|
@@ -982,8 +986,8 @@ var init_dist4 = __esm({
|
|
|
982
986
|
return styleText2("dim", S_STEP_ACTIVE);
|
|
983
987
|
}
|
|
984
988
|
};
|
|
985
|
-
symbolBar = (
|
|
986
|
-
switch (
|
|
989
|
+
symbolBar = (e) => {
|
|
990
|
+
switch (e) {
|
|
987
991
|
case "initial":
|
|
988
992
|
case "active":
|
|
989
993
|
return styleText2("cyan", S_BAR);
|
|
@@ -995,45 +999,45 @@ var init_dist4 = __esm({
|
|
|
995
999
|
return styleText2("green", S_BAR);
|
|
996
1000
|
}
|
|
997
1001
|
};
|
|
998
|
-
|
|
1002
|
+
E$1 = (l, e, w, p, b, C3 = false) => {
|
|
999
1003
|
let r2 = e, O = 0;
|
|
1000
|
-
if (
|
|
1004
|
+
if (C3)
|
|
1001
1005
|
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
1002
|
-
const m2 =
|
|
1006
|
+
const m2 = l[i2];
|
|
1003
1007
|
if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
|
|
1004
1008
|
}
|
|
1005
1009
|
else
|
|
1006
1010
|
for (let i2 = w; i2 < p; i2++) {
|
|
1007
|
-
const m2 =
|
|
1011
|
+
const m2 = l[i2];
|
|
1008
1012
|
if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
|
|
1009
1013
|
}
|
|
1010
1014
|
return { lineCount: r2, removals: O };
|
|
1011
1015
|
};
|
|
1012
1016
|
limitOptions = ({
|
|
1013
|
-
cursor:
|
|
1017
|
+
cursor: l,
|
|
1014
1018
|
options: e,
|
|
1015
1019
|
style: w,
|
|
1016
1020
|
output: p = process.stdout,
|
|
1017
1021
|
maxItems: b = Number.POSITIVE_INFINITY,
|
|
1018
|
-
columnPadding:
|
|
1022
|
+
columnPadding: C3 = 0,
|
|
1019
1023
|
rowPadding: r2 = 4
|
|
1020
1024
|
}) => {
|
|
1021
|
-
const i2 = getColumns(p) -
|
|
1025
|
+
const i2 = getColumns(p) - C3, m2 = getRows(p), M = styleText2("dim", "..."), v = Math.max(m2 - r2, 0), a2 = Math.max(Math.min(b, v), 5);
|
|
1022
1026
|
let f = 0;
|
|
1023
|
-
|
|
1024
|
-
Math.min(
|
|
1027
|
+
l >= a2 - 3 && (f = Math.max(
|
|
1028
|
+
Math.min(l - a2 + 3, e.length - a2),
|
|
1025
1029
|
0
|
|
1026
1030
|
));
|
|
1027
|
-
let d = a2 < e.length && f > 0,
|
|
1028
|
-
const
|
|
1031
|
+
let d = a2 < e.length && f > 0, c3 = a2 < e.length && f + a2 < e.length;
|
|
1032
|
+
const I = Math.min(
|
|
1029
1033
|
f + a2,
|
|
1030
1034
|
e.length
|
|
1031
1035
|
), s = [];
|
|
1032
1036
|
let g = 0;
|
|
1033
|
-
d && g++,
|
|
1034
|
-
const T = f + (d ? 1 : 0),
|
|
1035
|
-
for (let t2 = T; t2 <
|
|
1036
|
-
const n3 = e[t2], o = n3 ? w(n3, t2 ===
|
|
1037
|
+
d && g++, c3 && g++;
|
|
1038
|
+
const T = f + (d ? 1 : 0), W2 = I - (c3 ? 1 : 0);
|
|
1039
|
+
for (let t2 = T; t2 < W2; t2++) {
|
|
1040
|
+
const n3 = e[t2], o = n3 !== void 0 ? w(n3, t2 === l) : "", h2 = wrapAnsi(o, i2, {
|
|
1037
1041
|
hard: true,
|
|
1038
1042
|
trim: false
|
|
1039
1043
|
}).split(`
|
|
@@ -1042,9 +1046,9 @@ var init_dist4 = __esm({
|
|
|
1042
1046
|
}
|
|
1043
1047
|
if (g > v) {
|
|
1044
1048
|
let t2 = 0, n3 = 0, o = g;
|
|
1045
|
-
const h2 =
|
|
1049
|
+
const h2 = l - T;
|
|
1046
1050
|
let u3 = v;
|
|
1047
|
-
const L = () =>
|
|
1051
|
+
const L = () => E$1(s, o, 0, h2, u3), y = () => E$1(
|
|
1048
1052
|
s,
|
|
1049
1053
|
o,
|
|
1050
1054
|
h2 + 1,
|
|
@@ -1052,14 +1056,14 @@ var init_dist4 = __esm({
|
|
|
1052
1056
|
u3,
|
|
1053
1057
|
true
|
|
1054
1058
|
);
|
|
1055
|
-
d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (
|
|
1059
|
+
d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (c3 || (u3 -= 1), { lineCount: o, removals: n3 } = y())) : (c3 || (u3 -= 1), { lineCount: o, removals: n3 } = y(), o > u3 && (u3 -= 1, { lineCount: o, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n3 > 0 && (c3 = true, s.splice(s.length - n3, n3));
|
|
1056
1060
|
}
|
|
1057
1061
|
const x = [];
|
|
1058
1062
|
d && x.push(M);
|
|
1059
1063
|
for (const t2 of s)
|
|
1060
1064
|
for (const n3 of t2)
|
|
1061
1065
|
x.push(n3);
|
|
1062
|
-
return
|
|
1066
|
+
return c3 && x.push(M), x;
|
|
1063
1067
|
};
|
|
1064
1068
|
confirm = (e) => {
|
|
1065
1069
|
const a2 = e.active ?? "Yes", o = e.inactive ?? "No";
|
|
@@ -1071,22 +1075,22 @@ var init_dist4 = __esm({
|
|
|
1071
1075
|
output: e.output,
|
|
1072
1076
|
initialValue: e.initialValue ?? true,
|
|
1073
1077
|
render() {
|
|
1074
|
-
const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `,
|
|
1078
|
+
const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l = i2 ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
|
|
1075
1079
|
e.output,
|
|
1076
1080
|
e.message,
|
|
1077
|
-
|
|
1081
|
+
l,
|
|
1078
1082
|
u3
|
|
1079
1083
|
), s = `${i2 ? `${styleText2("gray", S_BAR)}
|
|
1080
1084
|
` : ""}${f}
|
|
1081
|
-
`,
|
|
1085
|
+
`, c3 = this.value ? a2 : o;
|
|
1082
1086
|
switch (this.state) {
|
|
1083
1087
|
case "submit": {
|
|
1084
1088
|
const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
|
|
1085
|
-
return `${s}${r2}${styleText2("dim",
|
|
1089
|
+
return `${s}${r2}${styleText2("dim", c3)}`;
|
|
1086
1090
|
}
|
|
1087
1091
|
case "cancel": {
|
|
1088
1092
|
const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
|
|
1089
|
-
return `${s}${r2}${styleText2(["strikethrough", "dim"],
|
|
1093
|
+
return `${s}${r2}${styleText2(["strikethrough", "dim"], c3)}${i2 ? `
|
|
1090
1094
|
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1091
1095
|
}
|
|
1092
1096
|
default: {
|
|
@@ -1106,22 +1110,22 @@ ${g}
|
|
|
1106
1110
|
`${styleText2("dim", "Space:")} select`,
|
|
1107
1111
|
`${styleText2("dim", "Enter:")} confirm`
|
|
1108
1112
|
];
|
|
1109
|
-
m = (
|
|
1113
|
+
m = (n3, u3) => n3.split(`
|
|
1110
1114
|
`).map((d) => u3(d)).join(`
|
|
1111
1115
|
`);
|
|
1112
|
-
multiselect = (
|
|
1116
|
+
multiselect = (n3) => {
|
|
1113
1117
|
const u3 = (t2, a2) => {
|
|
1114
1118
|
const r2 = t2.label ?? String(t2.value);
|
|
1115
1119
|
return a2 === "disabled" ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2(["strikethrough", "gray"], o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint ?? "disabled"})`)}` : ""}` : a2 === "active" ? `${styleText2("cyan", S_CHECKBOX_ACTIVE)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${m(r2, (o) => styleText2("dim", o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "cancelled" ? `${m(r2, (o) => styleText2(["strikethrough", "dim"], o))}` : a2 === "active-selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "submitted" ? `${m(r2, (o) => styleText2("dim", o))}` : `${styleText2("dim", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2("dim", o))}`;
|
|
1116
|
-
}, d =
|
|
1120
|
+
}, d = n3.required ?? true, x = n3.showInstructions ?? true;
|
|
1117
1121
|
return new a({
|
|
1118
|
-
options:
|
|
1119
|
-
signal:
|
|
1120
|
-
input:
|
|
1121
|
-
output:
|
|
1122
|
-
initialValues:
|
|
1122
|
+
options: n3.options,
|
|
1123
|
+
signal: n3.signal,
|
|
1124
|
+
input: n3.input,
|
|
1125
|
+
output: n3.output,
|
|
1126
|
+
initialValues: n3.initialValues,
|
|
1123
1127
|
required: d,
|
|
1124
|
-
cursorAt:
|
|
1128
|
+
cursorAt: n3.cursorAt,
|
|
1125
1129
|
validate(t2) {
|
|
1126
1130
|
if (d && (t2 === void 0 || t2.length === 0))
|
|
1127
1131
|
return `Please select at least one option.
|
|
@@ -1137,75 +1141,75 @@ ${styleText2(
|
|
|
1137
1141
|
)}`;
|
|
1138
1142
|
},
|
|
1139
1143
|
render() {
|
|
1140
|
-
const t2 =
|
|
1141
|
-
|
|
1142
|
-
|
|
1144
|
+
const t2 = n3.withGuide ?? settings.withGuide, a2 = wrapTextWithPrefix(
|
|
1145
|
+
n3.output,
|
|
1146
|
+
n3.message,
|
|
1143
1147
|
t2 ? `${symbolBar(this.state)} ` : "",
|
|
1144
1148
|
`${symbol(this.state)} `
|
|
1145
1149
|
), r2 = `${t2 ? `${styleText2("gray", S_BAR)}
|
|
1146
1150
|
` : ""}${a2}
|
|
1147
|
-
`, o = this.value ?? [], g = (
|
|
1148
|
-
if (
|
|
1149
|
-
return u3(
|
|
1150
|
-
const s = o.includes(
|
|
1151
|
-
return
|
|
1151
|
+
`, o = this.value ?? [], g = (i2, l) => {
|
|
1152
|
+
if (i2.disabled)
|
|
1153
|
+
return u3(i2, "disabled");
|
|
1154
|
+
const s = o.includes(i2.value);
|
|
1155
|
+
return l && s ? u3(i2, "active-selected") : s ? u3(i2, "selected") : u3(i2, l ? "active" : "inactive");
|
|
1152
1156
|
};
|
|
1153
1157
|
switch (this.state) {
|
|
1154
1158
|
case "submit": {
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1157
|
-
|
|
1159
|
+
const i2 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), l = wrapTextWithPrefix(
|
|
1160
|
+
n3.output,
|
|
1161
|
+
i2,
|
|
1158
1162
|
t2 ? `${styleText2("gray", S_BAR)} ` : ""
|
|
1159
1163
|
);
|
|
1160
|
-
return `${r2}${
|
|
1164
|
+
return `${r2}${l}`;
|
|
1161
1165
|
}
|
|
1162
1166
|
case "cancel": {
|
|
1163
|
-
const
|
|
1164
|
-
if (
|
|
1167
|
+
const i2 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "cancelled")).join(styleText2("dim", ", "));
|
|
1168
|
+
if (i2.trim() === "")
|
|
1165
1169
|
return `${r2}${styleText2("gray", S_BAR)}`;
|
|
1166
|
-
const
|
|
1167
|
-
|
|
1168
|
-
|
|
1170
|
+
const l = wrapTextWithPrefix(
|
|
1171
|
+
n3.output,
|
|
1172
|
+
i2,
|
|
1169
1173
|
t2 ? `${styleText2("gray", S_BAR)} ` : ""
|
|
1170
1174
|
);
|
|
1171
|
-
return `${r2}${
|
|
1175
|
+
return `${r2}${l}${t2 ? `
|
|
1172
1176
|
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1173
1177
|
}
|
|
1174
1178
|
case "error": {
|
|
1175
|
-
const
|
|
1179
|
+
const i2 = t2 ? `${styleText2("yellow", S_BAR)} ` : "", l = this.error.split(`
|
|
1176
1180
|
`).map(
|
|
1177
1181
|
($, v) => v === 0 ? `${t2 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $)}` : ` ${$}`
|
|
1178
1182
|
).join(`
|
|
1179
1183
|
`), s = r2.split(`
|
|
1180
|
-
`).length, h2 =
|
|
1184
|
+
`).length, h2 = l.split(`
|
|
1181
1185
|
`).length + 1;
|
|
1182
|
-
return `${r2}${
|
|
1183
|
-
output:
|
|
1186
|
+
return `${r2}${i2}${limitOptions({
|
|
1187
|
+
output: n3.output,
|
|
1184
1188
|
options: this.options,
|
|
1185
1189
|
cursor: this.cursor,
|
|
1186
|
-
maxItems:
|
|
1187
|
-
columnPadding:
|
|
1190
|
+
maxItems: n3.maxItems,
|
|
1191
|
+
columnPadding: i2.length,
|
|
1188
1192
|
rowPadding: s + h2,
|
|
1189
1193
|
style: g
|
|
1190
1194
|
}).join(`
|
|
1191
|
-
${
|
|
1192
|
-
${
|
|
1195
|
+
${i2}`)}
|
|
1196
|
+
${l}
|
|
1193
1197
|
`;
|
|
1194
1198
|
}
|
|
1195
1199
|
default: {
|
|
1196
|
-
const
|
|
1197
|
-
`).length, s = x ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t2) : t2 ? [styleText2("cyan", S_BAR_END)] : [], h2 = s.join(`
|
|
1200
|
+
const i2 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", l = r2.split(`
|
|
1201
|
+
`).length, s = x ? formatInstructionFooter(n3.output, MULTISELECT_INSTRUCTIONS, t2) : t2 ? [styleText2("cyan", S_BAR_END)] : [], h2 = s.join(`
|
|
1198
1202
|
`), $ = s.length + 1;
|
|
1199
|
-
return `${r2}${
|
|
1200
|
-
output:
|
|
1203
|
+
return `${r2}${i2}${limitOptions({
|
|
1204
|
+
output: n3.output,
|
|
1201
1205
|
options: this.options,
|
|
1202
1206
|
cursor: this.cursor,
|
|
1203
|
-
maxItems:
|
|
1204
|
-
columnPadding:
|
|
1205
|
-
rowPadding:
|
|
1207
|
+
maxItems: n3.maxItems,
|
|
1208
|
+
columnPadding: i2.length,
|
|
1209
|
+
rowPadding: l + $,
|
|
1206
1210
|
style: g
|
|
1207
1211
|
}).join(`
|
|
1208
|
-
${
|
|
1212
|
+
${i2}`)}
|
|
1209
1213
|
${h2}
|
|
1210
1214
|
`;
|
|
1211
1215
|
}
|
|
@@ -1218,18 +1222,18 @@ ${h2}
|
|
|
1218
1222
|
symbol: e = styleText2("gray", S_BAR),
|
|
1219
1223
|
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
1220
1224
|
output: m2 = process.stdout,
|
|
1221
|
-
spacing:
|
|
1222
|
-
withGuide:
|
|
1225
|
+
spacing: l = 1,
|
|
1226
|
+
withGuide: c3
|
|
1223
1227
|
} = {}) => {
|
|
1224
|
-
const t2 = [], o =
|
|
1225
|
-
for (let i2 = 0; i2 <
|
|
1228
|
+
const t2 = [], o = c3 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
|
|
1229
|
+
for (let i2 = 0; i2 < l; i2++)
|
|
1226
1230
|
t2.push(f);
|
|
1227
1231
|
const g = Array.isArray(s) ? s : s.split(`
|
|
1228
1232
|
`);
|
|
1229
1233
|
if (g.length > 0) {
|
|
1230
|
-
const [i2, ...
|
|
1234
|
+
const [i2, ...y] = g;
|
|
1231
1235
|
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
1232
|
-
for (const p of
|
|
1236
|
+
for (const p of y)
|
|
1233
1237
|
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
1234
1238
|
}
|
|
1235
1239
|
m2.write(`${t2.join(`
|
|
@@ -1274,18 +1278,18 @@ ${styleText2("gray", S_BAR_END)} ` : "";
|
|
|
1274
1278
|
|
|
1275
1279
|
`);
|
|
1276
1280
|
};
|
|
1277
|
-
W
|
|
1278
|
-
|
|
1281
|
+
W = (o) => o;
|
|
1282
|
+
C2 = (o, e, s) => {
|
|
1279
1283
|
const a2 = {
|
|
1280
1284
|
hard: true,
|
|
1281
1285
|
trim: false
|
|
1282
1286
|
}, i2 = wrapAnsi(o, e, a2).split(`
|
|
1283
|
-
`),
|
|
1287
|
+
`), c3 = i2.reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), u3 = i2.map(s).reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), g = e - (u3 - c3);
|
|
1284
1288
|
return wrapAnsi(o, g, a2);
|
|
1285
1289
|
};
|
|
1286
1290
|
note = (o = "", e = "", s) => {
|
|
1287
|
-
const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide,
|
|
1288
|
-
`).map(
|
|
1291
|
+
const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c3 = s?.format ?? W, g = ["", ...C2(o, getColumns(a2) - 6, c3).split(`
|
|
1292
|
+
`).map(c3), ""], n3 = dist_default2(e), t2 = Math.max(
|
|
1289
1293
|
g.reduce((m2, F) => {
|
|
1290
1294
|
const O = dist_default2(F);
|
|
1291
1295
|
return O > m2 ? O : m2;
|
|
@@ -1306,83 +1310,102 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
|
1306
1310
|
`
|
|
1307
1311
|
);
|
|
1308
1312
|
};
|
|
1309
|
-
|
|
1313
|
+
Y = 3e4;
|
|
1314
|
+
Z = (c3) => styleText2("magenta", c3);
|
|
1310
1315
|
spinner = ({
|
|
1311
|
-
indicator:
|
|
1312
|
-
onCancel:
|
|
1316
|
+
indicator: c3 = "dots",
|
|
1317
|
+
onCancel: b,
|
|
1313
1318
|
output: n3 = process.stdout,
|
|
1314
|
-
cancelMessage:
|
|
1315
|
-
errorMessage:
|
|
1316
|
-
frames:
|
|
1317
|
-
delay:
|
|
1318
|
-
signal:
|
|
1319
|
-
...
|
|
1319
|
+
cancelMessage: _,
|
|
1320
|
+
errorMessage: C3,
|
|
1321
|
+
frames: M = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
|
|
1322
|
+
delay: O = unicode ? 80 : 120,
|
|
1323
|
+
signal: g,
|
|
1324
|
+
...E
|
|
1320
1325
|
} = {}) => {
|
|
1321
|
-
const u3 = isCI();
|
|
1322
|
-
let
|
|
1323
|
-
const
|
|
1324
|
-
const
|
|
1325
|
-
|
|
1326
|
-
},
|
|
1327
|
-
process.on("uncaughtExceptionMonitor",
|
|
1328
|
-
},
|
|
1329
|
-
process.removeListener("uncaughtExceptionMonitor",
|
|
1330
|
-
},
|
|
1331
|
-
if (
|
|
1326
|
+
const u3 = isCI(), h2 = isAccessible(E.accessible);
|
|
1327
|
+
let x, I, p = false, l = false, r2 = "", v, w = performance.now();
|
|
1328
|
+
const y = getColumns(n3), F = E?.styleFrame ?? Z, S = (e) => {
|
|
1329
|
+
const s = e > 1 ? C3 ?? settings.messages.error : _ ?? settings.messages.cancel;
|
|
1330
|
+
l = e === 1, p && (m2(s, e), l && typeof b == "function" && b());
|
|
1331
|
+
}, $ = () => S(2), a2 = () => S(1), H = () => {
|
|
1332
|
+
process.on("uncaughtExceptionMonitor", $), process.on("unhandledRejection", $), process.on("SIGINT", a2), process.on("SIGTERM", a2), process.on("exit", S), g && g.addEventListener("abort", a2);
|
|
1333
|
+
}, B = () => {
|
|
1334
|
+
process.removeListener("uncaughtExceptionMonitor", $), process.removeListener("unhandledRejection", $), process.removeListener("SIGINT", a2), process.removeListener("SIGTERM", a2), process.removeListener("exit", S), g && g.removeEventListener("abort", a2);
|
|
1335
|
+
}, R2 = () => {
|
|
1336
|
+
if (v === void 0) return;
|
|
1332
1337
|
u3 && n3.write(`
|
|
1333
1338
|
`);
|
|
1334
|
-
const
|
|
1339
|
+
const s = wrapAnsi(v, y, {
|
|
1335
1340
|
hard: true,
|
|
1336
1341
|
trim: false
|
|
1337
1342
|
}).split(`
|
|
1338
1343
|
`);
|
|
1339
|
-
|
|
1340
|
-
},
|
|
1341
|
-
const
|
|
1342
|
-
return
|
|
1343
|
-
}, N =
|
|
1344
|
-
|
|
1344
|
+
s.length > 1 && n3.write(cursor.up(s.length - 1)), n3.write(cursor.to(0)), n3.write(erase.down());
|
|
1345
|
+
}, L = (e) => e.replace(/\.+$/, ""), T = (e) => {
|
|
1346
|
+
const s = (performance.now() - e) / 1e3, i2 = Math.floor(s / 60), t2 = Math.floor(s % 60);
|
|
1347
|
+
return i2 > 0 ? `[${i2}m ${t2}s]` : `[${t2}s]`;
|
|
1348
|
+
}, N = E.withGuide ?? settings.withGuide, P = (e = "") => {
|
|
1349
|
+
if (p = true, l = false, r2 = L(e), w = performance.now(), H(), h2) {
|
|
1350
|
+
r2 !== "" && n3.write(`${r2}
|
|
1351
|
+
`), I = setInterval(() => {
|
|
1352
|
+
n3.write(r2 === "" ? `still working
|
|
1353
|
+
` : `still working: ${r2}
|
|
1345
1354
|
`);
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1355
|
+
}, Y);
|
|
1356
|
+
return;
|
|
1357
|
+
}
|
|
1358
|
+
x = block({ output: n3 }), N && n3.write(`${styleText2("gray", S_BAR)}
|
|
1359
|
+
`);
|
|
1360
|
+
let s = 0, i2 = 0;
|
|
1361
|
+
I = setInterval(() => {
|
|
1362
|
+
if (u3 && r2 === v)
|
|
1349
1363
|
return;
|
|
1350
|
-
|
|
1351
|
-
const
|
|
1352
|
-
let
|
|
1364
|
+
R2(), v = r2;
|
|
1365
|
+
const t2 = F(M[s]);
|
|
1366
|
+
let o;
|
|
1353
1367
|
if (u3)
|
|
1354
|
-
|
|
1355
|
-
else if (
|
|
1356
|
-
|
|
1368
|
+
o = `${t2} ${r2}...`;
|
|
1369
|
+
else if (c3 === "timer")
|
|
1370
|
+
o = `${t2} ${r2} ${T(w)}`;
|
|
1357
1371
|
else {
|
|
1358
|
-
const
|
|
1359
|
-
|
|
1372
|
+
const j = ".".repeat(Math.floor(i2)).slice(0, 3);
|
|
1373
|
+
o = `${t2} ${r2}${j}`;
|
|
1360
1374
|
}
|
|
1361
|
-
const
|
|
1375
|
+
const D = wrapAnsi(o, y, {
|
|
1362
1376
|
hard: true,
|
|
1363
1377
|
trim: false
|
|
1364
1378
|
});
|
|
1365
|
-
n3.write(
|
|
1366
|
-
},
|
|
1367
|
-
},
|
|
1368
|
-
if (
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
`)
|
|
1379
|
+
n3.write(D), s = s + 1 < M.length ? s + 1 : 0, i2 = i2 < 4 ? i2 + 0.125 : 0;
|
|
1380
|
+
}, O);
|
|
1381
|
+
}, m2 = (e = "", s = 0, i2 = false) => {
|
|
1382
|
+
if (p) {
|
|
1383
|
+
if (p = false, l = s === 1, clearInterval(I), h2 || R2(), r2 = e ?? r2, !i2)
|
|
1384
|
+
if (h2) {
|
|
1385
|
+
const t2 = s === 1 ? _ ?? settings.messages.cancel : s === 2 ? C3 ?? settings.messages.error : "Done", o = r2 || t2;
|
|
1386
|
+
c3 === "timer" ? n3.write(`${o} ${T(w)}
|
|
1387
|
+
`) : n3.write(`${o}
|
|
1388
|
+
`);
|
|
1389
|
+
} else {
|
|
1390
|
+
const t2 = s === 0 ? styleText2("green", S_STEP_SUBMIT) : s === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
|
|
1391
|
+
c3 === "timer" ? n3.write(`${t2} ${r2} ${T(w)}
|
|
1392
|
+
`) : n3.write(`${t2} ${r2}
|
|
1393
|
+
`);
|
|
1394
|
+
}
|
|
1395
|
+
B(), x?.();
|
|
1396
|
+
}
|
|
1374
1397
|
};
|
|
1375
1398
|
return {
|
|
1376
1399
|
start: P,
|
|
1377
|
-
stop: (e = "") =>
|
|
1400
|
+
stop: (e = "") => m2(e, 0),
|
|
1378
1401
|
message: (e = "") => {
|
|
1379
|
-
|
|
1402
|
+
r2 = L(e ?? r2);
|
|
1380
1403
|
},
|
|
1381
|
-
cancel: (e = "") =>
|
|
1382
|
-
error: (e = "") =>
|
|
1383
|
-
clear: () =>
|
|
1404
|
+
cancel: (e = "") => m2(e, 1),
|
|
1405
|
+
error: (e = "") => m2(e, 2),
|
|
1406
|
+
clear: () => m2("", 0, true),
|
|
1384
1407
|
get isCancelled() {
|
|
1385
|
-
return
|
|
1408
|
+
return l;
|
|
1386
1409
|
}
|
|
1387
1410
|
};
|
|
1388
1411
|
};
|
|
@@ -1395,7 +1418,7 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
|
1395
1418
|
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1396
1419
|
`${styleText2("dim", "Enter:")} confirm`
|
|
1397
1420
|
];
|
|
1398
|
-
|
|
1421
|
+
c2 = (t2, o) => t2.includes(`
|
|
1399
1422
|
`) ? t2.split(`
|
|
1400
1423
|
`).map((d) => o(d)).join(`
|
|
1401
1424
|
`) : o(t2);
|
|
@@ -1406,15 +1429,15 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
|
1406
1429
|
const s = n3.label ?? String(n3.value);
|
|
1407
1430
|
switch (m2) {
|
|
1408
1431
|
case "disabled":
|
|
1409
|
-
return `${styleText2("gray", S_RADIO_INACTIVE)} ${
|
|
1432
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
|
|
1410
1433
|
case "selected":
|
|
1411
|
-
return `${
|
|
1434
|
+
return `${c2(s, (i2) => styleText2("dim", i2))}`;
|
|
1412
1435
|
case "active":
|
|
1413
1436
|
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
|
|
1414
1437
|
case "cancelled":
|
|
1415
|
-
return `${
|
|
1438
|
+
return `${c2(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
|
|
1416
1439
|
default:
|
|
1417
|
-
return `${styleText2("dim", S_RADIO_INACTIVE)} ${
|
|
1440
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("dim", i2))}`;
|
|
1418
1441
|
}
|
|
1419
1442
|
}, d = t2.showInstructions ?? true;
|
|
1420
1443
|
return new n$1({
|
|
@@ -1452,7 +1475,7 @@ ${styleText2("gray", S_BAR)}` : ""}`;
|
|
|
1452
1475
|
}
|
|
1453
1476
|
default: {
|
|
1454
1477
|
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
|
|
1455
|
-
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
1478
|
+
`).length, p = d ? formatInstructionFooter(t2.output, SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
1456
1479
|
`), b = p.length + 1;
|
|
1457
1480
|
return `${u3}${r2}${limitOptions({
|
|
1458
1481
|
output: t2.output,
|
|
@@ -1481,7 +1504,7 @@ ${f}
|
|
|
1481
1504
|
signal: t2.signal,
|
|
1482
1505
|
input: t2.input,
|
|
1483
1506
|
render() {
|
|
1484
|
-
const r2 = t2?.withGuide ?? settings.withGuide,
|
|
1507
|
+
const r2 = t2?.withGuide ?? settings.withGuide, l = `${`${r2 ? `${styleText2("gray", S_BAR)}
|
|
1485
1508
|
` : ""}${symbol(this.state)} `}${t2.message}
|
|
1486
1509
|
`, d = t2.placeholder && t2.placeholder.length > 0 ? (
|
|
1487
1510
|
// biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
|
|
@@ -1489,30 +1512,30 @@ ${f}
|
|
|
1489
1512
|
) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
|
|
1490
1513
|
switch (this.state) {
|
|
1491
1514
|
case "validating": {
|
|
1492
|
-
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "",
|
|
1493
|
-
return `${
|
|
1515
|
+
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "", c3 = styleText2("dim", o), $ = styleText2("dim", "Validating...");
|
|
1516
|
+
return `${l}${n3}${c3}
|
|
1494
1517
|
${i2} ${$}
|
|
1495
1518
|
`;
|
|
1496
1519
|
}
|
|
1497
1520
|
case "error": {
|
|
1498
|
-
const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", i2 = r2 ? `${styleText2("yellow", S_BAR)} ` : "",
|
|
1499
|
-
return `${
|
|
1521
|
+
const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", i2 = r2 ? `${styleText2("yellow", S_BAR)} ` : "", c3 = r2 ? styleText2("yellow", S_BAR_END) : "";
|
|
1522
|
+
return `${l.trim()}
|
|
1500
1523
|
${i2}${o}
|
|
1501
|
-
${
|
|
1524
|
+
${c3}${n3}
|
|
1502
1525
|
`;
|
|
1503
1526
|
}
|
|
1504
1527
|
case "submit": {
|
|
1505
1528
|
const n3 = s ? `${r2 ? " " : ""}${styleText2("dim", s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
|
|
1506
|
-
return `${
|
|
1529
|
+
return `${l}${i2}${n3}`;
|
|
1507
1530
|
}
|
|
1508
1531
|
case "cancel": {
|
|
1509
1532
|
const n3 = s ? ` ${styleText2(["strikethrough", "dim"], s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
|
|
1510
|
-
return `${
|
|
1533
|
+
return `${l}${i2}${n3}${s.trim() ? `
|
|
1511
1534
|
${i2}` : ""}`;
|
|
1512
1535
|
}
|
|
1513
1536
|
default: {
|
|
1514
1537
|
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "";
|
|
1515
|
-
return `${
|
|
1538
|
+
return `${l}${n3}${o}
|
|
1516
1539
|
${i2}
|
|
1517
1540
|
`;
|
|
1518
1541
|
}
|
|
@@ -1623,8 +1646,8 @@ var init_cli_output = __esm({
|
|
|
1623
1646
|
"packages/tooling/src/utils/cli-output.ts"() {
|
|
1624
1647
|
"use strict";
|
|
1625
1648
|
init_utils2();
|
|
1626
|
-
|
|
1627
|
-
|
|
1649
|
+
init_dist5();
|
|
1650
|
+
init_dist5();
|
|
1628
1651
|
colors = {
|
|
1629
1652
|
reset: "\x1B[0m",
|
|
1630
1653
|
// Success (green)
|
|
@@ -1787,7 +1810,7 @@ var init_errors = __esm({
|
|
|
1787
1810
|
* @param {DoNotDevErrorCode} code - Error code
|
|
1788
1811
|
* @param {object} [options] - Additional error options
|
|
1789
1812
|
* @param {Error} [options.originalError] - Original error if wrapping
|
|
1790
|
-
* @param {Record<string,
|
|
1813
|
+
* @param {Record<string, unknown>} [options.context] - Additional context data
|
|
1791
1814
|
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
1792
1815
|
*/
|
|
1793
1816
|
constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
|
|
@@ -1817,7 +1840,7 @@ var init_errors = __esm({
|
|
|
1817
1840
|
* @param {string} [context] - Additional context for the error
|
|
1818
1841
|
* @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
|
|
1819
1842
|
* @param {object} [options] - Additional error options
|
|
1820
|
-
* @param {Record<string,
|
|
1843
|
+
* @param {Record<string, unknown>} [options.context] - Additional context data
|
|
1821
1844
|
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
1822
1845
|
* @returns {DoNotDevError} New DoNotDev error wrapping the original
|
|
1823
1846
|
*/
|
|
@@ -7868,6 +7891,9 @@ import {
|
|
|
7868
7891
|
extname
|
|
7869
7892
|
} from "node:path";
|
|
7870
7893
|
import { fileURLToPath } from "node:url";
|
|
7894
|
+
function isEexistError(error2) {
|
|
7895
|
+
return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
|
|
7896
|
+
}
|
|
7871
7897
|
function safeExecuteAsync(fn, message) {
|
|
7872
7898
|
return fn().catch((error2) => {
|
|
7873
7899
|
throw new Error(
|
|
@@ -8239,7 +8265,7 @@ var init_PathResolver = __esm({
|
|
|
8239
8265
|
try {
|
|
8240
8266
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
8241
8267
|
} catch (error2) {
|
|
8242
|
-
if (error2
|
|
8268
|
+
if (!isEexistError(error2)) throw error2;
|
|
8243
8269
|
}
|
|
8244
8270
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
8245
8271
|
let writeContent;
|
|
@@ -8301,7 +8327,7 @@ var init_PathResolver = __esm({
|
|
|
8301
8327
|
try {
|
|
8302
8328
|
fs.mkdirSync(dir, { recursive: true });
|
|
8303
8329
|
} catch (error2) {
|
|
8304
|
-
if (error2
|
|
8330
|
+
if (!isEexistError(error2)) throw error2;
|
|
8305
8331
|
}
|
|
8306
8332
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
8307
8333
|
let writeContent;
|
|
@@ -8358,7 +8384,7 @@ var init_PathResolver = __esm({
|
|
|
8358
8384
|
try {
|
|
8359
8385
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
8360
8386
|
} catch (error2) {
|
|
8361
|
-
if (error2
|
|
8387
|
+
if (!isEexistError(error2)) throw error2;
|
|
8362
8388
|
}
|
|
8363
8389
|
try {
|
|
8364
8390
|
return await safeExecuteAsync(async () => {
|
|
@@ -8400,7 +8426,7 @@ var init_PathResolver = __esm({
|
|
|
8400
8426
|
try {
|
|
8401
8427
|
fs.mkdirSync(dir, { recursive: true });
|
|
8402
8428
|
} catch (error2) {
|
|
8403
|
-
if (error2
|
|
8429
|
+
if (!isEexistError(error2)) throw error2;
|
|
8404
8430
|
}
|
|
8405
8431
|
try {
|
|
8406
8432
|
fs.copyFileSync(srcPath, normalizedDestPath);
|
|
@@ -8516,7 +8542,7 @@ var init_PathResolver = __esm({
|
|
|
8516
8542
|
try {
|
|
8517
8543
|
await fs.promises.mkdir(dirPath, { recursive: true });
|
|
8518
8544
|
} catch (error2) {
|
|
8519
|
-
if (error2
|
|
8545
|
+
if (!isEexistError(error2)) throw error2;
|
|
8520
8546
|
}
|
|
8521
8547
|
}
|
|
8522
8548
|
/**
|
|
@@ -8528,7 +8554,7 @@ var init_PathResolver = __esm({
|
|
|
8528
8554
|
try {
|
|
8529
8555
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
8530
8556
|
} catch (error2) {
|
|
8531
|
-
if (error2
|
|
8557
|
+
if (!isEexistError(error2)) throw error2;
|
|
8532
8558
|
}
|
|
8533
8559
|
}
|
|
8534
8560
|
/**
|
|
@@ -8777,6 +8803,7 @@ var init_PathResolver = __esm({
|
|
|
8777
8803
|
* @param patternType - Type of patterns (css, routes, i18n, assets, pwa)
|
|
8778
8804
|
* @returns Resolved patterns with absolute paths
|
|
8779
8805
|
*/
|
|
8806
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- why: mirrors the public PathResolver.d.ts signature; tightening it is a breaking change (any-audit)
|
|
8780
8807
|
async resolvePatterns(patternType) {
|
|
8781
8808
|
if (!constants.getPatternsFor) {
|
|
8782
8809
|
return { framework: [], consumer: [], all: [] };
|
|
@@ -8991,6 +9018,9 @@ import {
|
|
|
8991
9018
|
} from "node:path";
|
|
8992
9019
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8993
9020
|
function readdirSync3(dirPath, options) {
|
|
9021
|
+
if (options !== null && typeof options === "object" && options.withFileTypes === true) {
|
|
9022
|
+
return pathResolverInstance.readdirSync(dirPath, options);
|
|
9023
|
+
}
|
|
8994
9024
|
return pathResolverInstance.readdirSync(dirPath, options);
|
|
8995
9025
|
}
|
|
8996
9026
|
function getDirnameFromUrl(importMetaUrl) {
|
|
@@ -9434,6 +9464,53 @@ var init_typed_file_operations = __esm({
|
|
|
9434
9464
|
}
|
|
9435
9465
|
});
|
|
9436
9466
|
|
|
9467
|
+
// packages/tooling/src/utils/type-guards.ts
|
|
9468
|
+
function isObjectLike(value) {
|
|
9469
|
+
return typeof value === "object" && value !== null;
|
|
9470
|
+
}
|
|
9471
|
+
function asText(value) {
|
|
9472
|
+
return typeof value === "string" ? value : null;
|
|
9473
|
+
}
|
|
9474
|
+
function asBuffer(value) {
|
|
9475
|
+
return Buffer2.isBuffer(value) ? value : null;
|
|
9476
|
+
}
|
|
9477
|
+
function requireText(value, filePath) {
|
|
9478
|
+
if (typeof value !== "string") {
|
|
9479
|
+
throw new DoNotDevError(
|
|
9480
|
+
`Cannot read text file: ${filePath}`,
|
|
9481
|
+
DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
|
|
9482
|
+
{ context: { filePath } }
|
|
9483
|
+
);
|
|
9484
|
+
}
|
|
9485
|
+
return value;
|
|
9486
|
+
}
|
|
9487
|
+
function requireBuffer(value, filePath) {
|
|
9488
|
+
if (!Buffer2.isBuffer(value)) {
|
|
9489
|
+
throw new DoNotDevError(
|
|
9490
|
+
`Cannot read file: ${filePath}`,
|
|
9491
|
+
DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
|
|
9492
|
+
{ context: { filePath } }
|
|
9493
|
+
);
|
|
9494
|
+
}
|
|
9495
|
+
return value;
|
|
9496
|
+
}
|
|
9497
|
+
function pickAllowed(value, allowed, label) {
|
|
9498
|
+
const match = allowed.find((candidate) => candidate === value);
|
|
9499
|
+
if (match === void 0) {
|
|
9500
|
+
throw new Error(
|
|
9501
|
+
`Invalid ${label}: ${String(value)} (expected one of ${allowed.join(", ")})`
|
|
9502
|
+
);
|
|
9503
|
+
}
|
|
9504
|
+
return match;
|
|
9505
|
+
}
|
|
9506
|
+
var init_type_guards = __esm({
|
|
9507
|
+
"packages/tooling/src/utils/type-guards.ts"() {
|
|
9508
|
+
"use strict";
|
|
9509
|
+
init_utils2();
|
|
9510
|
+
init_errors();
|
|
9511
|
+
}
|
|
9512
|
+
});
|
|
9513
|
+
|
|
9437
9514
|
// packages/tooling/src/bundler/utils.ts
|
|
9438
9515
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
9439
9516
|
import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
@@ -9548,7 +9625,7 @@ function analyzeApp(appPath, appName) {
|
|
|
9548
9625
|
try {
|
|
9549
9626
|
const envPath = joinPath(appPath, ".env");
|
|
9550
9627
|
if (pathExists(envPath)) {
|
|
9551
|
-
const envContent = readSync(envPath);
|
|
9628
|
+
const envContent = requireText(readSync(envPath), envPath);
|
|
9552
9629
|
if (envContent.match(/VITE_SUPABASE_URL=.+/)) {
|
|
9553
9630
|
hasSupabase = true;
|
|
9554
9631
|
}
|
|
@@ -9595,7 +9672,7 @@ function analyzeApp(appPath, appName) {
|
|
|
9595
9672
|
try {
|
|
9596
9673
|
const envPath = joinPath(appPath, ".env");
|
|
9597
9674
|
if (pathExists(envPath)) {
|
|
9598
|
-
const envContent = readSync(envPath);
|
|
9675
|
+
const envContent = requireText(readSync(envPath), envPath);
|
|
9599
9676
|
const urlMatch = envContent.match(/VITE_SUPABASE_URL=(.+)/);
|
|
9600
9677
|
if (urlMatch && urlMatch[1]) {
|
|
9601
9678
|
url = urlMatch[1].trim();
|
|
@@ -9671,6 +9748,7 @@ var init_app_detection = __esm({
|
|
|
9671
9748
|
init_utils2();
|
|
9672
9749
|
init_pathResolver();
|
|
9673
9750
|
init_typed_file_operations();
|
|
9751
|
+
init_type_guards();
|
|
9674
9752
|
}
|
|
9675
9753
|
});
|
|
9676
9754
|
|
|
@@ -9712,7 +9790,7 @@ var init_app_selector = __esm({
|
|
|
9712
9790
|
"packages/tooling/src/utils/app-selector.ts"() {
|
|
9713
9791
|
"use strict";
|
|
9714
9792
|
init_utils2();
|
|
9715
|
-
|
|
9793
|
+
init_dist5();
|
|
9716
9794
|
init_app_detection();
|
|
9717
9795
|
init_cli_output();
|
|
9718
9796
|
}
|
|
@@ -9743,21 +9821,25 @@ async function askForConfirmation(message, defaultValue = false) {
|
|
|
9743
9821
|
return result;
|
|
9744
9822
|
}
|
|
9745
9823
|
async function askForSelection(message, choices, defaultValue = 0) {
|
|
9746
|
-
const options = choices.map((choice) =>
|
|
9747
|
-
value
|
|
9748
|
-
label: choice.title,
|
|
9749
|
-
|
|
9750
|
-
|
|
9824
|
+
const options = choices.map((choice) => {
|
|
9825
|
+
const value = choice.value;
|
|
9826
|
+
return { value, label: choice.title, hint: choice.hint };
|
|
9827
|
+
});
|
|
9828
|
+
const initialValue = choices[defaultValue]?.value;
|
|
9751
9829
|
const result = await select({
|
|
9752
9830
|
message,
|
|
9753
9831
|
options,
|
|
9754
|
-
initialValue
|
|
9832
|
+
initialValue
|
|
9755
9833
|
});
|
|
9756
9834
|
if (isCancel(result)) {
|
|
9757
9835
|
cancel("Operation cancelled.");
|
|
9758
9836
|
process.exit(0);
|
|
9759
9837
|
}
|
|
9760
|
-
|
|
9838
|
+
const picked = choices.find((choice) => choice.value === result);
|
|
9839
|
+
if (!picked) {
|
|
9840
|
+
throw new Error(`Unknown selection: ${result}`);
|
|
9841
|
+
}
|
|
9842
|
+
return picked.value;
|
|
9761
9843
|
}
|
|
9762
9844
|
async function askForMultiSelection(message, choices, defaultIndices = []) {
|
|
9763
9845
|
const options = choices.map((choice) => ({
|
|
@@ -9765,7 +9847,7 @@ async function askForMultiSelection(message, choices, defaultIndices = []) {
|
|
|
9765
9847
|
label: choice.title,
|
|
9766
9848
|
hint: choice.hint
|
|
9767
9849
|
}));
|
|
9768
|
-
const initialValues = defaultIndices.map((i2) => choices[i2]?.value).filter(Boolean);
|
|
9850
|
+
const initialValues = defaultIndices.map((i2) => choices[i2]?.value).filter((value) => Boolean(value));
|
|
9769
9851
|
const result = await multiselect({
|
|
9770
9852
|
message,
|
|
9771
9853
|
options,
|
|
@@ -9781,7 +9863,7 @@ var init_cli_input = __esm({
|
|
|
9781
9863
|
"packages/tooling/src/utils/cli-input.ts"() {
|
|
9782
9864
|
"use strict";
|
|
9783
9865
|
init_utils2();
|
|
9784
|
-
|
|
9866
|
+
init_dist5();
|
|
9785
9867
|
}
|
|
9786
9868
|
});
|
|
9787
9869
|
|
|
@@ -10015,7 +10097,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
10015
10097
|
}
|
|
10016
10098
|
var fromCharCode = String.fromCharCode;
|
|
10017
10099
|
function throwSyntaxError(bytes, index, message) {
|
|
10018
|
-
const
|
|
10100
|
+
const c3 = bytes[index];
|
|
10019
10101
|
let line = 1;
|
|
10020
10102
|
let column = 0;
|
|
10021
10103
|
for (let i2 = 0; i2 < index; i2++) {
|
|
@@ -10027,7 +10109,7 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
10027
10109
|
}
|
|
10028
10110
|
}
|
|
10029
10111
|
throw new SyntaxError(
|
|
10030
|
-
message ? message : index === bytes.length ? "Unexpected end of input while parsing JSON" :
|
|
10112
|
+
message ? message : index === bytes.length ? "Unexpected end of input while parsing JSON" : c3 >= 32 && c3 <= 126 ? `Unexpected character ${fromCharCode(c3)} in JSON at position ${index} (line ${line}, column ${column})` : `Unexpected byte 0x${c3.toString(16)} in JSON at position ${index} (line ${line}, column ${column})`
|
|
10031
10113
|
);
|
|
10032
10114
|
}
|
|
10033
10115
|
function JSON_parse(bytes) {
|
|
@@ -10043,15 +10125,15 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
10043
10125
|
let object;
|
|
10044
10126
|
let i2 = 0;
|
|
10045
10127
|
while (i2 < length) {
|
|
10046
|
-
let
|
|
10047
|
-
if (
|
|
10128
|
+
let c3 = bytes[i2++];
|
|
10129
|
+
if (c3 <= 32) {
|
|
10048
10130
|
continue;
|
|
10049
10131
|
}
|
|
10050
10132
|
let value;
|
|
10051
|
-
if (state === 2 && property === null &&
|
|
10133
|
+
if (state === 2 && property === null && c3 !== 34 && c3 !== 125) {
|
|
10052
10134
|
throwSyntaxError(bytes, --i2);
|
|
10053
10135
|
}
|
|
10054
|
-
switch (
|
|
10136
|
+
switch (c3) {
|
|
10055
10137
|
// True
|
|
10056
10138
|
case 116: {
|
|
10057
10139
|
if (bytes[i2++] !== 114 || bytes[i2++] !== 117 || bytes[i2++] !== 101) {
|
|
@@ -10090,10 +10172,10 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
10090
10172
|
case 56:
|
|
10091
10173
|
case 57: {
|
|
10092
10174
|
let index = i2;
|
|
10093
|
-
value = fromCharCode(
|
|
10094
|
-
|
|
10175
|
+
value = fromCharCode(c3);
|
|
10176
|
+
c3 = bytes[i2];
|
|
10095
10177
|
while (true) {
|
|
10096
|
-
switch (
|
|
10178
|
+
switch (c3) {
|
|
10097
10179
|
case 43:
|
|
10098
10180
|
case 45:
|
|
10099
10181
|
case 46:
|
|
@@ -10109,8 +10191,8 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
10109
10191
|
case 57:
|
|
10110
10192
|
case 101:
|
|
10111
10193
|
case 69: {
|
|
10112
|
-
value += fromCharCode(
|
|
10113
|
-
|
|
10194
|
+
value += fromCharCode(c3);
|
|
10195
|
+
c3 = bytes[++i2];
|
|
10114
10196
|
continue;
|
|
10115
10197
|
}
|
|
10116
10198
|
}
|
|
@@ -10129,10 +10211,10 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
10129
10211
|
if (i2 >= length) {
|
|
10130
10212
|
throwSyntaxError(bytes, length);
|
|
10131
10213
|
}
|
|
10132
|
-
|
|
10133
|
-
if (
|
|
10214
|
+
c3 = bytes[i2++];
|
|
10215
|
+
if (c3 === 34) {
|
|
10134
10216
|
break;
|
|
10135
|
-
} else if (
|
|
10217
|
+
} else if (c3 === 92) {
|
|
10136
10218
|
switch (bytes[i2++]) {
|
|
10137
10219
|
// Normal escape sequence
|
|
10138
10220
|
case 34:
|
|
@@ -10163,11 +10245,11 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
10163
10245
|
case 117: {
|
|
10164
10246
|
let code = 0;
|
|
10165
10247
|
for (let j = 0; j < 4; j++) {
|
|
10166
|
-
|
|
10248
|
+
c3 = bytes[i2++];
|
|
10167
10249
|
code <<= 4;
|
|
10168
|
-
if (
|
|
10169
|
-
else if (
|
|
10170
|
-
else if (
|
|
10250
|
+
if (c3 >= 48 && c3 <= 57) code |= c3 - 48;
|
|
10251
|
+
else if (c3 >= 97 && c3 <= 102) code |= c3 + (10 - 97);
|
|
10252
|
+
else if (c3 >= 65 && c3 <= 70) code |= c3 + (10 - 65);
|
|
10171
10253
|
else throwSyntaxError(bytes, --i2);
|
|
10172
10254
|
}
|
|
10173
10255
|
value += fromCharCode(code);
|
|
@@ -10178,14 +10260,14 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
10178
10260
|
throwSyntaxError(bytes, --i2);
|
|
10179
10261
|
break;
|
|
10180
10262
|
}
|
|
10181
|
-
} else if (
|
|
10182
|
-
value += fromCharCode(
|
|
10183
|
-
} else if ((
|
|
10184
|
-
value += fromCharCode((
|
|
10185
|
-
} else if ((
|
|
10186
|
-
value += fromCharCode((
|
|
10187
|
-
} else if ((
|
|
10188
|
-
let codePoint = (
|
|
10263
|
+
} else if (c3 <= 127) {
|
|
10264
|
+
value += fromCharCode(c3);
|
|
10265
|
+
} else if ((c3 & 224) === 192) {
|
|
10266
|
+
value += fromCharCode((c3 & 31) << 6 | bytes[i2++] & 63);
|
|
10267
|
+
} else if ((c3 & 240) === 224) {
|
|
10268
|
+
value += fromCharCode((c3 & 15) << 12 | (bytes[i2++] & 63) << 6 | bytes[i2++] & 63);
|
|
10269
|
+
} else if ((c3 & 248) == 240) {
|
|
10270
|
+
let codePoint = (c3 & 7) << 18 | (bytes[i2++] & 63) << 12 | (bytes[i2++] & 63) << 6 | bytes[i2++] & 63;
|
|
10189
10271
|
if (codePoint > 65535) {
|
|
10190
10272
|
codePoint -= 65536;
|
|
10191
10273
|
value += fromCharCode(codePoint >> 10 & 1023 | 55296);
|
|
@@ -10245,9 +10327,9 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
10245
10327
|
throwSyntaxError(bytes, --i2);
|
|
10246
10328
|
}
|
|
10247
10329
|
}
|
|
10248
|
-
|
|
10249
|
-
while (
|
|
10250
|
-
|
|
10330
|
+
c3 = bytes[i2];
|
|
10331
|
+
while (c3 <= 32) {
|
|
10332
|
+
c3 = bytes[++i2];
|
|
10251
10333
|
}
|
|
10252
10334
|
switch (state) {
|
|
10253
10335
|
case 0: {
|
|
@@ -10258,11 +10340,11 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
10258
10340
|
}
|
|
10259
10341
|
case 1: {
|
|
10260
10342
|
object.push(value);
|
|
10261
|
-
if (
|
|
10343
|
+
if (c3 === 44) {
|
|
10262
10344
|
i2++;
|
|
10263
10345
|
continue;
|
|
10264
10346
|
}
|
|
10265
|
-
if (
|
|
10347
|
+
if (c3 === 93) {
|
|
10266
10348
|
continue;
|
|
10267
10349
|
}
|
|
10268
10350
|
break;
|
|
@@ -10270,18 +10352,18 @@ is not a problem with esbuild. You need to fix your environment instead.
|
|
|
10270
10352
|
case 2: {
|
|
10271
10353
|
if (property === null) {
|
|
10272
10354
|
property = value;
|
|
10273
|
-
if (
|
|
10355
|
+
if (c3 === 58) {
|
|
10274
10356
|
i2++;
|
|
10275
10357
|
continue;
|
|
10276
10358
|
}
|
|
10277
10359
|
} else {
|
|
10278
10360
|
object[property] = value;
|
|
10279
10361
|
property = null;
|
|
10280
|
-
if (
|
|
10362
|
+
if (c3 === 44) {
|
|
10281
10363
|
i2++;
|
|
10282
10364
|
continue;
|
|
10283
10365
|
}
|
|
10284
|
-
if (
|
|
10366
|
+
if (c3 === 125) {
|
|
10285
10367
|
continue;
|
|
10286
10368
|
}
|
|
10287
10369
|
}
|
|
@@ -12669,7 +12751,9 @@ async function bundleEdgeFunction(options) {
|
|
|
12669
12751
|
alias,
|
|
12670
12752
|
plugins: [createDenoEdgePlugin(workspace, denoImports, functionsDir)],
|
|
12671
12753
|
mainFields: ["module", "main"],
|
|
12672
|
-
|
|
12754
|
+
// `react-server`: server code. `@donotdev/core` (".") resolves to its client-free
|
|
12755
|
+
// server entry, as in Next's server layer (docs/architecture/INDEX.md, export conditions).
|
|
12756
|
+
conditions: ["react-server", "import", "module"],
|
|
12673
12757
|
logLevel: "warning",
|
|
12674
12758
|
metafile: true
|
|
12675
12759
|
};
|
|
@@ -13445,9 +13529,9 @@ var require_Alias = __commonJS({
|
|
|
13445
13529
|
} else if (identity.isCollection(node)) {
|
|
13446
13530
|
let count = 0;
|
|
13447
13531
|
for (const item of node.items) {
|
|
13448
|
-
const
|
|
13449
|
-
if (
|
|
13450
|
-
count =
|
|
13532
|
+
const c3 = getAliasCount(doc, item, anchors2);
|
|
13533
|
+
if (c3 > count)
|
|
13534
|
+
count = c3;
|
|
13451
13535
|
}
|
|
13452
13536
|
return count;
|
|
13453
13537
|
} else if (identity.isPair(node)) {
|
|
@@ -20404,10 +20488,12 @@ __export(sync_secrets_exports, {
|
|
|
20404
20488
|
isFirebaseReservedKey: () => isFirebaseReservedKey,
|
|
20405
20489
|
main: () => main5,
|
|
20406
20490
|
parseSecretsWithFallback: () => parseSecretsWithFallback,
|
|
20491
|
+
readPublicAppEnv: () => readPublicAppEnv,
|
|
20407
20492
|
resolveVercelCredentialsForSync: () => resolveVercelCredentialsForSync,
|
|
20408
20493
|
setFirebaseSecret: () => setFirebaseSecret,
|
|
20409
20494
|
setGitHubSecret: () => setGitHubSecret,
|
|
20410
20495
|
setVercelSecret: () => setVercelSecret,
|
|
20496
|
+
syncVercelPublicEnv: () => syncVercelPublicEnv,
|
|
20411
20497
|
uploadServiceAccountToGitHub: () => uploadServiceAccountToGitHub
|
|
20412
20498
|
});
|
|
20413
20499
|
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
@@ -20487,8 +20573,12 @@ function detectFirebaseProjectId(cwd) {
|
|
|
20487
20573
|
const firebasercPath = joinPath(searchDir, ".firebaserc");
|
|
20488
20574
|
if (pathExists(firebasercPath)) {
|
|
20489
20575
|
try {
|
|
20490
|
-
const firebasercRaw = readSync(firebasercPath, {
|
|
20491
|
-
|
|
20576
|
+
const firebasercRaw = readSync(firebasercPath, {
|
|
20577
|
+
format: "json"
|
|
20578
|
+
});
|
|
20579
|
+
const projects = isObjectLike(firebasercRaw) ? firebasercRaw.projects : void 0;
|
|
20580
|
+
const defaultProject = isObjectLike(projects) ? projects.default : void 0;
|
|
20581
|
+
const firebaserc = typeof defaultProject === "string" ? { projects: { default: defaultProject } } : null;
|
|
20492
20582
|
if (firebaserc && firebaserc.projects?.default) {
|
|
20493
20583
|
return firebaserc.projects.default;
|
|
20494
20584
|
}
|
|
@@ -20501,8 +20591,12 @@ function detectFirebaseProjectId(cwd) {
|
|
|
20501
20591
|
const firebasercPath2 = joinPath(current, ".firebaserc");
|
|
20502
20592
|
if (pathExists(firebasercPath2)) {
|
|
20503
20593
|
try {
|
|
20504
|
-
const firebasercRaw = readSync(firebasercPath2, {
|
|
20505
|
-
|
|
20594
|
+
const firebasercRaw = readSync(firebasercPath2, {
|
|
20595
|
+
format: "json"
|
|
20596
|
+
});
|
|
20597
|
+
const projects = isObjectLike(firebasercRaw) ? firebasercRaw.projects : void 0;
|
|
20598
|
+
const defaultProject = isObjectLike(projects) ? projects.default : void 0;
|
|
20599
|
+
const firebaserc = typeof defaultProject === "string" ? { projects: { default: defaultProject } } : null;
|
|
20506
20600
|
if (firebaserc && firebaserc.projects?.default) {
|
|
20507
20601
|
return firebaserc.projects.default;
|
|
20508
20602
|
}
|
|
@@ -20675,6 +20769,44 @@ ${errorOutput}`
|
|
|
20675
20769
|
);
|
|
20676
20770
|
}
|
|
20677
20771
|
}
|
|
20772
|
+
async function selectVercelAppDir(projectRoot, appName) {
|
|
20773
|
+
const apps = detectApps(projectRoot).filter(usesVercel);
|
|
20774
|
+
if (apps.length === 0) {
|
|
20775
|
+
throw new DoNotDevError(
|
|
20776
|
+
`No Vercel app found under ${projectRoot}. An app targets Vercel when its folder has vercel.json or .vercel/.`,
|
|
20777
|
+
"configuration-error",
|
|
20778
|
+
{ context: { platform: "vercel" } }
|
|
20779
|
+
);
|
|
20780
|
+
}
|
|
20781
|
+
if (appName) {
|
|
20782
|
+
const named = apps.find((app) => app.name === appName);
|
|
20783
|
+
if (!named) {
|
|
20784
|
+
throw new DoNotDevError(
|
|
20785
|
+
`App "${appName}" is not a Vercel app. Vercel apps: ${apps.map((app) => app.name).join(", ")}.`,
|
|
20786
|
+
"configuration-error",
|
|
20787
|
+
{ context: { platform: "vercel", app: appName } }
|
|
20788
|
+
);
|
|
20789
|
+
}
|
|
20790
|
+
return named.path;
|
|
20791
|
+
}
|
|
20792
|
+
if (apps.length === 1) {
|
|
20793
|
+
note(`Using app: ${apps[0].name}`, "Auto-detected");
|
|
20794
|
+
return apps[0].path;
|
|
20795
|
+
}
|
|
20796
|
+
const picked = await askForSelection(
|
|
20797
|
+
"Which app would you like to sync secrets for?",
|
|
20798
|
+
apps.map((app) => ({ title: app.name, value: app.name }))
|
|
20799
|
+
);
|
|
20800
|
+
const selected = apps.find((app) => app.name === picked);
|
|
20801
|
+
if (!selected) {
|
|
20802
|
+
throw new DoNotDevError(
|
|
20803
|
+
`App "${picked}" is not a Vercel app.`,
|
|
20804
|
+
"configuration-error",
|
|
20805
|
+
{ context: { platform: "vercel", app: picked } }
|
|
20806
|
+
);
|
|
20807
|
+
}
|
|
20808
|
+
return selected.path;
|
|
20809
|
+
}
|
|
20678
20810
|
async function resolveVercelCredentialsForSync(appDir, projectIdOverride, dryRun) {
|
|
20679
20811
|
const credResult = resolveVercelCredentials(appDir);
|
|
20680
20812
|
if (credResult.missing) {
|
|
@@ -20710,6 +20842,32 @@ async function resolveVercelCredentialsForSync(appDir, projectIdOverride, dryRun
|
|
|
20710
20842
|
}
|
|
20711
20843
|
return credentials;
|
|
20712
20844
|
}
|
|
20845
|
+
function readPublicAppEnv(appDir) {
|
|
20846
|
+
const env = parseEnvFile2(joinPath(appDir, ".env"));
|
|
20847
|
+
return Object.fromEntries(
|
|
20848
|
+
Object.entries(env).filter(
|
|
20849
|
+
([key]) => PUBLIC_ENV_PREFIXES.some((prefix) => key.startsWith(prefix))
|
|
20850
|
+
)
|
|
20851
|
+
);
|
|
20852
|
+
}
|
|
20853
|
+
async function syncVercelPublicEnv(appDir, options = {}) {
|
|
20854
|
+
const dryRun = options.dryRun ?? false;
|
|
20855
|
+
const publicEnv = readPublicAppEnv(appDir);
|
|
20856
|
+
const keys = Object.keys(publicEnv);
|
|
20857
|
+
if (keys.length === 0) {
|
|
20858
|
+
log2.info(`No public variables (${PUBLIC_ENV_PREFIXES.join(", ")}) in ${joinPath(appDir, ".env")}`);
|
|
20859
|
+
return;
|
|
20860
|
+
}
|
|
20861
|
+
const credentials = await resolveVercelCredentialsForSync(
|
|
20862
|
+
appDir,
|
|
20863
|
+
options.vercelProjectId,
|
|
20864
|
+
dryRun
|
|
20865
|
+
);
|
|
20866
|
+
log2.info(`Syncing ${keys.length} public variables to Vercel:`);
|
|
20867
|
+
for (const [key, value] of Object.entries(publicEnv)) {
|
|
20868
|
+
await setVercelSecret(key, value, credentials, dryRun);
|
|
20869
|
+
}
|
|
20870
|
+
}
|
|
20713
20871
|
async function setVercelSecret(key, value, credentials, dryRun = false) {
|
|
20714
20872
|
if (dryRun) {
|
|
20715
20873
|
log2.info(`[DRY RUN] Would set Vercel environment variable: ${key}`);
|
|
@@ -20848,6 +21006,7 @@ async function main5(options = {}) {
|
|
|
20848
21006
|
platform: options.platform,
|
|
20849
21007
|
projectId: options.projectId,
|
|
20850
21008
|
vercelProjectId: options.vercelProjectId,
|
|
21009
|
+
app: options.app,
|
|
20851
21010
|
target: options.target || "runtime",
|
|
20852
21011
|
repo: options.repo,
|
|
20853
21012
|
dryRun: options.dryRun ?? false,
|
|
@@ -20864,7 +21023,11 @@ Options:
|
|
|
20864
21023
|
--target <target> Sync target: 'runtime' (default) or 'github'
|
|
20865
21024
|
--platform <platform> Platform to sync to: 'firebase' or 'vercel' (runtime target only, auto-detected)
|
|
20866
21025
|
--project <id> Firebase project ID (for Firebase platform)
|
|
20867
|
-
--
|
|
21026
|
+
--app <name> Vercel app to sync (apps/<name>); prompts when several exist
|
|
21027
|
+
--vercel-project <id> Vercel project ID (overrides VERCEL_PROJECT_ID from apps/<app>/.env)
|
|
21028
|
+
|
|
21029
|
+
Vercel receives only the public variables (NEXT_PUBLIC_*, VITE_*, EXPO_PUBLIC_*)
|
|
21030
|
+
of apps/<app>/.env. .dndev.secrets is never sent to Vercel.
|
|
20868
21031
|
--repo <owner/repo> GitHub repository (github target only, auto-detected from git remote)
|
|
20869
21032
|
--dry-run, --dry Show what would be done without actually setting secrets
|
|
20870
21033
|
--verbose Show detailed output
|
|
@@ -20875,6 +21038,7 @@ Examples:
|
|
|
20875
21038
|
dndev sync-secrets --target github # sync to GitHub Secrets
|
|
20876
21039
|
dndev sync-secrets --target github --repo owner/repo # sync to specific repo
|
|
20877
21040
|
dndev sync-secrets --platform=firebase
|
|
21041
|
+
dndev sync-secrets --platform vercel --app web # public vars of apps/web
|
|
20878
21042
|
dndev sync-secrets --dry-run
|
|
20879
21043
|
dndev sync-secrets --env-file .env.production --project my-project
|
|
20880
21044
|
`);
|
|
@@ -20883,7 +21047,7 @@ Examples:
|
|
|
20883
21047
|
try {
|
|
20884
21048
|
const currentDir = process.cwd();
|
|
20885
21049
|
let firebaseProjectDir;
|
|
20886
|
-
if (!options.envFile || config.envFile === ".env") {
|
|
21050
|
+
if (config.platform !== "vercel" && (!options.envFile || config.envFile === ".env")) {
|
|
20887
21051
|
const appsWithFunctions = detectAppsWithFunctions();
|
|
20888
21052
|
if (appsWithFunctions.length > 0) {
|
|
20889
21053
|
let selectedApp;
|
|
@@ -20962,6 +21126,16 @@ Examples:
|
|
|
20962
21126
|
return 0;
|
|
20963
21127
|
}
|
|
20964
21128
|
const platform7 = config.platform || detectPlatform();
|
|
21129
|
+
if (platform7 === "vercel") {
|
|
21130
|
+
await syncVercelPublicEnv(
|
|
21131
|
+
await selectVercelAppDir(currentDir, config.app),
|
|
21132
|
+
{ vercelProjectId: config.vercelProjectId, dryRun: config.dryRun }
|
|
21133
|
+
);
|
|
21134
|
+
log2.success(
|
|
21135
|
+
config.dryRun ? "\nDry run completed. Nothing was set on Vercel." : "\nPublic variables synced to Vercel."
|
|
21136
|
+
);
|
|
21137
|
+
return 0;
|
|
21138
|
+
}
|
|
20965
21139
|
if (config.verbose) {
|
|
20966
21140
|
log2.debug(`Working directory: ${currentDir}`);
|
|
20967
21141
|
log2.debug(`Environment file: ${envFilePath}`);
|
|
@@ -20983,27 +21157,18 @@ Examples:
|
|
|
20983
21157
|
log2.info(` ${key}`);
|
|
20984
21158
|
}
|
|
20985
21159
|
});
|
|
20986
|
-
const finalFirebaseProjectDir =
|
|
21160
|
+
const finalFirebaseProjectDir = firebaseProjectDir || findFirebaseProjectDir(config.envFile);
|
|
20987
21161
|
if (config.verbose && finalFirebaseProjectDir) {
|
|
20988
21162
|
log2.debug(`Firebase project directory: ${finalFirebaseProjectDir}`);
|
|
20989
21163
|
}
|
|
20990
|
-
const vercelCredentials = platform7 === "vercel" ? await resolveVercelCredentialsForSync(
|
|
20991
|
-
currentDir,
|
|
20992
|
-
config.vercelProjectId,
|
|
20993
|
-
config.dryRun ?? false
|
|
20994
|
-
) : void 0;
|
|
20995
21164
|
for (const [key, value] of Object.entries(secrets)) {
|
|
20996
|
-
|
|
20997
|
-
|
|
20998
|
-
|
|
20999
|
-
|
|
21000
|
-
|
|
21001
|
-
|
|
21002
|
-
|
|
21003
|
-
);
|
|
21004
|
-
} else if (platform7 === "vercel") {
|
|
21005
|
-
await setVercelSecret(key, value, vercelCredentials, config.dryRun);
|
|
21006
|
-
}
|
|
21165
|
+
await setFirebaseSecret(
|
|
21166
|
+
key,
|
|
21167
|
+
value,
|
|
21168
|
+
config.projectId,
|
|
21169
|
+
config.dryRun,
|
|
21170
|
+
finalFirebaseProjectDir
|
|
21171
|
+
);
|
|
21007
21172
|
}
|
|
21008
21173
|
if (config.dryRun) {
|
|
21009
21174
|
log2.success(
|
|
@@ -21023,18 +21188,21 @@ All secrets synced successfully to ${platform7}!`);
|
|
|
21023
21188
|
return 1;
|
|
21024
21189
|
}
|
|
21025
21190
|
}
|
|
21026
|
-
var sync_secrets_default;
|
|
21191
|
+
var PUBLIC_ENV_PREFIXES, sync_secrets_default;
|
|
21027
21192
|
var init_sync_secrets = __esm({
|
|
21028
21193
|
"packages/tooling/src/apps/sync-secrets.ts"() {
|
|
21029
21194
|
"use strict";
|
|
21030
21195
|
init_utils2();
|
|
21031
21196
|
init_vercel_api();
|
|
21032
21197
|
init_vercel_token();
|
|
21198
|
+
init_app_detection();
|
|
21033
21199
|
init_cli_input();
|
|
21034
21200
|
init_cli_output();
|
|
21035
21201
|
init_errors();
|
|
21036
21202
|
init_pathResolver();
|
|
21037
21203
|
init_secrets_resolver();
|
|
21204
|
+
init_type_guards();
|
|
21205
|
+
PUBLIC_ENV_PREFIXES = ["NEXT_PUBLIC_", "VITE_", "EXPO_PUBLIC_"];
|
|
21038
21206
|
sync_secrets_default = main5;
|
|
21039
21207
|
}
|
|
21040
21208
|
});
|
|
@@ -21062,7 +21230,7 @@ async function executeMigration(options) {
|
|
|
21062
21230
|
if (sqlFiles.length === 0) {
|
|
21063
21231
|
throw new Error(`No .sql files found in ${migrationsDir}`);
|
|
21064
21232
|
}
|
|
21065
|
-
const sql = sqlFiles.map((f) => readSync(f)).filter(Boolean).join("\n\n");
|
|
21233
|
+
const sql = sqlFiles.map((f) => asText(readSync(f))).filter(Boolean).join("\n\n");
|
|
21066
21234
|
const projectRef = extractProjectRef(supabaseUrl);
|
|
21067
21235
|
const mgmtUrl = `https://api.supabase.com/v1/projects/${projectRef}/database/query`;
|
|
21068
21236
|
const response = await fetch(mgmtUrl, {
|
|
@@ -21113,7 +21281,7 @@ async function deployEdgeFunction(options) {
|
|
|
21113
21281
|
Run \`dn build <app> supabase-functions\` before deploying.`
|
|
21114
21282
|
);
|
|
21115
21283
|
}
|
|
21116
|
-
const sourceContent = readSync(buildPath, { format: "text" });
|
|
21284
|
+
const sourceContent = asText(readSync(buildPath, { format: "text" }));
|
|
21117
21285
|
if (!sourceContent) {
|
|
21118
21286
|
throw new Error(`Empty build output: ${buildPath}`);
|
|
21119
21287
|
}
|
|
@@ -21168,6 +21336,7 @@ var init_supabase_management = __esm({
|
|
|
21168
21336
|
init_utils2();
|
|
21169
21337
|
init_cli_output();
|
|
21170
21338
|
init_pathResolver();
|
|
21339
|
+
init_type_guards();
|
|
21171
21340
|
MGMT_API_BASE = "https://api.supabase.com/v1";
|
|
21172
21341
|
}
|
|
21173
21342
|
});
|
|
@@ -21352,7 +21521,7 @@ import { spawnSync as spawnSync3 } from "node:child_process";
|
|
|
21352
21521
|
|
|
21353
21522
|
// packages/tooling/src/utils/cli-tools.ts
|
|
21354
21523
|
init_utils2();
|
|
21355
|
-
|
|
21524
|
+
init_dist5();
|
|
21356
21525
|
import { spawnSync } from "node:child_process";
|
|
21357
21526
|
var CLI_TOOLS = {
|
|
21358
21527
|
BUN: "bun",
|
|
@@ -21387,7 +21556,7 @@ function checkCLI(command, args = ["--version"], useCache = true) {
|
|
|
21387
21556
|
process.env.APPDATA ? `${process.env.APPDATA}\\npm\\${command}.ps1` : null,
|
|
21388
21557
|
process.env.APPDATA ? `${process.env.APPDATA}\\npm\\${command}.cmd` : null,
|
|
21389
21558
|
process.env.APPDATA ? `${process.env.APPDATA}\\npm\\${command}` : null
|
|
21390
|
-
].filter(Boolean);
|
|
21559
|
+
].filter((candidate) => Boolean(candidate));
|
|
21391
21560
|
for (const fullPath of commonPaths) {
|
|
21392
21561
|
try {
|
|
21393
21562
|
const testResult = spawnSync(
|
|
@@ -21636,8 +21805,10 @@ function requireCLI(tool, additionalContext) {
|
|
|
21636
21805
|
// packages/tooling/src/utils/create-utils.ts
|
|
21637
21806
|
init_utils2();
|
|
21638
21807
|
init_cli_output();
|
|
21808
|
+
init_error_handling();
|
|
21639
21809
|
init_pathResolver();
|
|
21640
21810
|
init_typed_file_operations();
|
|
21811
|
+
init_type_guards();
|
|
21641
21812
|
async function copyTemplateFiles(sourceDir, destDir, replacements) {
|
|
21642
21813
|
if (!pathExists(sourceDir)) {
|
|
21643
21814
|
log2.warn(`Warning: Template directory does not exist: ${sourceDir}`);
|
|
@@ -21708,7 +21879,10 @@ async function isTextFile(filePath) {
|
|
|
21708
21879
|
if (textExtensions.some((ext) => filePath.toLowerCase().endsWith(ext)))
|
|
21709
21880
|
return true;
|
|
21710
21881
|
try {
|
|
21711
|
-
const buffer =
|
|
21882
|
+
const buffer = requireBuffer(
|
|
21883
|
+
await read(filePath, { format: "buffer" }),
|
|
21884
|
+
filePath
|
|
21885
|
+
);
|
|
21712
21886
|
if (buffer.length === 0) return true;
|
|
21713
21887
|
for (let i2 = 0; i2 < Math.min(buffer.length, 1e3); i2++) {
|
|
21714
21888
|
if (buffer[i2] === 0) return false;
|
|
@@ -21720,7 +21894,7 @@ async function isTextFile(filePath) {
|
|
|
21720
21894
|
}
|
|
21721
21895
|
async function replacePlaceholders(filePath, replacements) {
|
|
21722
21896
|
try {
|
|
21723
|
-
let content = await read(filePath, { format: "text" });
|
|
21897
|
+
let content = asText(await read(filePath, { format: "text" }));
|
|
21724
21898
|
if (typeof content !== "string") {
|
|
21725
21899
|
content = typeof content === "object" ? JSON.stringify(content, null, 2) : String(content);
|
|
21726
21900
|
}
|
|
@@ -21737,7 +21911,7 @@ async function replacePlaceholders(filePath, replacements) {
|
|
|
21737
21911
|
await write(filePath, content, { overwrite: true });
|
|
21738
21912
|
} catch (error2) {
|
|
21739
21913
|
log2.warn(
|
|
21740
|
-
`Warning: Could not process file ${filePath}: ${error2
|
|
21914
|
+
`Warning: Could not process file ${filePath}: ${getErrorMessage(error2) || "Unknown error"}`
|
|
21741
21915
|
);
|
|
21742
21916
|
}
|
|
21743
21917
|
}
|
|
@@ -21798,7 +21972,7 @@ async function updateRootPackageJson(rootDir, appNames) {
|
|
|
21798
21972
|
packageJson.scripts = packageJson.scripts || {};
|
|
21799
21973
|
} catch (error2) {
|
|
21800
21974
|
log2.warn(
|
|
21801
|
-
`Warning: Could not update root package.json: ${error2
|
|
21975
|
+
`Warning: Could not update root package.json: ${getErrorMessage(error2) || "Unknown error"}`
|
|
21802
21976
|
);
|
|
21803
21977
|
}
|
|
21804
21978
|
}
|
|
@@ -21813,7 +21987,7 @@ async function mergeRootPackageJson(rootDir, allAppNames, options = {}) {
|
|
|
21813
21987
|
packageJson.scripts = packageJson.scripts || {};
|
|
21814
21988
|
} catch (error2) {
|
|
21815
21989
|
log2.warn(
|
|
21816
|
-
`Warning: Could not merge root package.json: ${error2
|
|
21990
|
+
`Warning: Could not merge root package.json: ${getErrorMessage(error2) || "Unknown error"}`
|
|
21817
21991
|
);
|
|
21818
21992
|
}
|
|
21819
21993
|
}
|
|
@@ -21847,7 +22021,7 @@ async function mergeRootTsConfig(rootDir, allAppNames, includeFunctions = false)
|
|
|
21847
22021
|
}
|
|
21848
22022
|
} catch (error2) {
|
|
21849
22023
|
log2.warn(
|
|
21850
|
-
`Warning: Could not merge root tsconfig.json: ${error2
|
|
22024
|
+
`Warning: Could not merge root tsconfig.json: ${getErrorMessage(error2) || "Unknown error"}`
|
|
21851
22025
|
);
|
|
21852
22026
|
}
|
|
21853
22027
|
}
|
|
@@ -22102,7 +22276,9 @@ var PROJECT_QUESTIONNAIRE = [
|
|
|
22102
22276
|
}
|
|
22103
22277
|
];
|
|
22104
22278
|
function aggregateRequirements(answers) {
|
|
22105
|
-
const hasBackend =
|
|
22279
|
+
const hasBackend = Boolean(
|
|
22280
|
+
answers.backend && answers.backend !== "none" || answers.functions && answers.functions !== "none"
|
|
22281
|
+
);
|
|
22106
22282
|
const requirements = {
|
|
22107
22283
|
entities: [],
|
|
22108
22284
|
// Entities created in apps/<app>/entities/ (v1), root entities/ for v2
|
|
@@ -22134,17 +22310,23 @@ async function runQuestionnaire(questions, initialAnswers, showWIP, askFor) {
|
|
|
22134
22310
|
}
|
|
22135
22311
|
if (question.choicesFilter) {
|
|
22136
22312
|
const allowed = question.choicesFilter(answers);
|
|
22137
|
-
choices = choices.filter((
|
|
22313
|
+
choices = choices.filter((c3) => allowed.includes(c3.value));
|
|
22138
22314
|
}
|
|
22139
22315
|
if (choices.length === 0) continue;
|
|
22140
22316
|
answer = await askFor.selection(question.question, choices);
|
|
22141
22317
|
break;
|
|
22142
22318
|
}
|
|
22143
22319
|
case "confirm":
|
|
22144
|
-
answer = await askFor.confirmation(
|
|
22320
|
+
answer = await askFor.confirmation(
|
|
22321
|
+
question.question,
|
|
22322
|
+
typeof resolvedDefault === "boolean" ? resolvedDefault : void 0
|
|
22323
|
+
);
|
|
22145
22324
|
break;
|
|
22146
22325
|
case "input":
|
|
22147
|
-
answer = await askFor.input(
|
|
22326
|
+
answer = await askFor.input(
|
|
22327
|
+
question.question,
|
|
22328
|
+
typeof resolvedDefault === "string" ? resolvedDefault : void 0
|
|
22329
|
+
);
|
|
22148
22330
|
break;
|
|
22149
22331
|
}
|
|
22150
22332
|
answers[question.id] = answer;
|
|
@@ -22928,12 +23110,17 @@ init_pathResolver();
|
|
|
22928
23110
|
import { spawnSync as spawnSync5, execFileSync } from "node:child_process";
|
|
22929
23111
|
import { platform as platform3 } from "node:os";
|
|
22930
23112
|
init_typed_file_operations();
|
|
23113
|
+
init_type_guards();
|
|
22931
23114
|
function discoverFirebaseProjectId(appPath) {
|
|
22932
23115
|
const firebasercPath = joinPath(appPath, ".firebaserc");
|
|
22933
23116
|
if (pathExists(firebasercPath)) {
|
|
22934
23117
|
try {
|
|
22935
|
-
const firebasercRaw = readSync(firebasercPath, {
|
|
22936
|
-
|
|
23118
|
+
const firebasercRaw = readSync(firebasercPath, {
|
|
23119
|
+
format: "json"
|
|
23120
|
+
});
|
|
23121
|
+
const projects = isObjectLike(firebasercRaw) ? firebasercRaw.projects : void 0;
|
|
23122
|
+
const defaultProject = isObjectLike(projects) ? projects.default : void 0;
|
|
23123
|
+
const firebaserc = typeof defaultProject === "string" ? { projects: { default: defaultProject } } : null;
|
|
22937
23124
|
if (firebaserc?.projects?.default) {
|
|
22938
23125
|
return firebaserc.projects.default;
|
|
22939
23126
|
}
|
|
@@ -22957,7 +23144,7 @@ function killPorts(ports) {
|
|
|
22957
23144
|
const findPort = execFileSync("netstat", ["-ano"], {
|
|
22958
23145
|
encoding: "utf-8"
|
|
22959
23146
|
});
|
|
22960
|
-
const lines = findPort.trim().split("\n").filter((
|
|
23147
|
+
const lines = findPort.trim().split("\n").filter((l) => l.includes(`:${port}`));
|
|
22961
23148
|
const pids = /* @__PURE__ */ new Set();
|
|
22962
23149
|
for (const line of lines) {
|
|
22963
23150
|
const match = line.match(/\s+(\d+)\s*$/);
|
|
@@ -23011,7 +23198,7 @@ function getEmulatorPorts(emulatorConfig) {
|
|
|
23011
23198
|
function loadEnvFile(filePath) {
|
|
23012
23199
|
if (!pathExists(filePath)) return;
|
|
23013
23200
|
try {
|
|
23014
|
-
const content = readSync(filePath, { format: "text" });
|
|
23201
|
+
const content = asText(readSync(filePath, { format: "text" }));
|
|
23015
23202
|
if (!content) return;
|
|
23016
23203
|
content.split("\n").forEach((line) => {
|
|
23017
23204
|
const trimmed = line.trim();
|
|
@@ -23084,7 +23271,7 @@ async function startFirebase(app, projectRoot, options = {}) {
|
|
|
23084
23271
|
);
|
|
23085
23272
|
}
|
|
23086
23273
|
if (useFunctions) {
|
|
23087
|
-
const existingContent = pathExists(envLocalPath) ? readSync(envLocalPath, { format: "text" }) || "" : "";
|
|
23274
|
+
const existingContent = pathExists(envLocalPath) ? asText(readSync(envLocalPath, { format: "text" })) || "" : "";
|
|
23088
23275
|
const hasAuthEmulatorHost = existingContent.includes(
|
|
23089
23276
|
"FIREBASE_AUTH_EMULATOR_HOST"
|
|
23090
23277
|
);
|
|
@@ -23645,6 +23832,7 @@ var import_yaml = __toESM(require_dist(), 1);
|
|
|
23645
23832
|
import { execSync as execSync7, spawnSync as spawnSync7 } from "node:child_process";
|
|
23646
23833
|
init_pathResolver();
|
|
23647
23834
|
init_typed_file_operations();
|
|
23835
|
+
init_type_guards();
|
|
23648
23836
|
function backupFiles(functionsDir) {
|
|
23649
23837
|
const backupDir = joinPath(functionsDir, ".deploy-backup");
|
|
23650
23838
|
const packageJsonPath = joinPath(functionsDir, "package.json");
|
|
@@ -23794,7 +23982,7 @@ function getDeployedFunctionNames(functionsDir) {
|
|
|
23794
23982
|
return [];
|
|
23795
23983
|
}
|
|
23796
23984
|
try {
|
|
23797
|
-
const yamlContent = readSync(yamlPath, { format: "text" });
|
|
23985
|
+
const yamlContent = asText(readSync(yamlPath, { format: "text" }));
|
|
23798
23986
|
if (!yamlContent) {
|
|
23799
23987
|
return [];
|
|
23800
23988
|
}
|
|
@@ -23887,7 +24075,7 @@ function getFirebaseRegion(functionsDir) {
|
|
|
23887
24075
|
return process.env.FIREBASE_REGION || "europe-west1";
|
|
23888
24076
|
}
|
|
23889
24077
|
try {
|
|
23890
|
-
const yamlContent = readSync(yamlPath, { format: "text" });
|
|
24078
|
+
const yamlContent = asText(readSync(yamlPath, { format: "text" }));
|
|
23891
24079
|
if (!yamlContent) {
|
|
23892
24080
|
return process.env.FIREBASE_REGION || "europe-west1";
|
|
23893
24081
|
}
|
|
@@ -23916,7 +24104,7 @@ async function autoSyncSecrets(functionsDir, projectId, config) {
|
|
|
23916
24104
|
return;
|
|
23917
24105
|
}
|
|
23918
24106
|
try {
|
|
23919
|
-
const envContent = readSync(envPath, { format: "text" });
|
|
24107
|
+
const envContent = asText(readSync(envPath, { format: "text" }));
|
|
23920
24108
|
if (!envContent) return;
|
|
23921
24109
|
const reservedPrefixes = ["X_GOOGLE_", "FIREBASE_", "EXT_", "GCLOUD_"];
|
|
23922
24110
|
const configOnlyKeys = [
|
|
@@ -24146,6 +24334,7 @@ init_cli_output();
|
|
|
24146
24334
|
init_errors();
|
|
24147
24335
|
init_pathResolver();
|
|
24148
24336
|
init_secrets_resolver();
|
|
24337
|
+
init_type_guards();
|
|
24149
24338
|
var UPLOAD_BATCH_SIZE = 10;
|
|
24150
24339
|
var POLL_INTERVAL_MS = 3e3;
|
|
24151
24340
|
var POLL_MAX_ATTEMPTS = 100;
|
|
@@ -24169,7 +24358,7 @@ async function collectDistFiles(distDir) {
|
|
|
24169
24358
|
if (isDir) {
|
|
24170
24359
|
await walk(fullPath);
|
|
24171
24360
|
} else {
|
|
24172
|
-
const content = await read(fullPath, { format: "buffer" });
|
|
24361
|
+
const content = asBuffer(await read(fullPath, { format: "buffer" }));
|
|
24173
24362
|
if (!content) {
|
|
24174
24363
|
throw new Error(`Cannot read ${fullPath} for upload`);
|
|
24175
24364
|
}
|
|
@@ -24200,7 +24389,7 @@ async function collectVercelOutputFiles(appDir, repoRoot) {
|
|
|
24200
24389
|
if (isDir) {
|
|
24201
24390
|
await walk(fullPath);
|
|
24202
24391
|
} else {
|
|
24203
|
-
const content = await read(fullPath, { format: "buffer" });
|
|
24392
|
+
const content = asBuffer(await read(fullPath, { format: "buffer" }));
|
|
24204
24393
|
if (!content) {
|
|
24205
24394
|
throw new Error(`Cannot read ${fullPath} for upload`);
|
|
24206
24395
|
}
|
|
@@ -24233,7 +24422,7 @@ async function collectVercelOutputFiles(appDir, repoRoot) {
|
|
|
24233
24422
|
});
|
|
24234
24423
|
continue;
|
|
24235
24424
|
}
|
|
24236
|
-
const content = await read(sourcePath, { format: "buffer" });
|
|
24425
|
+
const content = asBuffer(await read(sourcePath, { format: "buffer" }));
|
|
24237
24426
|
if (!content) {
|
|
24238
24427
|
throw new Error(
|
|
24239
24428
|
`filePathMap of ${funcDir}: cannot read ${sourcePath} (resolved from the repository root)`
|
|
@@ -24737,11 +24926,11 @@ async function main6(options = {}) {
|
|
|
24737
24926
|
}
|
|
24738
24927
|
if (usesVercel(appProviderInfo)) {
|
|
24739
24928
|
const fbFrontendIdx = choices.findIndex(
|
|
24740
|
-
(
|
|
24929
|
+
(c3) => c3.value === "frontend" && c3.title.includes("Firebase")
|
|
24741
24930
|
);
|
|
24742
24931
|
if (fbFrontendIdx !== -1) choices.splice(fbFrontendIdx, 1);
|
|
24743
24932
|
const fbBothIdx = choices.findIndex(
|
|
24744
|
-
(
|
|
24933
|
+
(c3) => c3.value === "both" && c3.title.includes("Firebase")
|
|
24745
24934
|
);
|
|
24746
24935
|
if (fbBothIdx !== -1) choices.splice(fbBothIdx, 1);
|
|
24747
24936
|
choices.push({
|
|
@@ -24949,6 +25138,8 @@ async function main6(options = {}) {
|
|
|
24949
25138
|
await deployFrontend(appDir, serviceAccountPath, config.project, config);
|
|
24950
25139
|
}
|
|
24951
25140
|
if (shouldDeployVercelFrontend) {
|
|
25141
|
+
const { syncVercelPublicEnv: syncVercelPublicEnv2 } = await Promise.resolve().then(() => (init_sync_secrets(), sync_secrets_exports));
|
|
25142
|
+
await syncVercelPublicEnv2(appDir);
|
|
24952
25143
|
await deployVercelFrontend(
|
|
24953
25144
|
appDir,
|
|
24954
25145
|
projectRoot,
|
|
@@ -25064,6 +25255,10 @@ init_utils2();
|
|
|
25064
25255
|
|
|
25065
25256
|
// packages/tooling/src/scaffolding/scaffold-matrix.ts
|
|
25066
25257
|
init_utils2();
|
|
25258
|
+
var APP_FRAMEWORKS = ["vite", "nextjs", "expo"];
|
|
25259
|
+
var HOSTS = ["none", "vercel", "firebase"];
|
|
25260
|
+
var FUNCTIONS = ["none", "vercel", "firebase", "supabase"];
|
|
25261
|
+
var BACKENDS = ["firebase", "supabase", "vercel", "none"];
|
|
25067
25262
|
function resolveDeployConfig(host, backend) {
|
|
25068
25263
|
if (host === "none") return null;
|
|
25069
25264
|
if (host === "firebase") return "firebase";
|
|
@@ -25276,6 +25471,7 @@ function generatePackageJson(templateName, mode, options = {}) {
|
|
|
25276
25471
|
}
|
|
25277
25472
|
|
|
25278
25473
|
// packages/tooling/src/scaffolding/create-app.ts
|
|
25474
|
+
init_type_guards();
|
|
25279
25475
|
init_pathResolver();
|
|
25280
25476
|
init_pathResolver();
|
|
25281
25477
|
var SHOW_WIP = process.env.SHOW_WIP === "true" || process.argv.includes("--wip");
|
|
@@ -25314,10 +25510,18 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
25314
25510
|
input: askForInput
|
|
25315
25511
|
});
|
|
25316
25512
|
const requirements = aggregateRequirements(answers);
|
|
25317
|
-
const framework =
|
|
25318
|
-
|
|
25319
|
-
|
|
25320
|
-
|
|
25513
|
+
const framework = pickAllowed(
|
|
25514
|
+
answers.framework || "vite",
|
|
25515
|
+
APP_FRAMEWORKS,
|
|
25516
|
+
"framework"
|
|
25517
|
+
);
|
|
25518
|
+
const host2 = pickAllowed(answers.host || "none", HOSTS, "host");
|
|
25519
|
+
const functions2 = pickAllowed(
|
|
25520
|
+
answers.functions || "none",
|
|
25521
|
+
FUNCTIONS,
|
|
25522
|
+
"functions"
|
|
25523
|
+
);
|
|
25524
|
+
const backend2 = pickAllowed(answers.backend || "none", BACKENDS, "backend");
|
|
25321
25525
|
appConfig = {
|
|
25322
25526
|
template: framework,
|
|
25323
25527
|
host: host2,
|
|
@@ -25465,8 +25669,8 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
25465
25669
|
const fragmentPath = joinPath(overlayDir, fragmentName);
|
|
25466
25670
|
const envPath = joinPath(appDir, ".env");
|
|
25467
25671
|
if (pathExists(fragmentPath) && pathExists(envPath)) {
|
|
25468
|
-
const baseEnv = readSync(envPath);
|
|
25469
|
-
const fragment = readSync(fragmentPath);
|
|
25672
|
+
const baseEnv = requireText(readSync(envPath), envPath);
|
|
25673
|
+
const fragment = requireText(readSync(fragmentPath), fragmentPath);
|
|
25470
25674
|
await write(envPath, baseEnv + "\n" + fragment, { overwrite: true });
|
|
25471
25675
|
}
|
|
25472
25676
|
}
|
|
@@ -25555,13 +25759,17 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
25555
25759
|
const firebaseJson = readSync(firebaseJsonDest, {
|
|
25556
25760
|
format: "json"
|
|
25557
25761
|
});
|
|
25558
|
-
if (
|
|
25559
|
-
|
|
25560
|
-
|
|
25762
|
+
if (!isObjectLike(firebaseJson)) {
|
|
25763
|
+
throw new Error(`Invalid JSON: ${firebaseJsonDest}`);
|
|
25764
|
+
}
|
|
25765
|
+
const hosting = firebaseJson.hosting;
|
|
25766
|
+
if (isObjectLike(hosting) && Array.isArray(hosting.rewrites)) {
|
|
25767
|
+
hosting.rewrites = hosting.rewrites.filter(
|
|
25768
|
+
(r2) => !(isObjectLike(r2) && r2.destination === "/index.html")
|
|
25561
25769
|
);
|
|
25562
25770
|
}
|
|
25563
|
-
if (
|
|
25564
|
-
|
|
25771
|
+
if (isObjectLike(hosting)) {
|
|
25772
|
+
hosting.public = "out";
|
|
25565
25773
|
}
|
|
25566
25774
|
await write(firebaseJsonDest, firebaseJson, {
|
|
25567
25775
|
format: "json",
|
|
@@ -25738,6 +25946,7 @@ init_utils2();
|
|
|
25738
25946
|
init_cli_input();
|
|
25739
25947
|
init_cli_output();
|
|
25740
25948
|
init_pathResolver();
|
|
25949
|
+
init_type_guards();
|
|
25741
25950
|
var SHOW_WIP2 = process.env.SHOW_WIP === "true" || process.argv.includes("--wip");
|
|
25742
25951
|
async function collectAppConfig(appName) {
|
|
25743
25952
|
const answers = await runQuestionnaire(APP_QUESTIONNAIRE, {}, SHOW_WIP2, {
|
|
@@ -25745,12 +25954,16 @@ async function collectAppConfig(appName) {
|
|
|
25745
25954
|
confirmation: askForConfirmation,
|
|
25746
25955
|
input: askForInput
|
|
25747
25956
|
});
|
|
25748
|
-
const framework =
|
|
25957
|
+
const framework = pickAllowed(
|
|
25958
|
+
answers.framework || "vite",
|
|
25959
|
+
APP_FRAMEWORKS,
|
|
25960
|
+
"framework"
|
|
25961
|
+
);
|
|
25749
25962
|
return {
|
|
25750
25963
|
template: framework,
|
|
25751
|
-
host: answers.host || "none",
|
|
25752
|
-
functions: answers.functions || "none",
|
|
25753
|
-
backend: answers.backend || "none",
|
|
25964
|
+
host: pickAllowed(answers.host || "none", HOSTS, "host"),
|
|
25965
|
+
functions: pickAllowed(answers.functions || "none", FUNCTIONS, "functions"),
|
|
25966
|
+
backend: pickAllowed(answers.backend || "none", BACKENDS, "backend"),
|
|
25754
25967
|
needsCRUD: false,
|
|
25755
25968
|
selectedEntities: [],
|
|
25756
25969
|
userAuth: "none",
|
|
@@ -25786,7 +25999,7 @@ function detectExecutionMode2() {
|
|
|
25786
25999
|
if (pathExists(turboJsonPath)) {
|
|
25787
26000
|
try {
|
|
25788
26001
|
const turboJson = readSync(turboJsonPath, { format: "json" });
|
|
25789
|
-
if (turboJson && turboJson.pipeline && Object.keys(turboJson.pipeline).includes("build")) {
|
|
26002
|
+
if (isObjectLike(turboJson) && turboJson.pipeline && Object.keys(turboJson.pipeline).includes("build")) {
|
|
25790
26003
|
return "development";
|
|
25791
26004
|
}
|
|
25792
26005
|
} catch {
|
|
@@ -26028,15 +26241,15 @@ async function main9(_options, name) {
|
|
|
26028
26241
|
});
|
|
26029
26242
|
const relativeMonorepoPath = executionMode === "development" ? calculateRelativePath(projectDirNormalized, monorepoRoot) : "";
|
|
26030
26243
|
const primaryPlatform = Object.values(appConfigs).find(
|
|
26031
|
-
(
|
|
26244
|
+
(c3) => c3.backend !== "none"
|
|
26032
26245
|
)?.backend ?? "none";
|
|
26033
26246
|
const hasVercel = Object.values(appConfigs).some(
|
|
26034
|
-
(
|
|
26247
|
+
(c3) => c3.host === "vercel"
|
|
26035
26248
|
);
|
|
26036
26249
|
const hasSupabase = Object.values(appConfigs).some(
|
|
26037
|
-
(
|
|
26250
|
+
(c3) => c3.backend === "supabase"
|
|
26038
26251
|
);
|
|
26039
|
-
const hasBilling = Object.values(appConfigs).some((
|
|
26252
|
+
const hasBilling = Object.values(appConfigs).some((c3) => c3.billing);
|
|
26040
26253
|
const rootPackageJson = generatePackageJson(
|
|
26041
26254
|
"consumer-root",
|
|
26042
26255
|
executionMode,
|
|
@@ -26315,6 +26528,7 @@ init_utils2();
|
|
|
26315
26528
|
init_cli_output();
|
|
26316
26529
|
init_errors();
|
|
26317
26530
|
init_pathResolver();
|
|
26531
|
+
init_type_guards();
|
|
26318
26532
|
import { spawnSync as spawnSync9 } from "node:child_process";
|
|
26319
26533
|
import { EOL as EOL2 } from "node:os";
|
|
26320
26534
|
async function main10(options = {}) {
|
|
@@ -26381,7 +26595,10 @@ function getGitignorePatterns(rootDir) {
|
|
|
26381
26595
|
const filePatterns = [];
|
|
26382
26596
|
if (pathExists(gitignorePath)) {
|
|
26383
26597
|
log2.debug(`Reading .gitignore from: ${gitignorePath}`);
|
|
26384
|
-
const patterns =
|
|
26598
|
+
const patterns = requireText(
|
|
26599
|
+
readSync(gitignorePath, { format: "text" }),
|
|
26600
|
+
gitignorePath
|
|
26601
|
+
).split("\n").filter((line) => line.trim() !== "" && !line.startsWith("#"));
|
|
26385
26602
|
for (const pattern of patterns) {
|
|
26386
26603
|
const trimmedPattern = pattern.trim();
|
|
26387
26604
|
if (trimmedPattern.endsWith("/")) {
|
|
@@ -26429,7 +26646,7 @@ async function addPathComments(files, rootDir, dryRun, verbose) {
|
|
|
26429
26646
|
const expectedPathComment = format.close ? `${format.open} ${relativePath} ${format.close}` : `${format.open} ${relativePath}`;
|
|
26430
26647
|
const commentStart = format.single;
|
|
26431
26648
|
try {
|
|
26432
|
-
const fileContent = readSync(file, { format: "text" });
|
|
26649
|
+
const fileContent = requireText(readSync(file, { format: "text" }), file);
|
|
26433
26650
|
const contentLines = fileContent.split("\n");
|
|
26434
26651
|
let modified = false;
|
|
26435
26652
|
if (contentLines.length === 0) {
|
|
@@ -26922,7 +27139,7 @@ async function findCacheItems(targetDir, verbose) {
|
|
|
26922
27139
|
check(joinPath(targetDir, "tsconfig.tsbuildinfo"));
|
|
26923
27140
|
check(joinPath(targetDir, "tsconfig.build.tsbuildinfo"));
|
|
26924
27141
|
const generatedFiles = await glob(
|
|
26925
|
-
["**/*.generated.log"
|
|
27142
|
+
["**/*.generated.log"],
|
|
26926
27143
|
{
|
|
26927
27144
|
cwd: targetDir,
|
|
26928
27145
|
absolute: true,
|