@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
|
@@ -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 m = t2 ? t2(c3, a2) : c3;
|
|
557
|
+
return a2 === 0 ? `${n3}${m}` : a2 === g.length - 1 ? `${s}${m}` : `${o}${m}`;
|
|
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, 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 m = t2.split(`
|
|
784
787
|
`).slice(n3);
|
|
785
|
-
this.output.write(
|
|
788
|
+
this.output.write(m.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
|
-
n$1 = class n extends
|
|
816
|
+
n$1 = class n extends C$1 {
|
|
814
817
|
options;
|
|
815
818
|
cursor = 0;
|
|
816
819
|
get _selectedValue() {
|
|
@@ -838,7 +841,7 @@ var init_dist3 = __esm({
|
|
|
838
841
|
});
|
|
839
842
|
}
|
|
840
843
|
};
|
|
841
|
-
n2 = class extends
|
|
844
|
+
n2 = class extends C$1 {
|
|
842
845
|
get userInputWithCursor() {
|
|
843
846
|
if (this.state === "submit")
|
|
844
847
|
return this.userInput;
|
|
@@ -865,7 +868,7 @@ var init_dist3 = __esm({
|
|
|
865
868
|
}
|
|
866
869
|
});
|
|
867
870
|
|
|
868
|
-
// node_modules/.bun/@clack+prompts@1.
|
|
871
|
+
// node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs
|
|
869
872
|
import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
870
873
|
import process$1 from "node:process";
|
|
871
874
|
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
@@ -876,22 +879,23 @@ function isUnicodeSupported() {
|
|
|
876
879
|
}
|
|
877
880
|
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";
|
|
878
881
|
}
|
|
879
|
-
function formatInstructionFooter(o,
|
|
880
|
-
const
|
|
881
|
-
|
|
882
|
+
function formatInstructionFooter(e, o, r2) {
|
|
883
|
+
const s = r2 ? `${styleText2("cyan", S_BAR)} ` : "", n3 = wrapTextWithPrefix(e, o.join(" \u2022 "), s).split(`
|
|
884
|
+
`);
|
|
885
|
+
return r2 && n3.push(styleText2("cyan", S_BAR_END)), n3;
|
|
882
886
|
}
|
|
883
|
-
var
|
|
884
|
-
var
|
|
885
|
-
"node_modules/.bun/@clack+prompts@1.
|
|
887
|
+
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, log, cancel, intro, outro, W, C2, note, Y, Z, spinner, u2, SELECT_INSTRUCTIONS, c2, select, i, text;
|
|
888
|
+
var init_dist5 = __esm({
|
|
889
|
+
"node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs"() {
|
|
886
890
|
init_utils2();
|
|
887
|
-
|
|
888
|
-
|
|
891
|
+
init_dist4();
|
|
892
|
+
init_dist4();
|
|
889
893
|
init_main();
|
|
890
894
|
init_dist2();
|
|
891
|
-
|
|
895
|
+
init_dist3();
|
|
892
896
|
unicode = isUnicodeSupported();
|
|
893
897
|
isCI = () => process.env.CI === "true";
|
|
894
|
-
unicodeOr = (
|
|
898
|
+
unicodeOr = (e, o) => unicode ? e : o;
|
|
895
899
|
S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
896
900
|
S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
897
901
|
S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
@@ -917,8 +921,8 @@ var init_dist4 = __esm({
|
|
|
917
921
|
S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
918
922
|
S_WARN = unicodeOr("\u25B2", "!");
|
|
919
923
|
S_ERROR = unicodeOr("\u25A0", "x");
|
|
920
|
-
symbol = (
|
|
921
|
-
switch (
|
|
924
|
+
symbol = (e) => {
|
|
925
|
+
switch (e) {
|
|
922
926
|
case "initial":
|
|
923
927
|
case "active":
|
|
924
928
|
return styleText2("cyan", S_STEP_ACTIVE);
|
|
@@ -932,8 +936,8 @@ var init_dist4 = __esm({
|
|
|
932
936
|
return styleText2("dim", S_STEP_ACTIVE);
|
|
933
937
|
}
|
|
934
938
|
};
|
|
935
|
-
symbolBar = (
|
|
936
|
-
switch (
|
|
939
|
+
symbolBar = (e) => {
|
|
940
|
+
switch (e) {
|
|
937
941
|
case "initial":
|
|
938
942
|
case "active":
|
|
939
943
|
return styleText2("cyan", S_BAR);
|
|
@@ -945,45 +949,45 @@ var init_dist4 = __esm({
|
|
|
945
949
|
return styleText2("green", S_BAR);
|
|
946
950
|
}
|
|
947
951
|
};
|
|
948
|
-
|
|
952
|
+
E$1 = (l, e, w, p, b, C3 = false) => {
|
|
949
953
|
let r2 = e, O = 0;
|
|
950
|
-
if (
|
|
954
|
+
if (C3)
|
|
951
955
|
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
952
|
-
const m =
|
|
956
|
+
const m = l[i2];
|
|
953
957
|
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
954
958
|
}
|
|
955
959
|
else
|
|
956
960
|
for (let i2 = w; i2 < p; i2++) {
|
|
957
|
-
const m =
|
|
961
|
+
const m = l[i2];
|
|
958
962
|
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
959
963
|
}
|
|
960
964
|
return { lineCount: r2, removals: O };
|
|
961
965
|
};
|
|
962
966
|
limitOptions = ({
|
|
963
|
-
cursor:
|
|
967
|
+
cursor: l,
|
|
964
968
|
options: e,
|
|
965
969
|
style: w,
|
|
966
970
|
output: p = process.stdout,
|
|
967
971
|
maxItems: b = Number.POSITIVE_INFINITY,
|
|
968
|
-
columnPadding:
|
|
972
|
+
columnPadding: C3 = 0,
|
|
969
973
|
rowPadding: r2 = 4
|
|
970
974
|
}) => {
|
|
971
|
-
const i2 = getColumns(p) -
|
|
975
|
+
const i2 = getColumns(p) - C3, m = getRows(p), M = styleText2("dim", "..."), v = Math.max(m - r2, 0), a2 = Math.max(Math.min(b, v), 5);
|
|
972
976
|
let f = 0;
|
|
973
|
-
|
|
974
|
-
Math.min(
|
|
977
|
+
l >= a2 - 3 && (f = Math.max(
|
|
978
|
+
Math.min(l - a2 + 3, e.length - a2),
|
|
975
979
|
0
|
|
976
980
|
));
|
|
977
|
-
let d = a2 < e.length && f > 0,
|
|
978
|
-
const
|
|
981
|
+
let d = a2 < e.length && f > 0, c3 = a2 < e.length && f + a2 < e.length;
|
|
982
|
+
const I = Math.min(
|
|
979
983
|
f + a2,
|
|
980
984
|
e.length
|
|
981
985
|
), s = [];
|
|
982
986
|
let g = 0;
|
|
983
|
-
d && g++,
|
|
984
|
-
const T = f + (d ? 1 : 0),
|
|
985
|
-
for (let t2 = T; t2 <
|
|
986
|
-
const n3 = e[t2], o = n3 ? w(n3, t2 ===
|
|
987
|
+
d && g++, c3 && g++;
|
|
988
|
+
const T = f + (d ? 1 : 0), W2 = I - (c3 ? 1 : 0);
|
|
989
|
+
for (let t2 = T; t2 < W2; t2++) {
|
|
990
|
+
const n3 = e[t2], o = n3 !== void 0 ? w(n3, t2 === l) : "", h2 = wrapAnsi(o, i2, {
|
|
987
991
|
hard: true,
|
|
988
992
|
trim: false
|
|
989
993
|
}).split(`
|
|
@@ -992,9 +996,9 @@ var init_dist4 = __esm({
|
|
|
992
996
|
}
|
|
993
997
|
if (g > v) {
|
|
994
998
|
let t2 = 0, n3 = 0, o = g;
|
|
995
|
-
const h2 =
|
|
999
|
+
const h2 = l - T;
|
|
996
1000
|
let u3 = v;
|
|
997
|
-
const L = () =>
|
|
1001
|
+
const L = () => E$1(s, o, 0, h2, u3), y = () => E$1(
|
|
998
1002
|
s,
|
|
999
1003
|
o,
|
|
1000
1004
|
h2 + 1,
|
|
@@ -1002,14 +1006,14 @@ var init_dist4 = __esm({
|
|
|
1002
1006
|
u3,
|
|
1003
1007
|
true
|
|
1004
1008
|
);
|
|
1005
|
-
d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (
|
|
1009
|
+
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));
|
|
1006
1010
|
}
|
|
1007
1011
|
const x = [];
|
|
1008
1012
|
d && x.push(M);
|
|
1009
1013
|
for (const t2 of s)
|
|
1010
1014
|
for (const n3 of t2)
|
|
1011
1015
|
x.push(n3);
|
|
1012
|
-
return
|
|
1016
|
+
return c3 && x.push(M), x;
|
|
1013
1017
|
};
|
|
1014
1018
|
confirm = (e) => {
|
|
1015
1019
|
const a2 = e.active ?? "Yes", o = e.inactive ?? "No";
|
|
@@ -1021,22 +1025,22 @@ var init_dist4 = __esm({
|
|
|
1021
1025
|
output: e.output,
|
|
1022
1026
|
initialValue: e.initialValue ?? true,
|
|
1023
1027
|
render() {
|
|
1024
|
-
const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `,
|
|
1028
|
+
const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l = i2 ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
|
|
1025
1029
|
e.output,
|
|
1026
1030
|
e.message,
|
|
1027
|
-
|
|
1031
|
+
l,
|
|
1028
1032
|
u3
|
|
1029
1033
|
), s = `${i2 ? `${styleText2("gray", S_BAR)}
|
|
1030
1034
|
` : ""}${f}
|
|
1031
|
-
`,
|
|
1035
|
+
`, c3 = this.value ? a2 : o;
|
|
1032
1036
|
switch (this.state) {
|
|
1033
1037
|
case "submit": {
|
|
1034
1038
|
const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
|
|
1035
|
-
return `${s}${r2}${styleText2("dim",
|
|
1039
|
+
return `${s}${r2}${styleText2("dim", c3)}`;
|
|
1036
1040
|
}
|
|
1037
1041
|
case "cancel": {
|
|
1038
1042
|
const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
|
|
1039
|
-
return `${s}${r2}${styleText2(["strikethrough", "dim"],
|
|
1043
|
+
return `${s}${r2}${styleText2(["strikethrough", "dim"], c3)}${i2 ? `
|
|
1040
1044
|
${styleText2("gray", S_BAR)}` : ""}`;
|
|
1041
1045
|
}
|
|
1042
1046
|
default: {
|
|
@@ -1061,18 +1065,18 @@ ${g}
|
|
|
1061
1065
|
symbol: e = styleText2("gray", S_BAR),
|
|
1062
1066
|
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
1063
1067
|
output: m = process.stdout,
|
|
1064
|
-
spacing:
|
|
1065
|
-
withGuide:
|
|
1068
|
+
spacing: l = 1,
|
|
1069
|
+
withGuide: c3
|
|
1066
1070
|
} = {}) => {
|
|
1067
|
-
const t2 = [], o =
|
|
1068
|
-
for (let i2 = 0; i2 <
|
|
1071
|
+
const t2 = [], o = c3 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
|
|
1072
|
+
for (let i2 = 0; i2 < l; i2++)
|
|
1069
1073
|
t2.push(f);
|
|
1070
1074
|
const g = Array.isArray(s) ? s : s.split(`
|
|
1071
1075
|
`);
|
|
1072
1076
|
if (g.length > 0) {
|
|
1073
|
-
const [i2, ...
|
|
1077
|
+
const [i2, ...y] = g;
|
|
1074
1078
|
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
1075
|
-
for (const p of
|
|
1079
|
+
for (const p of y)
|
|
1076
1080
|
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
1077
1081
|
}
|
|
1078
1082
|
m.write(`${t2.join(`
|
|
@@ -1117,18 +1121,18 @@ ${styleText2("gray", S_BAR_END)} ` : "";
|
|
|
1117
1121
|
|
|
1118
1122
|
`);
|
|
1119
1123
|
};
|
|
1120
|
-
W
|
|
1121
|
-
|
|
1124
|
+
W = (o) => o;
|
|
1125
|
+
C2 = (o, e, s) => {
|
|
1122
1126
|
const a2 = {
|
|
1123
1127
|
hard: true,
|
|
1124
1128
|
trim: false
|
|
1125
1129
|
}, i2 = wrapAnsi(o, e, a2).split(`
|
|
1126
|
-
`),
|
|
1130
|
+
`), 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);
|
|
1127
1131
|
return wrapAnsi(o, g, a2);
|
|
1128
1132
|
};
|
|
1129
1133
|
note = (o = "", e = "", s) => {
|
|
1130
|
-
const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide,
|
|
1131
|
-
`).map(
|
|
1134
|
+
const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c3 = s?.format ?? W, g = ["", ...C2(o, getColumns(a2) - 6, c3).split(`
|
|
1135
|
+
`).map(c3), ""], n3 = dist_default2(e), t2 = Math.max(
|
|
1132
1136
|
g.reduce((m, F) => {
|
|
1133
1137
|
const O = dist_default2(F);
|
|
1134
1138
|
return O > m ? O : m;
|
|
@@ -1149,83 +1153,102 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
|
1149
1153
|
`
|
|
1150
1154
|
);
|
|
1151
1155
|
};
|
|
1152
|
-
|
|
1156
|
+
Y = 3e4;
|
|
1157
|
+
Z = (c3) => styleText2("magenta", c3);
|
|
1153
1158
|
spinner = ({
|
|
1154
|
-
indicator:
|
|
1155
|
-
onCancel:
|
|
1159
|
+
indicator: c3 = "dots",
|
|
1160
|
+
onCancel: b,
|
|
1156
1161
|
output: n3 = process.stdout,
|
|
1157
|
-
cancelMessage:
|
|
1158
|
-
errorMessage:
|
|
1159
|
-
frames:
|
|
1160
|
-
delay:
|
|
1161
|
-
signal:
|
|
1162
|
-
...
|
|
1162
|
+
cancelMessage: _,
|
|
1163
|
+
errorMessage: C3,
|
|
1164
|
+
frames: M = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
|
|
1165
|
+
delay: O = unicode ? 80 : 120,
|
|
1166
|
+
signal: g,
|
|
1167
|
+
...E
|
|
1163
1168
|
} = {}) => {
|
|
1164
|
-
const u3 = isCI();
|
|
1165
|
-
let
|
|
1166
|
-
const
|
|
1167
|
-
const
|
|
1168
|
-
|
|
1169
|
-
},
|
|
1170
|
-
process.on("uncaughtExceptionMonitor",
|
|
1171
|
-
},
|
|
1172
|
-
process.removeListener("uncaughtExceptionMonitor",
|
|
1173
|
-
},
|
|
1174
|
-
if (
|
|
1169
|
+
const u3 = isCI(), h2 = isAccessible(E.accessible);
|
|
1170
|
+
let x, I, p = false, l = false, r2 = "", v, w = performance.now();
|
|
1171
|
+
const y = getColumns(n3), F = E?.styleFrame ?? Z, S = (e) => {
|
|
1172
|
+
const s = e > 1 ? C3 ?? settings.messages.error : _ ?? settings.messages.cancel;
|
|
1173
|
+
l = e === 1, p && (m(s, e), l && typeof b == "function" && b());
|
|
1174
|
+
}, $ = () => S(2), a2 = () => S(1), H = () => {
|
|
1175
|
+
process.on("uncaughtExceptionMonitor", $), process.on("unhandledRejection", $), process.on("SIGINT", a2), process.on("SIGTERM", a2), process.on("exit", S), g && g.addEventListener("abort", a2);
|
|
1176
|
+
}, B = () => {
|
|
1177
|
+
process.removeListener("uncaughtExceptionMonitor", $), process.removeListener("unhandledRejection", $), process.removeListener("SIGINT", a2), process.removeListener("SIGTERM", a2), process.removeListener("exit", S), g && g.removeEventListener("abort", a2);
|
|
1178
|
+
}, R2 = () => {
|
|
1179
|
+
if (v === void 0) return;
|
|
1175
1180
|
u3 && n3.write(`
|
|
1176
1181
|
`);
|
|
1177
|
-
const
|
|
1182
|
+
const s = wrapAnsi(v, y, {
|
|
1178
1183
|
hard: true,
|
|
1179
1184
|
trim: false
|
|
1180
1185
|
}).split(`
|
|
1181
1186
|
`);
|
|
1182
|
-
|
|
1183
|
-
},
|
|
1184
|
-
const
|
|
1185
|
-
return
|
|
1186
|
-
}, N =
|
|
1187
|
-
|
|
1187
|
+
s.length > 1 && n3.write(cursor.up(s.length - 1)), n3.write(cursor.to(0)), n3.write(erase.down());
|
|
1188
|
+
}, L = (e) => e.replace(/\.+$/, ""), T = (e) => {
|
|
1189
|
+
const s = (performance.now() - e) / 1e3, i2 = Math.floor(s / 60), t2 = Math.floor(s % 60);
|
|
1190
|
+
return i2 > 0 ? `[${i2}m ${t2}s]` : `[${t2}s]`;
|
|
1191
|
+
}, N = E.withGuide ?? settings.withGuide, P = (e = "") => {
|
|
1192
|
+
if (p = true, l = false, r2 = L(e), w = performance.now(), H(), h2) {
|
|
1193
|
+
r2 !== "" && n3.write(`${r2}
|
|
1194
|
+
`), I = setInterval(() => {
|
|
1195
|
+
n3.write(r2 === "" ? `still working
|
|
1196
|
+
` : `still working: ${r2}
|
|
1197
|
+
`);
|
|
1198
|
+
}, Y);
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
1201
|
+
x = block({ output: n3 }), N && n3.write(`${styleText2("gray", S_BAR)}
|
|
1188
1202
|
`);
|
|
1189
|
-
let
|
|
1190
|
-
|
|
1191
|
-
if (u3 &&
|
|
1203
|
+
let s = 0, i2 = 0;
|
|
1204
|
+
I = setInterval(() => {
|
|
1205
|
+
if (u3 && r2 === v)
|
|
1192
1206
|
return;
|
|
1193
|
-
|
|
1194
|
-
const
|
|
1195
|
-
let
|
|
1207
|
+
R2(), v = r2;
|
|
1208
|
+
const t2 = F(M[s]);
|
|
1209
|
+
let o;
|
|
1196
1210
|
if (u3)
|
|
1197
|
-
|
|
1198
|
-
else if (
|
|
1199
|
-
|
|
1211
|
+
o = `${t2} ${r2}...`;
|
|
1212
|
+
else if (c3 === "timer")
|
|
1213
|
+
o = `${t2} ${r2} ${T(w)}`;
|
|
1200
1214
|
else {
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1215
|
+
const j = ".".repeat(Math.floor(i2)).slice(0, 3);
|
|
1216
|
+
o = `${t2} ${r2}${j}`;
|
|
1203
1217
|
}
|
|
1204
|
-
const
|
|
1218
|
+
const D = wrapAnsi(o, y, {
|
|
1205
1219
|
hard: true,
|
|
1206
1220
|
trim: false
|
|
1207
1221
|
});
|
|
1208
|
-
n3.write(
|
|
1209
|
-
},
|
|
1210
|
-
},
|
|
1211
|
-
if (
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
`)
|
|
1222
|
+
n3.write(D), s = s + 1 < M.length ? s + 1 : 0, i2 = i2 < 4 ? i2 + 0.125 : 0;
|
|
1223
|
+
}, O);
|
|
1224
|
+
}, m = (e = "", s = 0, i2 = false) => {
|
|
1225
|
+
if (p) {
|
|
1226
|
+
if (p = false, l = s === 1, clearInterval(I), h2 || R2(), r2 = e ?? r2, !i2)
|
|
1227
|
+
if (h2) {
|
|
1228
|
+
const t2 = s === 1 ? _ ?? settings.messages.cancel : s === 2 ? C3 ?? settings.messages.error : "Done", o = r2 || t2;
|
|
1229
|
+
c3 === "timer" ? n3.write(`${o} ${T(w)}
|
|
1230
|
+
`) : n3.write(`${o}
|
|
1231
|
+
`);
|
|
1232
|
+
} else {
|
|
1233
|
+
const t2 = s === 0 ? styleText2("green", S_STEP_SUBMIT) : s === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
|
|
1234
|
+
c3 === "timer" ? n3.write(`${t2} ${r2} ${T(w)}
|
|
1235
|
+
`) : n3.write(`${t2} ${r2}
|
|
1236
|
+
`);
|
|
1237
|
+
}
|
|
1238
|
+
B(), x?.();
|
|
1239
|
+
}
|
|
1217
1240
|
};
|
|
1218
1241
|
return {
|
|
1219
1242
|
start: P,
|
|
1220
|
-
stop: (e = "") =>
|
|
1243
|
+
stop: (e = "") => m(e, 0),
|
|
1221
1244
|
message: (e = "") => {
|
|
1222
|
-
|
|
1245
|
+
r2 = L(e ?? r2);
|
|
1223
1246
|
},
|
|
1224
|
-
cancel: (e = "") =>
|
|
1225
|
-
error: (e = "") =>
|
|
1226
|
-
clear: () =>
|
|
1247
|
+
cancel: (e = "") => m(e, 1),
|
|
1248
|
+
error: (e = "") => m(e, 2),
|
|
1249
|
+
clear: () => m("", 0, true),
|
|
1227
1250
|
get isCancelled() {
|
|
1228
|
-
return
|
|
1251
|
+
return l;
|
|
1229
1252
|
}
|
|
1230
1253
|
};
|
|
1231
1254
|
};
|
|
@@ -1238,7 +1261,7 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
|
1238
1261
|
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1239
1262
|
`${styleText2("dim", "Enter:")} confirm`
|
|
1240
1263
|
];
|
|
1241
|
-
|
|
1264
|
+
c2 = (t2, o) => t2.includes(`
|
|
1242
1265
|
`) ? t2.split(`
|
|
1243
1266
|
`).map((d) => o(d)).join(`
|
|
1244
1267
|
`) : o(t2);
|
|
@@ -1249,15 +1272,15 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
|
1249
1272
|
const s = n3.label ?? String(n3.value);
|
|
1250
1273
|
switch (m) {
|
|
1251
1274
|
case "disabled":
|
|
1252
|
-
return `${styleText2("gray", S_RADIO_INACTIVE)} ${
|
|
1275
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
|
|
1253
1276
|
case "selected":
|
|
1254
|
-
return `${
|
|
1277
|
+
return `${c2(s, (i2) => styleText2("dim", i2))}`;
|
|
1255
1278
|
case "active":
|
|
1256
1279
|
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
|
|
1257
1280
|
case "cancelled":
|
|
1258
|
-
return `${
|
|
1281
|
+
return `${c2(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
|
|
1259
1282
|
default:
|
|
1260
|
-
return `${styleText2("dim", S_RADIO_INACTIVE)} ${
|
|
1283
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("dim", i2))}`;
|
|
1261
1284
|
}
|
|
1262
1285
|
}, d = t2.showInstructions ?? true;
|
|
1263
1286
|
return new n$1({
|
|
@@ -1295,7 +1318,7 @@ ${styleText2("gray", S_BAR)}` : ""}`;
|
|
|
1295
1318
|
}
|
|
1296
1319
|
default: {
|
|
1297
1320
|
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
|
|
1298
|
-
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
1321
|
+
`).length, p = d ? formatInstructionFooter(t2.output, SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
1299
1322
|
`), b = p.length + 1;
|
|
1300
1323
|
return `${u3}${r2}${limitOptions({
|
|
1301
1324
|
output: t2.output,
|
|
@@ -1324,7 +1347,7 @@ ${f}
|
|
|
1324
1347
|
signal: t2.signal,
|
|
1325
1348
|
input: t2.input,
|
|
1326
1349
|
render() {
|
|
1327
|
-
const r2 = t2?.withGuide ?? settings.withGuide,
|
|
1350
|
+
const r2 = t2?.withGuide ?? settings.withGuide, l = `${`${r2 ? `${styleText2("gray", S_BAR)}
|
|
1328
1351
|
` : ""}${symbol(this.state)} `}${t2.message}
|
|
1329
1352
|
`, d = t2.placeholder && t2.placeholder.length > 0 ? (
|
|
1330
1353
|
// biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
|
|
@@ -1332,30 +1355,30 @@ ${f}
|
|
|
1332
1355
|
) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
|
|
1333
1356
|
switch (this.state) {
|
|
1334
1357
|
case "validating": {
|
|
1335
|
-
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "",
|
|
1336
|
-
return `${
|
|
1358
|
+
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "", c3 = styleText2("dim", o), $ = styleText2("dim", "Validating...");
|
|
1359
|
+
return `${l}${n3}${c3}
|
|
1337
1360
|
${i2} ${$}
|
|
1338
1361
|
`;
|
|
1339
1362
|
}
|
|
1340
1363
|
case "error": {
|
|
1341
|
-
const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", i2 = r2 ? `${styleText2("yellow", S_BAR)} ` : "",
|
|
1342
|
-
return `${
|
|
1364
|
+
const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", i2 = r2 ? `${styleText2("yellow", S_BAR)} ` : "", c3 = r2 ? styleText2("yellow", S_BAR_END) : "";
|
|
1365
|
+
return `${l.trim()}
|
|
1343
1366
|
${i2}${o}
|
|
1344
|
-
${
|
|
1367
|
+
${c3}${n3}
|
|
1345
1368
|
`;
|
|
1346
1369
|
}
|
|
1347
1370
|
case "submit": {
|
|
1348
1371
|
const n3 = s ? `${r2 ? " " : ""}${styleText2("dim", s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
|
|
1349
|
-
return `${
|
|
1372
|
+
return `${l}${i2}${n3}`;
|
|
1350
1373
|
}
|
|
1351
1374
|
case "cancel": {
|
|
1352
1375
|
const n3 = s ? ` ${styleText2(["strikethrough", "dim"], s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
|
|
1353
|
-
return `${
|
|
1376
|
+
return `${l}${i2}${n3}${s.trim() ? `
|
|
1354
1377
|
${i2}` : ""}`;
|
|
1355
1378
|
}
|
|
1356
1379
|
default: {
|
|
1357
1380
|
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "";
|
|
1358
|
-
return `${
|
|
1381
|
+
return `${l}${n3}${o}
|
|
1359
1382
|
${i2}
|
|
1360
1383
|
`;
|
|
1361
1384
|
}
|
|
@@ -1466,8 +1489,8 @@ var init_cli_output = __esm({
|
|
|
1466
1489
|
"packages/tooling/src/utils/cli-output.ts"() {
|
|
1467
1490
|
"use strict";
|
|
1468
1491
|
init_utils2();
|
|
1469
|
-
|
|
1470
|
-
|
|
1492
|
+
init_dist5();
|
|
1493
|
+
init_dist5();
|
|
1471
1494
|
colors = {
|
|
1472
1495
|
reset: "\x1B[0m",
|
|
1473
1496
|
// Success (green)
|
|
@@ -1579,6 +1602,148 @@ var init_cli_output = __esm({
|
|
|
1579
1602
|
}
|
|
1580
1603
|
});
|
|
1581
1604
|
|
|
1605
|
+
// packages/tooling/src/utils/errors.ts
|
|
1606
|
+
var DO_NOT_DEV_ERROR_CODES, DoNotDevError;
|
|
1607
|
+
var init_errors = __esm({
|
|
1608
|
+
"packages/tooling/src/utils/errors.ts"() {
|
|
1609
|
+
"use strict";
|
|
1610
|
+
init_utils2();
|
|
1611
|
+
DO_NOT_DEV_ERROR_CODES = {
|
|
1612
|
+
CONFIGURATION_ERROR: "configuration-error",
|
|
1613
|
+
CONFIG_NOT_FOUND: "config-not-found",
|
|
1614
|
+
CONFIG_INVALID: "config-invalid",
|
|
1615
|
+
PATH_RESOLUTION_ERROR: "path-resolution-error",
|
|
1616
|
+
FILE_OPERATION_ERROR: "file-operation-error",
|
|
1617
|
+
FILE_NOT_FOUND: "file-not-found",
|
|
1618
|
+
PERMISSION_DENIED: "permission-denied",
|
|
1619
|
+
GENERATION_ERROR: "generation-error",
|
|
1620
|
+
TEMPLATE_ERROR: "template-error",
|
|
1621
|
+
TEMPLATE_NOT_FOUND: "template-not-found",
|
|
1622
|
+
CLI_EXECUTION_ERROR: "cli-execution-error",
|
|
1623
|
+
COMMAND_NOT_FOUND: "command-not-found",
|
|
1624
|
+
COMMAND_FAILED: "command-failed",
|
|
1625
|
+
VALIDATION_ERROR: "validation-error",
|
|
1626
|
+
SCHEMA_ERROR: "schema-error",
|
|
1627
|
+
DEPENDENCY_ERROR: "dependency-error",
|
|
1628
|
+
DEPENDENCY_NOT_FOUND: "dependency-not-found",
|
|
1629
|
+
DEPENDENCY_VERSION_ERROR: "dependency-version-error",
|
|
1630
|
+
INVALID_ARGUMENT: "invalid-argument",
|
|
1631
|
+
MISSING_ARGUMENT: "missing-argument",
|
|
1632
|
+
MISSING_PROJECT_ID: "missing-project-id",
|
|
1633
|
+
FIREBASE_CLI_ERROR: "firebase-cli-error",
|
|
1634
|
+
DEPLOYMENT_FAILED: "deployment-failed",
|
|
1635
|
+
VERCEL_API_ERROR: "vercel-api-error",
|
|
1636
|
+
OPERATION_CANCELLED: "operation-cancelled",
|
|
1637
|
+
TIMEOUT_ERROR: "timeout-error",
|
|
1638
|
+
UNKNOWN_ERROR: "unknown-error"
|
|
1639
|
+
};
|
|
1640
|
+
DoNotDevError = class _DoNotDevError extends Error {
|
|
1641
|
+
/** The error code categorizing this error */
|
|
1642
|
+
code;
|
|
1643
|
+
/** Original error if this is wrapping another error */
|
|
1644
|
+
originalError;
|
|
1645
|
+
/** Additional context for the error */
|
|
1646
|
+
context;
|
|
1647
|
+
/** Whether this error should be displayed to the user */
|
|
1648
|
+
displayable;
|
|
1649
|
+
/**
|
|
1650
|
+
* Creates a new DoNotDev error
|
|
1651
|
+
*
|
|
1652
|
+
* @param {string} message - Error message
|
|
1653
|
+
* @param {DoNotDevErrorCode} code - Error code
|
|
1654
|
+
* @param {object} [options] - Additional error options
|
|
1655
|
+
* @param {Error} [options.originalError] - Original error if wrapping
|
|
1656
|
+
* @param {Record<string, unknown>} [options.context] - Additional context data
|
|
1657
|
+
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
1658
|
+
*/
|
|
1659
|
+
constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
|
|
1660
|
+
super(message);
|
|
1661
|
+
this.name = "DoNotDevError";
|
|
1662
|
+
this.code = code;
|
|
1663
|
+
this.originalError = options?.originalError;
|
|
1664
|
+
this.context = options?.context;
|
|
1665
|
+
this.displayable = options?.displayable !== false;
|
|
1666
|
+
Object.setPrototypeOf(this, _DoNotDevError.prototype);
|
|
1667
|
+
if (Error.captureStackTrace) {
|
|
1668
|
+
Error.captureStackTrace(this, _DoNotDevError);
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
/**
|
|
1672
|
+
* Formats the error for logging or display
|
|
1673
|
+
*
|
|
1674
|
+
* @returns {string} Formatted error message with code
|
|
1675
|
+
*/
|
|
1676
|
+
format() {
|
|
1677
|
+
return `[${this.code}] ${this.message}`;
|
|
1678
|
+
}
|
|
1679
|
+
/**
|
|
1680
|
+
* Creates a wrapped error from another error
|
|
1681
|
+
*
|
|
1682
|
+
* @param {Error} error - Original error to wrap
|
|
1683
|
+
* @param {string} [context] - Additional context for the error
|
|
1684
|
+
* @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
|
|
1685
|
+
* @param {object} [options] - Additional error options
|
|
1686
|
+
* @param {Record<string, unknown>} [options.context] - Additional context data
|
|
1687
|
+
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
1688
|
+
* @returns {DoNotDevError} New DoNotDev error wrapping the original
|
|
1689
|
+
*/
|
|
1690
|
+
static from(error2, context, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
|
|
1691
|
+
if (!(error2 instanceof Error)) {
|
|
1692
|
+
return new _DoNotDevError(
|
|
1693
|
+
`Unknown error: ${String(error2)}`,
|
|
1694
|
+
code,
|
|
1695
|
+
options
|
|
1696
|
+
);
|
|
1697
|
+
}
|
|
1698
|
+
if (error2 instanceof _DoNotDevError) {
|
|
1699
|
+
if (!context) {
|
|
1700
|
+
return error2;
|
|
1701
|
+
}
|
|
1702
|
+
return new _DoNotDevError(`${context}: ${error2.message}`, error2.code, {
|
|
1703
|
+
originalError: error2.originalError || error2,
|
|
1704
|
+
context: { ...error2.context, ...options?.context || {} },
|
|
1705
|
+
displayable: options?.displayable ?? error2.displayable
|
|
1706
|
+
});
|
|
1707
|
+
}
|
|
1708
|
+
const message = context ? `${context}: ${error2.message}` : error2.message;
|
|
1709
|
+
return new _DoNotDevError(message, code, {
|
|
1710
|
+
originalError: error2,
|
|
1711
|
+
context: options?.context,
|
|
1712
|
+
displayable: options?.displayable
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1715
|
+
/**
|
|
1716
|
+
* Maps common error types to DoNotDevErrorCode
|
|
1717
|
+
*
|
|
1718
|
+
* @param {Error} error - Error to analyze
|
|
1719
|
+
* @returns {DoNotDevErrorCode} Mapped error code
|
|
1720
|
+
*/
|
|
1721
|
+
static getErrorCodeFromError(error2) {
|
|
1722
|
+
if (error2 instanceof _DoNotDevError) {
|
|
1723
|
+
return error2.code;
|
|
1724
|
+
}
|
|
1725
|
+
const message = error2.message.toLowerCase();
|
|
1726
|
+
if (error2.name === "ValidationError" || message.includes("validation")) {
|
|
1727
|
+
return DO_NOT_DEV_ERROR_CODES.VALIDATION_ERROR;
|
|
1728
|
+
}
|
|
1729
|
+
if (message.includes("not found") || message.includes("no such file")) {
|
|
1730
|
+
return DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND;
|
|
1731
|
+
}
|
|
1732
|
+
if (message.includes("permission") || message.includes("access denied")) {
|
|
1733
|
+
return DO_NOT_DEV_ERROR_CODES.PERMISSION_DENIED;
|
|
1734
|
+
}
|
|
1735
|
+
if (message.includes("timeout") || message.includes("timed out")) {
|
|
1736
|
+
return DO_NOT_DEV_ERROR_CODES.TIMEOUT_ERROR;
|
|
1737
|
+
}
|
|
1738
|
+
if (message.includes("dependency") || message.includes("module not found")) {
|
|
1739
|
+
return DO_NOT_DEV_ERROR_CODES.DEPENDENCY_ERROR;
|
|
1740
|
+
}
|
|
1741
|
+
return DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR;
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
});
|
|
1746
|
+
|
|
1582
1747
|
// node_modules/.bun/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js
|
|
1583
1748
|
var require_array = __commonJS({
|
|
1584
1749
|
"node_modules/.bun/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js"(exports) {
|
|
@@ -7569,6 +7734,9 @@ import {
|
|
|
7569
7734
|
extname
|
|
7570
7735
|
} from "node:path";
|
|
7571
7736
|
import { fileURLToPath } from "node:url";
|
|
7737
|
+
function isEexistError(error2) {
|
|
7738
|
+
return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
|
|
7739
|
+
}
|
|
7572
7740
|
function safeExecuteAsync(fn, message) {
|
|
7573
7741
|
return fn().catch((error2) => {
|
|
7574
7742
|
throw new Error(
|
|
@@ -7940,7 +8108,7 @@ var init_PathResolver = __esm({
|
|
|
7940
8108
|
try {
|
|
7941
8109
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
7942
8110
|
} catch (error2) {
|
|
7943
|
-
if (error2
|
|
8111
|
+
if (!isEexistError(error2)) throw error2;
|
|
7944
8112
|
}
|
|
7945
8113
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
7946
8114
|
let writeContent;
|
|
@@ -8002,7 +8170,7 @@ var init_PathResolver = __esm({
|
|
|
8002
8170
|
try {
|
|
8003
8171
|
fs.mkdirSync(dir, { recursive: true });
|
|
8004
8172
|
} catch (error2) {
|
|
8005
|
-
if (error2
|
|
8173
|
+
if (!isEexistError(error2)) throw error2;
|
|
8006
8174
|
}
|
|
8007
8175
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
8008
8176
|
let writeContent;
|
|
@@ -8059,7 +8227,7 @@ var init_PathResolver = __esm({
|
|
|
8059
8227
|
try {
|
|
8060
8228
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
8061
8229
|
} catch (error2) {
|
|
8062
|
-
if (error2
|
|
8230
|
+
if (!isEexistError(error2)) throw error2;
|
|
8063
8231
|
}
|
|
8064
8232
|
try {
|
|
8065
8233
|
return await safeExecuteAsync(async () => {
|
|
@@ -8101,7 +8269,7 @@ var init_PathResolver = __esm({
|
|
|
8101
8269
|
try {
|
|
8102
8270
|
fs.mkdirSync(dir, { recursive: true });
|
|
8103
8271
|
} catch (error2) {
|
|
8104
|
-
if (error2
|
|
8272
|
+
if (!isEexistError(error2)) throw error2;
|
|
8105
8273
|
}
|
|
8106
8274
|
try {
|
|
8107
8275
|
fs.copyFileSync(srcPath, normalizedDestPath);
|
|
@@ -8217,7 +8385,7 @@ var init_PathResolver = __esm({
|
|
|
8217
8385
|
try {
|
|
8218
8386
|
await fs.promises.mkdir(dirPath, { recursive: true });
|
|
8219
8387
|
} catch (error2) {
|
|
8220
|
-
if (error2
|
|
8388
|
+
if (!isEexistError(error2)) throw error2;
|
|
8221
8389
|
}
|
|
8222
8390
|
}
|
|
8223
8391
|
/**
|
|
@@ -8229,7 +8397,7 @@ var init_PathResolver = __esm({
|
|
|
8229
8397
|
try {
|
|
8230
8398
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
8231
8399
|
} catch (error2) {
|
|
8232
|
-
if (error2
|
|
8400
|
+
if (!isEexistError(error2)) throw error2;
|
|
8233
8401
|
}
|
|
8234
8402
|
}
|
|
8235
8403
|
/**
|
|
@@ -8478,6 +8646,7 @@ var init_PathResolver = __esm({
|
|
|
8478
8646
|
* @param patternType - Type of patterns (css, routes, i18n, assets, pwa)
|
|
8479
8647
|
* @returns Resolved patterns with absolute paths
|
|
8480
8648
|
*/
|
|
8649
|
+
// 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)
|
|
8481
8650
|
async resolvePatterns(patternType) {
|
|
8482
8651
|
if (!constants.getPatternsFor) {
|
|
8483
8652
|
return { framework: [], consumer: [], all: [] };
|
|
@@ -8692,6 +8861,9 @@ import {
|
|
|
8692
8861
|
} from "node:path";
|
|
8693
8862
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8694
8863
|
function readdirSync3(dirPath, options) {
|
|
8864
|
+
if (options !== null && typeof options === "object" && options.withFileTypes === true) {
|
|
8865
|
+
return pathResolverInstance.readdirSync(dirPath, options);
|
|
8866
|
+
}
|
|
8695
8867
|
return pathResolverInstance.readdirSync(dirPath, options);
|
|
8696
8868
|
}
|
|
8697
8869
|
function getDirnameFromUrl(importMetaUrl) {
|
|
@@ -9010,6 +9182,50 @@ var init_pathResolver = __esm({
|
|
|
9010
9182
|
}
|
|
9011
9183
|
});
|
|
9012
9184
|
|
|
9185
|
+
// packages/tooling/src/utils/type-guards.ts
|
|
9186
|
+
function isObjectLike(value) {
|
|
9187
|
+
return typeof value === "object" && value !== null;
|
|
9188
|
+
}
|
|
9189
|
+
function asText(value) {
|
|
9190
|
+
return typeof value === "string" ? value : null;
|
|
9191
|
+
}
|
|
9192
|
+
function requireText(value, filePath) {
|
|
9193
|
+
if (typeof value !== "string") {
|
|
9194
|
+
throw new DoNotDevError(
|
|
9195
|
+
`Cannot read text file: ${filePath}`,
|
|
9196
|
+
DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
|
|
9197
|
+
{ context: { filePath } }
|
|
9198
|
+
);
|
|
9199
|
+
}
|
|
9200
|
+
return value;
|
|
9201
|
+
}
|
|
9202
|
+
function requireBuffer(value, filePath) {
|
|
9203
|
+
if (!Buffer2.isBuffer(value)) {
|
|
9204
|
+
throw new DoNotDevError(
|
|
9205
|
+
`Cannot read file: ${filePath}`,
|
|
9206
|
+
DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
|
|
9207
|
+
{ context: { filePath } }
|
|
9208
|
+
);
|
|
9209
|
+
}
|
|
9210
|
+
return value;
|
|
9211
|
+
}
|
|
9212
|
+
function pickAllowed(value, allowed, label) {
|
|
9213
|
+
const match = allowed.find((candidate) => candidate === value);
|
|
9214
|
+
if (match === void 0) {
|
|
9215
|
+
throw new Error(
|
|
9216
|
+
`Invalid ${label}: ${String(value)} (expected one of ${allowed.join(", ")})`
|
|
9217
|
+
);
|
|
9218
|
+
}
|
|
9219
|
+
return match;
|
|
9220
|
+
}
|
|
9221
|
+
var init_type_guards = __esm({
|
|
9222
|
+
"packages/tooling/src/utils/type-guards.ts"() {
|
|
9223
|
+
"use strict";
|
|
9224
|
+
init_utils2();
|
|
9225
|
+
init_errors();
|
|
9226
|
+
}
|
|
9227
|
+
});
|
|
9228
|
+
|
|
9013
9229
|
// packages/tooling/src/bundler/utils.ts
|
|
9014
9230
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
9015
9231
|
import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
@@ -9062,27 +9278,54 @@ async function askForConfirmation(message, defaultValue = false) {
|
|
|
9062
9278
|
return result;
|
|
9063
9279
|
}
|
|
9064
9280
|
async function askForSelection(message, choices, defaultValue = 0) {
|
|
9065
|
-
const options = choices.map((choice) =>
|
|
9066
|
-
value
|
|
9067
|
-
label: choice.title,
|
|
9068
|
-
|
|
9069
|
-
|
|
9281
|
+
const options = choices.map((choice) => {
|
|
9282
|
+
const value = choice.value;
|
|
9283
|
+
return { value, label: choice.title, hint: choice.hint };
|
|
9284
|
+
});
|
|
9285
|
+
const initialValue = choices[defaultValue]?.value;
|
|
9070
9286
|
const result = await select({
|
|
9071
9287
|
message,
|
|
9072
9288
|
options,
|
|
9073
|
-
initialValue
|
|
9289
|
+
initialValue
|
|
9074
9290
|
});
|
|
9075
9291
|
if (isCancel(result)) {
|
|
9076
9292
|
cancel("Operation cancelled.");
|
|
9077
9293
|
process.exit(0);
|
|
9078
9294
|
}
|
|
9079
|
-
|
|
9295
|
+
const picked = choices.find((choice) => choice.value === result);
|
|
9296
|
+
if (!picked) {
|
|
9297
|
+
throw new Error(`Unknown selection: ${result}`);
|
|
9298
|
+
}
|
|
9299
|
+
return picked.value;
|
|
9080
9300
|
}
|
|
9081
9301
|
var init_cli_input = __esm({
|
|
9082
9302
|
"packages/tooling/src/utils/cli-input.ts"() {
|
|
9083
9303
|
"use strict";
|
|
9084
9304
|
init_utils2();
|
|
9085
|
-
|
|
9305
|
+
init_dist5();
|
|
9306
|
+
}
|
|
9307
|
+
});
|
|
9308
|
+
|
|
9309
|
+
// packages/tooling/src/utils/error-handling.ts
|
|
9310
|
+
function isError(error2) {
|
|
9311
|
+
return error2 instanceof Error;
|
|
9312
|
+
}
|
|
9313
|
+
function getErrorMessage(error2) {
|
|
9314
|
+
if (isError(error2)) {
|
|
9315
|
+
return error2.message;
|
|
9316
|
+
}
|
|
9317
|
+
if (typeof error2 === "string") {
|
|
9318
|
+
return error2;
|
|
9319
|
+
}
|
|
9320
|
+
if (error2 && typeof error2 === "object" && "message" in error2) {
|
|
9321
|
+
return String(error2.message);
|
|
9322
|
+
}
|
|
9323
|
+
return String(error2);
|
|
9324
|
+
}
|
|
9325
|
+
var init_error_handling = __esm({
|
|
9326
|
+
"packages/tooling/src/utils/error-handling.ts"() {
|
|
9327
|
+
"use strict";
|
|
9328
|
+
init_utils2();
|
|
9086
9329
|
}
|
|
9087
9330
|
});
|
|
9088
9331
|
|
|
@@ -9098,7 +9341,9 @@ init_utils2();
|
|
|
9098
9341
|
// packages/tooling/src/utils/create-utils.ts
|
|
9099
9342
|
init_utils2();
|
|
9100
9343
|
init_cli_output();
|
|
9344
|
+
init_error_handling();
|
|
9101
9345
|
init_pathResolver();
|
|
9346
|
+
init_type_guards();
|
|
9102
9347
|
async function isTextFile(filePath) {
|
|
9103
9348
|
const binaryExtensions = [
|
|
9104
9349
|
".png",
|
|
@@ -9145,7 +9390,10 @@ async function isTextFile(filePath) {
|
|
|
9145
9390
|
if (textExtensions.some((ext) => filePath.toLowerCase().endsWith(ext)))
|
|
9146
9391
|
return true;
|
|
9147
9392
|
try {
|
|
9148
|
-
const buffer =
|
|
9393
|
+
const buffer = requireBuffer(
|
|
9394
|
+
await read(filePath, { format: "buffer" }),
|
|
9395
|
+
filePath
|
|
9396
|
+
);
|
|
9149
9397
|
if (buffer.length === 0) return true;
|
|
9150
9398
|
for (let i2 = 0; i2 < Math.min(buffer.length, 1e3); i2++) {
|
|
9151
9399
|
if (buffer[i2] === 0) return false;
|
|
@@ -9157,7 +9405,7 @@ async function isTextFile(filePath) {
|
|
|
9157
9405
|
}
|
|
9158
9406
|
async function replacePlaceholders(filePath, replacements) {
|
|
9159
9407
|
try {
|
|
9160
|
-
let content = await read(filePath, { format: "text" });
|
|
9408
|
+
let content = asText(await read(filePath, { format: "text" }));
|
|
9161
9409
|
if (typeof content !== "string") {
|
|
9162
9410
|
content = typeof content === "object" ? JSON.stringify(content, null, 2) : String(content);
|
|
9163
9411
|
}
|
|
@@ -9174,7 +9422,7 @@ async function replacePlaceholders(filePath, replacements) {
|
|
|
9174
9422
|
await write(filePath, content, { overwrite: true });
|
|
9175
9423
|
} catch (error2) {
|
|
9176
9424
|
log2.warn(
|
|
9177
|
-
`Warning: Could not process file ${filePath}: ${error2
|
|
9425
|
+
`Warning: Could not process file ${filePath}: ${getErrorMessage(error2) || "Unknown error"}`
|
|
9178
9426
|
);
|
|
9179
9427
|
}
|
|
9180
9428
|
}
|
|
@@ -9235,7 +9483,7 @@ async function updateRootPackageJson(rootDir, appNames) {
|
|
|
9235
9483
|
packageJson.scripts = packageJson.scripts || {};
|
|
9236
9484
|
} catch (error2) {
|
|
9237
9485
|
log2.warn(
|
|
9238
|
-
`Warning: Could not update root package.json: ${error2
|
|
9486
|
+
`Warning: Could not update root package.json: ${getErrorMessage(error2) || "Unknown error"}`
|
|
9239
9487
|
);
|
|
9240
9488
|
}
|
|
9241
9489
|
}
|
|
@@ -9427,7 +9675,9 @@ var PROJECT_QUESTIONNAIRE = [
|
|
|
9427
9675
|
}
|
|
9428
9676
|
];
|
|
9429
9677
|
function aggregateRequirements(answers) {
|
|
9430
|
-
const hasBackend =
|
|
9678
|
+
const hasBackend = Boolean(
|
|
9679
|
+
answers.backend && answers.backend !== "none" || answers.functions && answers.functions !== "none"
|
|
9680
|
+
);
|
|
9431
9681
|
const requirements = {
|
|
9432
9682
|
entities: [],
|
|
9433
9683
|
// Entities created in apps/<app>/entities/ (v1), root entities/ for v2
|
|
@@ -9459,17 +9709,23 @@ async function runQuestionnaire(questions, initialAnswers, showWIP, askFor) {
|
|
|
9459
9709
|
}
|
|
9460
9710
|
if (question.choicesFilter) {
|
|
9461
9711
|
const allowed = question.choicesFilter(answers);
|
|
9462
|
-
choices = choices.filter((
|
|
9712
|
+
choices = choices.filter((c3) => allowed.includes(c3.value));
|
|
9463
9713
|
}
|
|
9464
9714
|
if (choices.length === 0) continue;
|
|
9465
9715
|
answer = await askFor.selection(question.question, choices);
|
|
9466
9716
|
break;
|
|
9467
9717
|
}
|
|
9468
9718
|
case "confirm":
|
|
9469
|
-
answer = await askFor.confirmation(
|
|
9719
|
+
answer = await askFor.confirmation(
|
|
9720
|
+
question.question,
|
|
9721
|
+
typeof resolvedDefault === "boolean" ? resolvedDefault : void 0
|
|
9722
|
+
);
|
|
9470
9723
|
break;
|
|
9471
9724
|
case "input":
|
|
9472
|
-
answer = await askFor.input(
|
|
9725
|
+
answer = await askFor.input(
|
|
9726
|
+
question.question,
|
|
9727
|
+
typeof resolvedDefault === "string" ? resolvedDefault : void 0
|
|
9728
|
+
);
|
|
9473
9729
|
break;
|
|
9474
9730
|
}
|
|
9475
9731
|
answers[question.id] = answer;
|
|
@@ -9482,6 +9738,10 @@ init_utils2();
|
|
|
9482
9738
|
|
|
9483
9739
|
// packages/tooling/src/scaffolding/scaffold-matrix.ts
|
|
9484
9740
|
init_utils2();
|
|
9741
|
+
var APP_FRAMEWORKS = ["vite", "nextjs", "expo"];
|
|
9742
|
+
var HOSTS = ["none", "vercel", "firebase"];
|
|
9743
|
+
var FUNCTIONS = ["none", "vercel", "firebase", "supabase"];
|
|
9744
|
+
var BACKENDS = ["firebase", "supabase", "vercel", "none"];
|
|
9485
9745
|
function resolveDeployConfig(host, backend) {
|
|
9486
9746
|
if (host === "none") return null;
|
|
9487
9747
|
if (host === "firebase") return "firebase";
|
|
@@ -9694,6 +9954,7 @@ function generatePackageJson(templateName, mode, options = {}) {
|
|
|
9694
9954
|
}
|
|
9695
9955
|
|
|
9696
9956
|
// packages/tooling/src/scaffolding/create-app.ts
|
|
9957
|
+
init_type_guards();
|
|
9697
9958
|
init_pathResolver();
|
|
9698
9959
|
init_pathResolver();
|
|
9699
9960
|
var SHOW_WIP = process.env.SHOW_WIP === "true" || process.argv.includes("--wip");
|
|
@@ -9732,10 +9993,18 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9732
9993
|
input: askForInput
|
|
9733
9994
|
});
|
|
9734
9995
|
const requirements = aggregateRequirements(answers);
|
|
9735
|
-
const framework =
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9996
|
+
const framework = pickAllowed(
|
|
9997
|
+
answers.framework || "vite",
|
|
9998
|
+
APP_FRAMEWORKS,
|
|
9999
|
+
"framework"
|
|
10000
|
+
);
|
|
10001
|
+
const host2 = pickAllowed(answers.host || "none", HOSTS, "host");
|
|
10002
|
+
const functions2 = pickAllowed(
|
|
10003
|
+
answers.functions || "none",
|
|
10004
|
+
FUNCTIONS,
|
|
10005
|
+
"functions"
|
|
10006
|
+
);
|
|
10007
|
+
const backend2 = pickAllowed(answers.backend || "none", BACKENDS, "backend");
|
|
9739
10008
|
appConfig = {
|
|
9740
10009
|
template: framework,
|
|
9741
10010
|
host: host2,
|
|
@@ -9883,8 +10152,8 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9883
10152
|
const fragmentPath = joinPath(overlayDir, fragmentName);
|
|
9884
10153
|
const envPath = joinPath(appDir, ".env");
|
|
9885
10154
|
if (pathExists(fragmentPath) && pathExists(envPath)) {
|
|
9886
|
-
const baseEnv = readSync(envPath);
|
|
9887
|
-
const fragment = readSync(fragmentPath);
|
|
10155
|
+
const baseEnv = requireText(readSync(envPath), envPath);
|
|
10156
|
+
const fragment = requireText(readSync(fragmentPath), fragmentPath);
|
|
9888
10157
|
await write(envPath, baseEnv + "\n" + fragment, { overwrite: true });
|
|
9889
10158
|
}
|
|
9890
10159
|
}
|
|
@@ -9973,13 +10242,17 @@ async function createApp(appName, appConfig, workspaceRoot, templatesRoot) {
|
|
|
9973
10242
|
const firebaseJson = readSync(firebaseJsonDest, {
|
|
9974
10243
|
format: "json"
|
|
9975
10244
|
});
|
|
9976
|
-
if (
|
|
9977
|
-
|
|
9978
|
-
|
|
10245
|
+
if (!isObjectLike(firebaseJson)) {
|
|
10246
|
+
throw new Error(`Invalid JSON: ${firebaseJsonDest}`);
|
|
10247
|
+
}
|
|
10248
|
+
const hosting = firebaseJson.hosting;
|
|
10249
|
+
if (isObjectLike(hosting) && Array.isArray(hosting.rewrites)) {
|
|
10250
|
+
hosting.rewrites = hosting.rewrites.filter(
|
|
10251
|
+
(r2) => !(isObjectLike(r2) && r2.destination === "/index.html")
|
|
9979
10252
|
);
|
|
9980
10253
|
}
|
|
9981
|
-
if (
|
|
9982
|
-
|
|
10254
|
+
if (isObjectLike(hosting)) {
|
|
10255
|
+
hosting.public = "out";
|
|
9983
10256
|
}
|
|
9984
10257
|
await write(firebaseJsonDest, firebaseJson, {
|
|
9985
10258
|
format: "json",
|