@donotdev/cli 0.2.2 → 0.3.0
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 +44 -42
- package/dist/bin/commands/agent-setup.js +135 -67
- package/dist/bin/commands/build.js +352 -234
- package/dist/bin/commands/bump.js +385 -257
- 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-check.js +192804 -0
- package/dist/bin/commands/db.js +1889 -1805
- 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 +835 -713
- package/dist/bin/commands/preview.js +139 -108
- package/dist/bin/commands/seed.js +2186 -2044
- package/dist/bin/commands/setup-cicd.js +258 -204
- package/dist/bin/commands/setup.js +890 -339
- 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 +32 -7
- package/dist/bin/donotdev.js +18 -8
- package/dist/index.js +654 -375
- package/package.json +2 -2
- package/templates/app-demo/index.html.example +1 -1
- package/templates/app-dndev/index.html.example +1 -1
- package/templates/app-dndev/src/globals.css.example +1 -1
- 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 +58 -0
- package/templates/app-next/src/app/ClientLayout.tsx.example +6 -2
- package/templates/app-next/src/globals.css.example +1 -1
- 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/csp.example.json +1 -1
- package/templates/app-vite/index.html.example +1 -1
- package/templates/app-vite/src/globals.css.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/deploy-config/vercel.json.example +2 -2
- package/templates/functions-supabase/supabase/migrations/20250101000006_crud_bulk_status_guard.sql +258 -0
- package/templates/functions-supabase/supabase/migrations/20250101000007_rate_limit_check.sql +76 -0
- package/templates/overlay-supabase/src/config/providers.nextjs.ts.example +37 -0
- package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +3 -3
- package/templates/root-consumer/.claude/hooks/guard-write.sh.example +5 -1
- package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +2 -2
- package/templates/root-consumer/.claude/rules/definition-of-done.md.example +2 -2
- package/templates/root-consumer/.claude/rules/framework.md.example +1 -1
- package/templates/root-consumer/.claude/skills/build/SKILL.md.example +1 -1
- package/templates/root-consumer/.claude/skills/polish/SKILL.md.example +1 -1
- package/templates/root-consumer/.gitignore.example +7 -1
- package/templates/root-consumer/AGENTS.md.example +25 -2
- package/templates/root-consumer/README.md.example +1 -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/bin/commands/emu.js
CHANGED
|
@@ -405,25 +405,29 @@ var init_main = __esm({
|
|
|
405
405
|
}
|
|
406
406
|
});
|
|
407
407
|
|
|
408
|
-
// node_modules/.bun/sisteransi@
|
|
409
|
-
var
|
|
410
|
-
|
|
411
|
-
|
|
408
|
+
// node_modules/.bun/sisteransi@2.0.0/node_modules/sisteransi/dist/index.js
|
|
409
|
+
var ESC2, CSI2, cursor, erase, clear;
|
|
410
|
+
var init_dist3 = __esm({
|
|
411
|
+
"node_modules/.bun/sisteransi@2.0.0/node_modules/sisteransi/dist/index.js"() {
|
|
412
412
|
init_utils2();
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
return `${CSI2}${
|
|
413
|
+
ESC2 = "\x1B";
|
|
414
|
+
CSI2 = `${ESC2}[`;
|
|
415
|
+
cursor = {
|
|
416
|
+
to(x, y) {
|
|
417
|
+
if (!y)
|
|
418
|
+
return `${CSI2}${x + 1}G`;
|
|
419
|
+
return `${CSI2}${y + 1};${x + 1}H`;
|
|
420
420
|
},
|
|
421
|
-
move(x,
|
|
421
|
+
move(x, y) {
|
|
422
422
|
let ret = "";
|
|
423
|
-
if (x < 0)
|
|
424
|
-
|
|
425
|
-
if (
|
|
426
|
-
|
|
423
|
+
if (x < 0)
|
|
424
|
+
ret += `${CSI2}${-x}D`;
|
|
425
|
+
else if (x > 0)
|
|
426
|
+
ret += `${CSI2}${x}C`;
|
|
427
|
+
if (y < 0)
|
|
428
|
+
ret += `${CSI2}${-y}A`;
|
|
429
|
+
else if (y > 0)
|
|
430
|
+
ret += `${CSI2}${y}B`;
|
|
427
431
|
return ret;
|
|
428
432
|
},
|
|
429
433
|
up: (count = 1) => `${CSI2}${count}A`,
|
|
@@ -438,11 +442,7 @@ var require_src = __commonJS({
|
|
|
438
442
|
save: `${ESC2}7`,
|
|
439
443
|
restore: `${ESC2}8`
|
|
440
444
|
};
|
|
441
|
-
|
|
442
|
-
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
443
|
-
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
444
|
-
};
|
|
445
|
-
var erase3 = {
|
|
445
|
+
erase = {
|
|
446
446
|
screen: `${CSI2}2J`,
|
|
447
447
|
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
448
448
|
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
@@ -450,28 +450,30 @@ var require_src = __commonJS({
|
|
|
450
450
|
lineEnd: `${CSI2}K`,
|
|
451
451
|
lineStart: `${CSI2}1K`,
|
|
452
452
|
lines(count) {
|
|
453
|
-
let
|
|
453
|
+
let clear2 = "";
|
|
454
454
|
for (let i2 = 0; i2 < count; i2++)
|
|
455
|
-
|
|
455
|
+
clear2 += this.line + (i2 < count - 1 ? cursor.up() : "");
|
|
456
456
|
if (count)
|
|
457
|
-
|
|
458
|
-
return
|
|
457
|
+
clear2 += cursor.left;
|
|
458
|
+
return clear2;
|
|
459
459
|
}
|
|
460
460
|
};
|
|
461
|
-
|
|
461
|
+
clear = {
|
|
462
|
+
screen: `${ESC2}c`
|
|
463
|
+
};
|
|
462
464
|
}
|
|
463
465
|
});
|
|
464
466
|
|
|
465
|
-
// node_modules/.bun/@clack+core@1.
|
|
467
|
+
// node_modules/.bun/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs
|
|
466
468
|
import { styleText } from "node:util";
|
|
467
469
|
import { stdout, stdin } from "node:process";
|
|
468
|
-
import
|
|
470
|
+
import f__default from "node:readline";
|
|
469
471
|
import { ReadStream } from "node:tty";
|
|
470
|
-
function findCursor(
|
|
472
|
+
function findCursor(o, s, l) {
|
|
471
473
|
if (!l.some((r2) => !r2.disabled))
|
|
472
|
-
return
|
|
473
|
-
const t2 =
|
|
474
|
-
return l[e]?.disabled ? findCursor(e,
|
|
474
|
+
return o;
|
|
475
|
+
const t2 = o + s, n3 = Math.max(l.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
|
|
476
|
+
return l[e]?.disabled ? findCursor(e, s < 0 ? -1 : 1, l) : e;
|
|
475
477
|
}
|
|
476
478
|
function isAccessible(n3) {
|
|
477
479
|
if (n3 !== void 0) return n3;
|
|
@@ -509,14 +511,14 @@ function setRawMode(e, r2) {
|
|
|
509
511
|
o.isTTY && o.setRawMode(r2);
|
|
510
512
|
}
|
|
511
513
|
function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
|
|
512
|
-
const
|
|
513
|
-
return wrapAnsi(r2,
|
|
514
|
+
const l = getColumns(e ?? stdout), i2 = dist_default2(o);
|
|
515
|
+
return wrapAnsi(r2, l - i2, {
|
|
514
516
|
hard: true,
|
|
515
517
|
trim: false
|
|
516
518
|
}).split(`
|
|
517
|
-
`).map((
|
|
518
|
-
const
|
|
519
|
-
return
|
|
519
|
+
`).map((c3, a2, g) => {
|
|
520
|
+
const m2 = t2 ? t2(c3, a2) : c3;
|
|
521
|
+
return a2 === 0 ? `${n3}${m2}` : a2 === g.length - 1 ? `${s}${m2}` : `${o}${m2}`;
|
|
520
522
|
}).join(`
|
|
521
523
|
`);
|
|
522
524
|
}
|
|
@@ -527,12 +529,13 @@ function runValidation(e, a2) {
|
|
|
527
529
|
}
|
|
528
530
|
return e(a2);
|
|
529
531
|
}
|
|
530
|
-
var
|
|
531
|
-
var
|
|
532
|
-
"node_modules/.bun/@clack+core@1.
|
|
532
|
+
var a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, C$1, a, n$1;
|
|
533
|
+
var init_dist4 = __esm({
|
|
534
|
+
"node_modules/.bun/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs"() {
|
|
533
535
|
init_utils2();
|
|
534
536
|
init_main();
|
|
535
|
-
|
|
537
|
+
init_dist3();
|
|
538
|
+
init_dist2();
|
|
536
539
|
a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
537
540
|
t = [
|
|
538
541
|
"January",
|
|
@@ -581,7 +584,7 @@ var init_dist3 = __esm({
|
|
|
581
584
|
CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
|
|
582
585
|
getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
583
586
|
getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
584
|
-
|
|
587
|
+
C$1 = class C {
|
|
585
588
|
input;
|
|
586
589
|
output;
|
|
587
590
|
_abortSignal;
|
|
@@ -663,16 +666,16 @@ var init_dist3 = __esm({
|
|
|
663
666
|
{ once: true }
|
|
664
667
|
);
|
|
665
668
|
}
|
|
666
|
-
this.rl =
|
|
669
|
+
this.rl = f__default.createInterface({
|
|
667
670
|
input: this.input,
|
|
668
671
|
tabSize: 2,
|
|
669
672
|
prompt: "",
|
|
670
673
|
escapeCodeTimeout: 50,
|
|
671
674
|
terminal: true
|
|
672
675
|
}), 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", () => {
|
|
673
|
-
this.output.write(
|
|
676
|
+
this.output.write(cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
674
677
|
}), this.once("cancel", () => {
|
|
675
|
-
this.output.write(
|
|
678
|
+
this.output.write(cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
676
679
|
});
|
|
677
680
|
});
|
|
678
681
|
}
|
|
@@ -709,18 +712,18 @@ var init_dist3 = __esm({
|
|
|
709
712
|
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
710
713
|
}
|
|
711
714
|
restoreCursor() {
|
|
712
|
-
const t2 = wrapAnsi(this._prevFrame,
|
|
715
|
+
const t2 = wrapAnsi(this._prevFrame, getColumns(this.output), { hard: true, trim: false }).split(`
|
|
713
716
|
`).length - 1;
|
|
714
|
-
this.output.write(
|
|
717
|
+
this.output.write(cursor.move(-999, t2 * -1));
|
|
715
718
|
}
|
|
716
719
|
render() {
|
|
717
|
-
const t2 = wrapAnsi(this._render(this) ?? "",
|
|
720
|
+
const t2 = wrapAnsi(this._render(this) ?? "", getColumns(this.output), {
|
|
718
721
|
hard: true,
|
|
719
722
|
trim: false
|
|
720
723
|
});
|
|
721
724
|
if (t2 !== this._prevFrame) {
|
|
722
725
|
if (this.state === "initial")
|
|
723
|
-
this.output.write(
|
|
726
|
+
this.output.write(cursor.hide);
|
|
724
727
|
else {
|
|
725
728
|
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
726
729
|
if (this.restoreCursor(), e) {
|
|
@@ -731,33 +734,33 @@ var init_dist3 = __esm({
|
|
|
731
734
|
return;
|
|
732
735
|
}
|
|
733
736
|
if (e.lines.length === 1) {
|
|
734
|
-
this.output.write(
|
|
737
|
+
this.output.write(cursor.move(0, n3 - r2)), this.output.write(erase.lines(1));
|
|
735
738
|
const o = t2.split(`
|
|
736
739
|
`);
|
|
737
|
-
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(
|
|
740
|
+
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(cursor.move(0, o.length - n3 - 1));
|
|
738
741
|
return;
|
|
739
742
|
} else if (e.lines.length > 1) {
|
|
740
743
|
if (s < r2)
|
|
741
744
|
n3 = s;
|
|
742
745
|
else {
|
|
743
746
|
const h2 = n3 - r2;
|
|
744
|
-
h2 > 0 && this.output.write(
|
|
747
|
+
h2 > 0 && this.output.write(cursor.move(0, h2));
|
|
745
748
|
}
|
|
746
|
-
this.output.write(
|
|
747
|
-
const
|
|
749
|
+
this.output.write(erase.down());
|
|
750
|
+
const m2 = t2.split(`
|
|
748
751
|
`).slice(n3);
|
|
749
|
-
this.output.write(
|
|
752
|
+
this.output.write(m2.join(`
|
|
750
753
|
`)), this._prevFrame = t2;
|
|
751
754
|
return;
|
|
752
755
|
}
|
|
753
756
|
}
|
|
754
|
-
this.output.write(
|
|
757
|
+
this.output.write(erase.down());
|
|
755
758
|
}
|
|
756
759
|
this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
|
|
757
760
|
}
|
|
758
761
|
}
|
|
759
762
|
};
|
|
760
|
-
a = class extends
|
|
763
|
+
a = class extends C$1 {
|
|
761
764
|
options;
|
|
762
765
|
cursor = 0;
|
|
763
766
|
get _value() {
|
|
@@ -788,8 +791,8 @@ var init_dist3 = __esm({
|
|
|
788
791
|
this.options.findIndex(({ value: t2 }) => t2 === e.cursorAt),
|
|
789
792
|
0
|
|
790
793
|
);
|
|
791
|
-
this.cursor = this.options[i2]?.disabled ? findCursor(i2, 1, this.options) : i2, this.on("key", (t2,
|
|
792
|
-
|
|
794
|
+
this.cursor = this.options[i2]?.disabled ? findCursor(i2, 1, this.options) : i2, this.on("key", (t2, s) => {
|
|
795
|
+
s.name === "a" && this.toggleAll(), s.name === "i" && this.toggleInvert(), s.name === void 0 && t2 === "\u3000" && this.toggleValue();
|
|
793
796
|
}), this.on("cursor", (t2) => {
|
|
794
797
|
switch (t2) {
|
|
795
798
|
case "left":
|
|
@@ -807,7 +810,7 @@ var init_dist3 = __esm({
|
|
|
807
810
|
});
|
|
808
811
|
}
|
|
809
812
|
};
|
|
810
|
-
n$1 = class n extends
|
|
813
|
+
n$1 = class n extends C$1 {
|
|
811
814
|
options;
|
|
812
815
|
cursor = 0;
|
|
813
816
|
get _selectedValue() {
|
|
@@ -838,7 +841,7 @@ var init_dist3 = __esm({
|
|
|
838
841
|
}
|
|
839
842
|
});
|
|
840
843
|
|
|
841
|
-
// node_modules/.bun/@clack+prompts@1.
|
|
844
|
+
// node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs
|
|
842
845
|
import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
843
846
|
import process$1 from "node:process";
|
|
844
847
|
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
@@ -849,21 +852,22 @@ function isUnicodeSupported() {
|
|
|
849
852
|
}
|
|
850
853
|
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";
|
|
851
854
|
}
|
|
852
|
-
function formatInstructionFooter(o,
|
|
853
|
-
const
|
|
854
|
-
|
|
855
|
+
function formatInstructionFooter(e, o, r2) {
|
|
856
|
+
const s = r2 ? `${styleText2("cyan", S_BAR)} ` : "", n3 = wrapTextWithPrefix(e, o.join(" \u2022 "), s).split(`
|
|
857
|
+
`);
|
|
858
|
+
return r2 && n3.push(styleText2("cyan", S_BAR_END)), n3;
|
|
855
859
|
}
|
|
856
|
-
var
|
|
857
|
-
var
|
|
858
|
-
"node_modules/.bun/@clack+prompts@1.
|
|
860
|
+
var unicode, 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, MULTISELECT_INSTRUCTIONS, m, multiselect, log, cancel, u2, SELECT_INSTRUCTIONS, c2, select, i;
|
|
861
|
+
var init_dist5 = __esm({
|
|
862
|
+
"node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs"() {
|
|
859
863
|
init_utils2();
|
|
860
|
-
|
|
861
|
-
|
|
864
|
+
init_dist4();
|
|
865
|
+
init_dist4();
|
|
862
866
|
init_main();
|
|
863
867
|
init_dist2();
|
|
864
|
-
|
|
868
|
+
init_dist3();
|
|
865
869
|
unicode = isUnicodeSupported();
|
|
866
|
-
unicodeOr = (
|
|
870
|
+
unicodeOr = (e, o) => unicode ? e : o;
|
|
867
871
|
S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
868
872
|
S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
869
873
|
S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
@@ -889,8 +893,8 @@ var init_dist4 = __esm({
|
|
|
889
893
|
S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
890
894
|
S_WARN = unicodeOr("\u25B2", "!");
|
|
891
895
|
S_ERROR = unicodeOr("\u25A0", "x");
|
|
892
|
-
symbol = (
|
|
893
|
-
switch (
|
|
896
|
+
symbol = (e) => {
|
|
897
|
+
switch (e) {
|
|
894
898
|
case "initial":
|
|
895
899
|
case "active":
|
|
896
900
|
return styleText2("cyan", S_STEP_ACTIVE);
|
|
@@ -904,8 +908,8 @@ var init_dist4 = __esm({
|
|
|
904
908
|
return styleText2("dim", S_STEP_ACTIVE);
|
|
905
909
|
}
|
|
906
910
|
};
|
|
907
|
-
symbolBar = (
|
|
908
|
-
switch (
|
|
911
|
+
symbolBar = (e) => {
|
|
912
|
+
switch (e) {
|
|
909
913
|
case "initial":
|
|
910
914
|
case "active":
|
|
911
915
|
return styleText2("cyan", S_BAR);
|
|
@@ -917,9 +921,9 @@ var init_dist4 = __esm({
|
|
|
917
921
|
return styleText2("green", S_BAR);
|
|
918
922
|
}
|
|
919
923
|
};
|
|
920
|
-
|
|
924
|
+
E$1 = (l, e, w, p, b, C2 = false) => {
|
|
921
925
|
let r2 = e, O = 0;
|
|
922
|
-
if (
|
|
926
|
+
if (C2)
|
|
923
927
|
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
924
928
|
const m2 = l[i2];
|
|
925
929
|
if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
|
|
@@ -937,25 +941,25 @@ var init_dist4 = __esm({
|
|
|
937
941
|
style: w,
|
|
938
942
|
output: p = process.stdout,
|
|
939
943
|
maxItems: b = Number.POSITIVE_INFINITY,
|
|
940
|
-
columnPadding:
|
|
944
|
+
columnPadding: C2 = 0,
|
|
941
945
|
rowPadding: r2 = 4
|
|
942
946
|
}) => {
|
|
943
|
-
const i2 = getColumns(p) -
|
|
947
|
+
const i2 = getColumns(p) - C2, m2 = getRows(p), M = styleText2("dim", "..."), v = Math.max(m2 - r2, 0), a2 = Math.max(Math.min(b, v), 5);
|
|
944
948
|
let f = 0;
|
|
945
949
|
l >= a2 - 3 && (f = Math.max(
|
|
946
950
|
Math.min(l - a2 + 3, e.length - a2),
|
|
947
951
|
0
|
|
948
952
|
));
|
|
949
|
-
let d = a2 < e.length && f > 0,
|
|
950
|
-
const
|
|
953
|
+
let d = a2 < e.length && f > 0, c3 = a2 < e.length && f + a2 < e.length;
|
|
954
|
+
const I = Math.min(
|
|
951
955
|
f + a2,
|
|
952
956
|
e.length
|
|
953
957
|
), s = [];
|
|
954
958
|
let g = 0;
|
|
955
|
-
d && g++,
|
|
956
|
-
const T = f + (d ? 1 : 0),
|
|
957
|
-
for (let t2 = T; t2 <
|
|
958
|
-
const n3 = e[t2], o = n3 ? w(n3, t2 === l) : "", h2 = wrapAnsi(o, i2, {
|
|
959
|
+
d && g++, c3 && g++;
|
|
960
|
+
const T = f + (d ? 1 : 0), W = I - (c3 ? 1 : 0);
|
|
961
|
+
for (let t2 = T; t2 < W; t2++) {
|
|
962
|
+
const n3 = e[t2], o = n3 !== void 0 ? w(n3, t2 === l) : "", h2 = wrapAnsi(o, i2, {
|
|
959
963
|
hard: true,
|
|
960
964
|
trim: false
|
|
961
965
|
}).split(`
|
|
@@ -966,7 +970,7 @@ var init_dist4 = __esm({
|
|
|
966
970
|
let t2 = 0, n3 = 0, o = g;
|
|
967
971
|
const h2 = l - T;
|
|
968
972
|
let u3 = v;
|
|
969
|
-
const L = () =>
|
|
973
|
+
const L = () => E$1(s, o, 0, h2, u3), y = () => E$1(
|
|
970
974
|
s,
|
|
971
975
|
o,
|
|
972
976
|
h2 + 1,
|
|
@@ -974,36 +978,36 @@ var init_dist4 = __esm({
|
|
|
974
978
|
u3,
|
|
975
979
|
true
|
|
976
980
|
);
|
|
977
|
-
d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (
|
|
981
|
+
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));
|
|
978
982
|
}
|
|
979
983
|
const x = [];
|
|
980
984
|
d && x.push(M);
|
|
981
985
|
for (const t2 of s)
|
|
982
986
|
for (const n3 of t2)
|
|
983
987
|
x.push(n3);
|
|
984
|
-
return
|
|
988
|
+
return c3 && x.push(M), x;
|
|
985
989
|
};
|
|
986
990
|
MULTISELECT_INSTRUCTIONS = [
|
|
987
991
|
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
988
992
|
`${styleText2("dim", "Space:")} select`,
|
|
989
993
|
`${styleText2("dim", "Enter:")} confirm`
|
|
990
994
|
];
|
|
991
|
-
m = (
|
|
995
|
+
m = (n3, u3) => n3.split(`
|
|
992
996
|
`).map((d) => u3(d)).join(`
|
|
993
997
|
`);
|
|
994
|
-
multiselect = (
|
|
998
|
+
multiselect = (n3) => {
|
|
995
999
|
const u3 = (t2, a2) => {
|
|
996
1000
|
const r2 = t2.label ?? String(t2.value);
|
|
997
1001
|
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))}`;
|
|
998
|
-
}, d =
|
|
1002
|
+
}, d = n3.required ?? true, x = n3.showInstructions ?? true;
|
|
999
1003
|
return new a({
|
|
1000
|
-
options:
|
|
1001
|
-
signal:
|
|
1002
|
-
input:
|
|
1003
|
-
output:
|
|
1004
|
-
initialValues:
|
|
1004
|
+
options: n3.options,
|
|
1005
|
+
signal: n3.signal,
|
|
1006
|
+
input: n3.input,
|
|
1007
|
+
output: n3.output,
|
|
1008
|
+
initialValues: n3.initialValues,
|
|
1005
1009
|
required: d,
|
|
1006
|
-
cursorAt:
|
|
1010
|
+
cursorAt: n3.cursorAt,
|
|
1007
1011
|
validate(t2) {
|
|
1008
1012
|
if (d && (t2 === void 0 || t2.length === 0))
|
|
1009
1013
|
return `Please select at least one option.
|
|
@@ -1019,75 +1023,75 @@ ${styleText2(
|
|
|
1019
1023
|
)}`;
|
|
1020
1024
|
},
|
|
1021
1025
|
render() {
|
|
1022
|
-
const t2 =
|
|
1023
|
-
|
|
1024
|
-
|
|
1026
|
+
const t2 = n3.withGuide ?? settings.withGuide, a2 = wrapTextWithPrefix(
|
|
1027
|
+
n3.output,
|
|
1028
|
+
n3.message,
|
|
1025
1029
|
t2 ? `${symbolBar(this.state)} ` : "",
|
|
1026
1030
|
`${symbol(this.state)} `
|
|
1027
1031
|
), r2 = `${t2 ? `${styleText2("gray", S_BAR)}
|
|
1028
1032
|
` : ""}${a2}
|
|
1029
|
-
`, o = this.value ?? [], g = (
|
|
1030
|
-
if (
|
|
1031
|
-
return u3(
|
|
1032
|
-
const s = o.includes(
|
|
1033
|
-
return l && s ? u3(
|
|
1033
|
+
`, o = this.value ?? [], g = (i2, l) => {
|
|
1034
|
+
if (i2.disabled)
|
|
1035
|
+
return u3(i2, "disabled");
|
|
1036
|
+
const s = o.includes(i2.value);
|
|
1037
|
+
return l && s ? u3(i2, "active-selected") : s ? u3(i2, "selected") : u3(i2, l ? "active" : "inactive");
|
|
1034
1038
|
};
|
|
1035
1039
|
switch (this.state) {
|
|
1036
1040
|
case "submit": {
|
|
1037
|
-
const
|
|
1038
|
-
|
|
1039
|
-
|
|
1041
|
+
const i2 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), l = wrapTextWithPrefix(
|
|
1042
|
+
n3.output,
|
|
1043
|
+
i2,
|
|
1040
1044
|
t2 ? `${styleText2("gray", S_BAR)} ` : ""
|
|
1041
1045
|
);
|
|
1042
1046
|
return `${r2}${l}`;
|
|
1043
1047
|
}
|
|
1044
1048
|
case "cancel": {
|
|
1045
|
-
const
|
|
1046
|
-
if (
|
|
1049
|
+
const i2 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "cancelled")).join(styleText2("dim", ", "));
|
|
1050
|
+
if (i2.trim() === "")
|
|
1047
1051
|
return `${r2}${styleText2("gray", S_BAR)}`;
|
|
1048
1052
|
const l = wrapTextWithPrefix(
|
|
1049
|
-
|
|
1050
|
-
|
|
1053
|
+
n3.output,
|
|
1054
|
+
i2,
|
|
1051
1055
|
t2 ? `${styleText2("gray", S_BAR)} ` : ""
|
|
1052
1056
|
);
|
|
1053
1057
|
return `${r2}${l}${t2 ? `
|
|
1054
1058
|
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1055
1059
|
}
|
|
1056
1060
|
case "error": {
|
|
1057
|
-
const
|
|
1061
|
+
const i2 = t2 ? `${styleText2("yellow", S_BAR)} ` : "", l = this.error.split(`
|
|
1058
1062
|
`).map(
|
|
1059
1063
|
($, v) => v === 0 ? `${t2 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $)}` : ` ${$}`
|
|
1060
1064
|
).join(`
|
|
1061
1065
|
`), s = r2.split(`
|
|
1062
1066
|
`).length, h2 = l.split(`
|
|
1063
1067
|
`).length + 1;
|
|
1064
|
-
return `${r2}${
|
|
1065
|
-
output:
|
|
1068
|
+
return `${r2}${i2}${limitOptions({
|
|
1069
|
+
output: n3.output,
|
|
1066
1070
|
options: this.options,
|
|
1067
1071
|
cursor: this.cursor,
|
|
1068
|
-
maxItems:
|
|
1069
|
-
columnPadding:
|
|
1072
|
+
maxItems: n3.maxItems,
|
|
1073
|
+
columnPadding: i2.length,
|
|
1070
1074
|
rowPadding: s + h2,
|
|
1071
1075
|
style: g
|
|
1072
1076
|
}).join(`
|
|
1073
|
-
${
|
|
1077
|
+
${i2}`)}
|
|
1074
1078
|
${l}
|
|
1075
1079
|
`;
|
|
1076
1080
|
}
|
|
1077
1081
|
default: {
|
|
1078
|
-
const
|
|
1079
|
-
`).length, s = x ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t2) : t2 ? [styleText2("cyan", S_BAR_END)] : [], h2 = s.join(`
|
|
1082
|
+
const i2 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", l = r2.split(`
|
|
1083
|
+
`).length, s = x ? formatInstructionFooter(n3.output, MULTISELECT_INSTRUCTIONS, t2) : t2 ? [styleText2("cyan", S_BAR_END)] : [], h2 = s.join(`
|
|
1080
1084
|
`), $ = s.length + 1;
|
|
1081
|
-
return `${r2}${
|
|
1082
|
-
output:
|
|
1085
|
+
return `${r2}${i2}${limitOptions({
|
|
1086
|
+
output: n3.output,
|
|
1083
1087
|
options: this.options,
|
|
1084
1088
|
cursor: this.cursor,
|
|
1085
|
-
maxItems:
|
|
1086
|
-
columnPadding:
|
|
1089
|
+
maxItems: n3.maxItems,
|
|
1090
|
+
columnPadding: i2.length,
|
|
1087
1091
|
rowPadding: l + $,
|
|
1088
1092
|
style: g
|
|
1089
1093
|
}).join(`
|
|
1090
|
-
${
|
|
1094
|
+
${i2}`)}
|
|
1091
1095
|
${h2}
|
|
1092
1096
|
`;
|
|
1093
1097
|
}
|
|
@@ -1101,17 +1105,17 @@ ${h2}
|
|
|
1101
1105
|
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
1102
1106
|
output: m2 = process.stdout,
|
|
1103
1107
|
spacing: l = 1,
|
|
1104
|
-
withGuide:
|
|
1108
|
+
withGuide: c3
|
|
1105
1109
|
} = {}) => {
|
|
1106
|
-
const t2 = [], o =
|
|
1110
|
+
const t2 = [], o = c3 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
|
|
1107
1111
|
for (let i2 = 0; i2 < l; i2++)
|
|
1108
1112
|
t2.push(f);
|
|
1109
1113
|
const g = Array.isArray(s) ? s : s.split(`
|
|
1110
1114
|
`);
|
|
1111
1115
|
if (g.length > 0) {
|
|
1112
|
-
const [i2, ...
|
|
1116
|
+
const [i2, ...y] = g;
|
|
1113
1117
|
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
1114
|
-
for (const p of
|
|
1118
|
+
for (const p of y)
|
|
1115
1119
|
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
1116
1120
|
}
|
|
1117
1121
|
m2.write(`${t2.join(`
|
|
@@ -1153,7 +1157,7 @@ ${h2}
|
|
|
1153
1157
|
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1154
1158
|
`${styleText2("dim", "Enter:")} confirm`
|
|
1155
1159
|
];
|
|
1156
|
-
|
|
1160
|
+
c2 = (t2, o) => t2.includes(`
|
|
1157
1161
|
`) ? t2.split(`
|
|
1158
1162
|
`).map((d) => o(d)).join(`
|
|
1159
1163
|
`) : o(t2);
|
|
@@ -1164,15 +1168,15 @@ ${h2}
|
|
|
1164
1168
|
const s = n3.label ?? String(n3.value);
|
|
1165
1169
|
switch (m2) {
|
|
1166
1170
|
case "disabled":
|
|
1167
|
-
return `${styleText2("gray", S_RADIO_INACTIVE)} ${
|
|
1171
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
|
|
1168
1172
|
case "selected":
|
|
1169
|
-
return `${
|
|
1173
|
+
return `${c2(s, (i2) => styleText2("dim", i2))}`;
|
|
1170
1174
|
case "active":
|
|
1171
1175
|
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
|
|
1172
1176
|
case "cancelled":
|
|
1173
|
-
return `${
|
|
1177
|
+
return `${c2(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
|
|
1174
1178
|
default:
|
|
1175
|
-
return `${styleText2("dim", S_RADIO_INACTIVE)} ${
|
|
1179
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("dim", i2))}`;
|
|
1176
1180
|
}
|
|
1177
1181
|
}, d = t2.showInstructions ?? true;
|
|
1178
1182
|
return new n$1({
|
|
@@ -1210,7 +1214,7 @@ ${styleText2("gray", S_BAR)}` : ""}`;
|
|
|
1210
1214
|
}
|
|
1211
1215
|
default: {
|
|
1212
1216
|
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
|
|
1213
|
-
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
1217
|
+
`).length, p = d ? formatInstructionFooter(t2.output, SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
1214
1218
|
`), b = p.length + 1;
|
|
1215
1219
|
return `${u3}${r2}${limitOptions({
|
|
1216
1220
|
output: t2.output,
|
|
@@ -1279,8 +1283,8 @@ var init_cli_output = __esm({
|
|
|
1279
1283
|
"packages/tooling/src/utils/cli-output.ts"() {
|
|
1280
1284
|
"use strict";
|
|
1281
1285
|
init_utils2();
|
|
1282
|
-
|
|
1283
|
-
|
|
1286
|
+
init_dist5();
|
|
1287
|
+
init_dist5();
|
|
1284
1288
|
colors = {
|
|
1285
1289
|
reset: "\x1B[0m",
|
|
1286
1290
|
// Success (green)
|
|
@@ -1431,7 +1435,7 @@ var init_errors = __esm({
|
|
|
1431
1435
|
* @param {DoNotDevErrorCode} code - Error code
|
|
1432
1436
|
* @param {object} [options] - Additional error options
|
|
1433
1437
|
* @param {Error} [options.originalError] - Original error if wrapping
|
|
1434
|
-
* @param {Record<string,
|
|
1438
|
+
* @param {Record<string, unknown>} [options.context] - Additional context data
|
|
1435
1439
|
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
1436
1440
|
*/
|
|
1437
1441
|
constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
|
|
@@ -1461,7 +1465,7 @@ var init_errors = __esm({
|
|
|
1461
1465
|
* @param {string} [context] - Additional context for the error
|
|
1462
1466
|
* @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
|
|
1463
1467
|
* @param {object} [options] - Additional error options
|
|
1464
|
-
* @param {Record<string,
|
|
1468
|
+
* @param {Record<string, unknown>} [options.context] - Additional context data
|
|
1465
1469
|
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
1466
1470
|
* @returns {DoNotDevError} New DoNotDev error wrapping the original
|
|
1467
1471
|
*/
|
|
@@ -7512,6 +7516,9 @@ import {
|
|
|
7512
7516
|
extname
|
|
7513
7517
|
} from "node:path";
|
|
7514
7518
|
import { fileURLToPath } from "node:url";
|
|
7519
|
+
function isEexistError(error2) {
|
|
7520
|
+
return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
|
|
7521
|
+
}
|
|
7515
7522
|
function safeExecuteAsync(fn, message) {
|
|
7516
7523
|
return fn().catch((error2) => {
|
|
7517
7524
|
throw new Error(
|
|
@@ -7883,7 +7890,7 @@ var init_PathResolver = __esm({
|
|
|
7883
7890
|
try {
|
|
7884
7891
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
7885
7892
|
} catch (error2) {
|
|
7886
|
-
if (error2
|
|
7893
|
+
if (!isEexistError(error2)) throw error2;
|
|
7887
7894
|
}
|
|
7888
7895
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
7889
7896
|
let writeContent;
|
|
@@ -7945,7 +7952,7 @@ var init_PathResolver = __esm({
|
|
|
7945
7952
|
try {
|
|
7946
7953
|
fs.mkdirSync(dir, { recursive: true });
|
|
7947
7954
|
} catch (error2) {
|
|
7948
|
-
if (error2
|
|
7955
|
+
if (!isEexistError(error2)) throw error2;
|
|
7949
7956
|
}
|
|
7950
7957
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
7951
7958
|
let writeContent;
|
|
@@ -8002,7 +8009,7 @@ var init_PathResolver = __esm({
|
|
|
8002
8009
|
try {
|
|
8003
8010
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
8004
8011
|
} catch (error2) {
|
|
8005
|
-
if (error2
|
|
8012
|
+
if (!isEexistError(error2)) throw error2;
|
|
8006
8013
|
}
|
|
8007
8014
|
try {
|
|
8008
8015
|
return await safeExecuteAsync(async () => {
|
|
@@ -8044,7 +8051,7 @@ var init_PathResolver = __esm({
|
|
|
8044
8051
|
try {
|
|
8045
8052
|
fs.mkdirSync(dir, { recursive: true });
|
|
8046
8053
|
} catch (error2) {
|
|
8047
|
-
if (error2
|
|
8054
|
+
if (!isEexistError(error2)) throw error2;
|
|
8048
8055
|
}
|
|
8049
8056
|
try {
|
|
8050
8057
|
fs.copyFileSync(srcPath, normalizedDestPath);
|
|
@@ -8160,7 +8167,7 @@ var init_PathResolver = __esm({
|
|
|
8160
8167
|
try {
|
|
8161
8168
|
await fs.promises.mkdir(dirPath, { recursive: true });
|
|
8162
8169
|
} catch (error2) {
|
|
8163
|
-
if (error2
|
|
8170
|
+
if (!isEexistError(error2)) throw error2;
|
|
8164
8171
|
}
|
|
8165
8172
|
}
|
|
8166
8173
|
/**
|
|
@@ -8172,7 +8179,7 @@ var init_PathResolver = __esm({
|
|
|
8172
8179
|
try {
|
|
8173
8180
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
8174
8181
|
} catch (error2) {
|
|
8175
|
-
if (error2
|
|
8182
|
+
if (!isEexistError(error2)) throw error2;
|
|
8176
8183
|
}
|
|
8177
8184
|
}
|
|
8178
8185
|
/**
|
|
@@ -8421,6 +8428,7 @@ var init_PathResolver = __esm({
|
|
|
8421
8428
|
* @param patternType - Type of patterns (css, routes, i18n, assets, pwa)
|
|
8422
8429
|
* @returns Resolved patterns with absolute paths
|
|
8423
8430
|
*/
|
|
8431
|
+
// 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)
|
|
8424
8432
|
async resolvePatterns(patternType) {
|
|
8425
8433
|
if (!constants.getPatternsFor) {
|
|
8426
8434
|
return { framework: [], consumer: [], all: [] };
|
|
@@ -8575,6 +8583,9 @@ import {
|
|
|
8575
8583
|
} from "node:path";
|
|
8576
8584
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8577
8585
|
function readdirSync3(dirPath, options) {
|
|
8586
|
+
if (options !== null && typeof options === "object" && options.withFileTypes === true) {
|
|
8587
|
+
return pathResolverInstance.readdirSync(dirPath, options);
|
|
8588
|
+
}
|
|
8578
8589
|
return pathResolverInstance.readdirSync(dirPath, options);
|
|
8579
8590
|
}
|
|
8580
8591
|
var pathResolverInstance, getRepoRoot, normalizePath, pathExists, readSync, writeSync, statSync2, joinPath;
|
|
@@ -8644,6 +8655,31 @@ var init_typed_file_operations = __esm({
|
|
|
8644
8655
|
}
|
|
8645
8656
|
});
|
|
8646
8657
|
|
|
8658
|
+
// packages/tooling/src/utils/type-guards.ts
|
|
8659
|
+
function isObjectLike(value) {
|
|
8660
|
+
return typeof value === "object" && value !== null;
|
|
8661
|
+
}
|
|
8662
|
+
function asText(value) {
|
|
8663
|
+
return typeof value === "string" ? value : null;
|
|
8664
|
+
}
|
|
8665
|
+
function requireText(value, filePath) {
|
|
8666
|
+
if (typeof value !== "string") {
|
|
8667
|
+
throw new DoNotDevError(
|
|
8668
|
+
`Cannot read text file: ${filePath}`,
|
|
8669
|
+
DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
|
|
8670
|
+
{ context: { filePath } }
|
|
8671
|
+
);
|
|
8672
|
+
}
|
|
8673
|
+
return value;
|
|
8674
|
+
}
|
|
8675
|
+
var init_type_guards = __esm({
|
|
8676
|
+
"packages/tooling/src/utils/type-guards.ts"() {
|
|
8677
|
+
"use strict";
|
|
8678
|
+
init_utils2();
|
|
8679
|
+
init_errors();
|
|
8680
|
+
}
|
|
8681
|
+
});
|
|
8682
|
+
|
|
8647
8683
|
// packages/tooling/src/bundler/utils.ts
|
|
8648
8684
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
8649
8685
|
import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
@@ -8749,7 +8785,7 @@ function analyzeApp(appPath, appName) {
|
|
|
8749
8785
|
try {
|
|
8750
8786
|
const envPath = joinPath(appPath, ".env");
|
|
8751
8787
|
if (pathExists(envPath)) {
|
|
8752
|
-
const envContent = readSync(envPath);
|
|
8788
|
+
const envContent = requireText(readSync(envPath), envPath);
|
|
8753
8789
|
if (envContent.match(/VITE_SUPABASE_URL=.+/)) {
|
|
8754
8790
|
hasSupabase = true;
|
|
8755
8791
|
}
|
|
@@ -8796,7 +8832,7 @@ function analyzeApp(appPath, appName) {
|
|
|
8796
8832
|
try {
|
|
8797
8833
|
const envPath = joinPath(appPath, ".env");
|
|
8798
8834
|
if (pathExists(envPath)) {
|
|
8799
|
-
const envContent = readSync(envPath);
|
|
8835
|
+
const envContent = requireText(readSync(envPath), envPath);
|
|
8800
8836
|
const urlMatch = envContent.match(/VITE_SUPABASE_URL=(.+)/);
|
|
8801
8837
|
if (urlMatch && urlMatch[1]) {
|
|
8802
8838
|
url = urlMatch[1].trim();
|
|
@@ -8859,6 +8895,7 @@ var init_app_detection = __esm({
|
|
|
8859
8895
|
init_utils2();
|
|
8860
8896
|
init_pathResolver();
|
|
8861
8897
|
init_typed_file_operations();
|
|
8898
|
+
init_type_guards();
|
|
8862
8899
|
}
|
|
8863
8900
|
});
|
|
8864
8901
|
|
|
@@ -8900,7 +8937,7 @@ var init_app_selector = __esm({
|
|
|
8900
8937
|
"packages/tooling/src/utils/app-selector.ts"() {
|
|
8901
8938
|
"use strict";
|
|
8902
8939
|
init_utils2();
|
|
8903
|
-
|
|
8940
|
+
init_dist5();
|
|
8904
8941
|
init_app_detection();
|
|
8905
8942
|
init_cli_output();
|
|
8906
8943
|
}
|
|
@@ -8913,7 +8950,7 @@ async function askForMultiSelection(message, choices, defaultIndices = []) {
|
|
|
8913
8950
|
label: choice.title,
|
|
8914
8951
|
hint: choice.hint
|
|
8915
8952
|
}));
|
|
8916
|
-
const initialValues = defaultIndices.map((i2) => choices[i2]?.value).filter(Boolean);
|
|
8953
|
+
const initialValues = defaultIndices.map((i2) => choices[i2]?.value).filter((value) => Boolean(value));
|
|
8917
8954
|
const result = await multiselect({
|
|
8918
8955
|
message,
|
|
8919
8956
|
options,
|
|
@@ -8929,7 +8966,7 @@ var init_cli_input = __esm({
|
|
|
8929
8966
|
"packages/tooling/src/utils/cli-input.ts"() {
|
|
8930
8967
|
"use strict";
|
|
8931
8968
|
init_utils2();
|
|
8932
|
-
|
|
8969
|
+
init_dist5();
|
|
8933
8970
|
}
|
|
8934
8971
|
});
|
|
8935
8972
|
|
|
@@ -9010,12 +9047,17 @@ init_pathResolver();
|
|
|
9010
9047
|
import { spawnSync as spawnSync2, execFileSync } from "node:child_process";
|
|
9011
9048
|
import { platform as platform2 } from "node:os";
|
|
9012
9049
|
init_typed_file_operations();
|
|
9050
|
+
init_type_guards();
|
|
9013
9051
|
function discoverFirebaseProjectId(appPath) {
|
|
9014
9052
|
const firebasercPath = joinPath(appPath, ".firebaserc");
|
|
9015
9053
|
if (pathExists(firebasercPath)) {
|
|
9016
9054
|
try {
|
|
9017
|
-
const firebasercRaw = readSync(firebasercPath, {
|
|
9018
|
-
|
|
9055
|
+
const firebasercRaw = readSync(firebasercPath, {
|
|
9056
|
+
format: "json"
|
|
9057
|
+
});
|
|
9058
|
+
const projects = isObjectLike(firebasercRaw) ? firebasercRaw.projects : void 0;
|
|
9059
|
+
const defaultProject = isObjectLike(projects) ? projects.default : void 0;
|
|
9060
|
+
const firebaserc = typeof defaultProject === "string" ? { projects: { default: defaultProject } } : null;
|
|
9019
9061
|
if (firebaserc?.projects?.default) {
|
|
9020
9062
|
return firebaserc.projects.default;
|
|
9021
9063
|
}
|
|
@@ -9093,7 +9135,7 @@ function getEmulatorPorts(emulatorConfig) {
|
|
|
9093
9135
|
function loadEnvFile(filePath) {
|
|
9094
9136
|
if (!pathExists(filePath)) return;
|
|
9095
9137
|
try {
|
|
9096
|
-
const content = readSync(filePath, { format: "text" });
|
|
9138
|
+
const content = asText(readSync(filePath, { format: "text" }));
|
|
9097
9139
|
if (!content) return;
|
|
9098
9140
|
content.split("\n").forEach((line) => {
|
|
9099
9141
|
const trimmed = line.trim();
|
|
@@ -9166,7 +9208,7 @@ async function startFirebase(app, projectRoot, options = {}) {
|
|
|
9166
9208
|
);
|
|
9167
9209
|
}
|
|
9168
9210
|
if (useFunctions) {
|
|
9169
|
-
const existingContent = pathExists(envLocalPath) ? readSync(envLocalPath, { format: "text" }) || "" : "";
|
|
9211
|
+
const existingContent = pathExists(envLocalPath) ? asText(readSync(envLocalPath, { format: "text" })) || "" : "";
|
|
9170
9212
|
const hasAuthEmulatorHost = existingContent.includes(
|
|
9171
9213
|
"FIREBASE_AUTH_EMULATOR_HOST"
|
|
9172
9214
|
);
|