@donotdev/cli 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dependencies-matrix.json +39 -38
- package/dist/bin/commands/agent-setup.js +135 -67
- package/dist/bin/commands/build.js +288 -232
- package/dist/bin/commands/bump.js +293 -250
- package/dist/bin/commands/cacheout.js +59 -49
- package/dist/bin/commands/coach.js +80 -50
- package/dist/bin/commands/create-app.js +501 -228
- package/dist/bin/commands/create-project.js +377 -241
- package/dist/bin/commands/db.js +1873 -1804
- package/dist/bin/commands/deploy.js +476 -287
- package/dist/bin/commands/dev.js +139 -108
- package/dist/bin/commands/doctor.js +91 -57
- package/dist/bin/commands/emu.js +196 -154
- package/dist/bin/commands/format.js +83 -50
- package/dist/bin/commands/get-demo.js +422 -197
- package/dist/bin/commands/make-admin.js +813 -707
- package/dist/bin/commands/preview.js +139 -108
- package/dist/bin/commands/seed.js +1874 -1809
- package/dist/bin/commands/setup-cicd.js +258 -204
- package/dist/bin/commands/setup.js +346 -247
- package/dist/bin/commands/staging.js +476 -287
- package/dist/bin/commands/sync-secrets.js +472 -141
- package/dist/bin/commands/type-check.js +163 -119
- package/dist/bin/commands/wai.js +53 -46
- package/dist/bin/dndev.js +10 -1
- package/dist/bin/donotdev.js +18 -8
- package/dist/index.js +590 -373
- package/package.json +2 -2
- package/templates/app-dndev/src/pages/legal/LegalNoticePage.tsx.example +1 -1
- package/templates/app-dndev/src/pages/legal/PrivacyPage.tsx.example +1 -1
- package/templates/app-dndev/src/pages/legal/TermsPage.tsx.example +1 -1
- package/templates/app-next/src/app/AppDocument.tsx.example +57 -0
- package/templates/app-next/src/app/ClientLayout.tsx.example +6 -2
- package/templates/app-next/src/pages/legal/LegalNoticePage.tsx.example +1 -1
- package/templates/app-next/src/pages/legal/PrivacyPage.tsx.example +1 -1
- package/templates/app-next/src/pages/legal/TermsPage.tsx.example +1 -1
- package/templates/app-vite/src/pages/FormPageExample.tsx.example +21 -16
- package/templates/app-vite/src/pages/legal/LegalNoticePage.tsx.example +1 -1
- package/templates/app-vite/src/pages/legal/PrivacyPage.tsx.example +1 -1
- package/templates/app-vite/src/pages/legal/TermsPage.tsx.example +1 -1
- package/templates/overlay-supabase/src/config/providers.nextjs.ts.example +37 -0
- package/templates/root-consumer/.claude/hooks/guard-write.sh.example +5 -1
- package/templates/root-consumer/.gitignore.example +7 -1
- package/templates/app-next/src/app/layout.tsx.example +0 -80
- package/templates/app-next/src/app/not-found.tsx.example +0 -40
|
@@ -139,7 +139,7 @@ var init_dist = __esm({
|
|
|
139
139
|
if (index >= length) {
|
|
140
140
|
break outer;
|
|
141
141
|
}
|
|
142
|
-
for (let i2 = 0,
|
|
142
|
+
for (let i2 = 0, l = PARSE_BLOCKS.length; i2 < l; i2++) {
|
|
143
143
|
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
|
|
144
144
|
BLOCK_RE.lastIndex = index;
|
|
145
145
|
if (BLOCK_RE.test(input)) {
|
|
@@ -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,29 +450,31 @@ 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 * as
|
|
469
|
-
import
|
|
470
|
+
import * as f$1 from "node:readline";
|
|
471
|
+
import f__default from "node:readline";
|
|
470
472
|
import { ReadStream } from "node:tty";
|
|
471
|
-
function findCursor(
|
|
472
|
-
if (!
|
|
473
|
-
return
|
|
474
|
-
const t2 =
|
|
475
|
-
return
|
|
473
|
+
function findCursor(o, s, l) {
|
|
474
|
+
if (!l.some((r2) => !r2.disabled))
|
|
475
|
+
return o;
|
|
476
|
+
const t2 = o + s, n3 = Math.max(l.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
|
|
477
|
+
return l[e]?.disabled ? findCursor(e, s < 0 ? -1 : 1, l) : e;
|
|
476
478
|
}
|
|
477
479
|
function isAccessible(n3) {
|
|
478
480
|
if (n3 !== void 0) return n3;
|
|
@@ -515,40 +517,40 @@ function block({
|
|
|
515
517
|
overwrite: o = true,
|
|
516
518
|
hideCursor: n3 = true
|
|
517
519
|
} = {}) {
|
|
518
|
-
const s =
|
|
520
|
+
const s = f$1.createInterface({
|
|
519
521
|
input: e,
|
|
520
522
|
output: r2,
|
|
521
523
|
prompt: "",
|
|
522
524
|
tabSize: 1
|
|
523
525
|
});
|
|
524
|
-
|
|
525
|
-
const t2 = (
|
|
526
|
-
const
|
|
527
|
-
if (isActionKey([
|
|
528
|
-
n3 && r2.write(
|
|
526
|
+
f$1.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
|
|
527
|
+
const t2 = (l, { name: i2, sequence: p }) => {
|
|
528
|
+
const w = String(l);
|
|
529
|
+
if (isActionKey([w, i2, p], "cancel")) {
|
|
530
|
+
n3 && r2.write(cursor.show), process.exit(0);
|
|
529
531
|
return;
|
|
530
532
|
}
|
|
531
533
|
if (!o) return;
|
|
532
|
-
const
|
|
533
|
-
|
|
534
|
-
|
|
534
|
+
const c3 = i2 === "return" ? 0 : -1, a2 = i2 === "return" ? -1 : 0;
|
|
535
|
+
f$1.moveCursor(r2, c3, a2, () => {
|
|
536
|
+
f$1.clearLine(r2, 1, () => {
|
|
535
537
|
e.once("keypress", t2);
|
|
536
538
|
});
|
|
537
539
|
});
|
|
538
540
|
};
|
|
539
|
-
return n3 && r2.write(
|
|
540
|
-
e.off("keypress", t2), n3 && r2.write(
|
|
541
|
+
return n3 && r2.write(cursor.hide), e.once("keypress", t2), () => {
|
|
542
|
+
e.off("keypress", t2), n3 && r2.write(cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
|
|
541
543
|
};
|
|
542
544
|
}
|
|
543
545
|
function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
|
|
544
|
-
const
|
|
545
|
-
return wrapAnsi(r2,
|
|
546
|
+
const l = getColumns(e ?? stdout), i2 = dist_default2(o);
|
|
547
|
+
return wrapAnsi(r2, l - i2, {
|
|
546
548
|
hard: true,
|
|
547
549
|
trim: false
|
|
548
550
|
}).split(`
|
|
549
|
-
`).map((
|
|
550
|
-
const
|
|
551
|
-
return
|
|
551
|
+
`).map((c3, a2, g) => {
|
|
552
|
+
const m = t2 ? t2(c3, a2) : c3;
|
|
553
|
+
return a2 === 0 ? `${n3}${m}` : a2 === g.length - 1 ? `${s}${m}` : `${o}${m}`;
|
|
552
554
|
}).join(`
|
|
553
555
|
`);
|
|
554
556
|
}
|
|
@@ -559,12 +561,13 @@ function runValidation(e, a2) {
|
|
|
559
561
|
}
|
|
560
562
|
return e(a2);
|
|
561
563
|
}
|
|
562
|
-
var
|
|
563
|
-
var
|
|
564
|
-
"node_modules/.bun/@clack+core@1.
|
|
564
|
+
var a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, C$1, n$1;
|
|
565
|
+
var init_dist4 = __esm({
|
|
566
|
+
"node_modules/.bun/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs"() {
|
|
565
567
|
init_utils2();
|
|
566
568
|
init_main();
|
|
567
|
-
|
|
569
|
+
init_dist3();
|
|
570
|
+
init_dist2();
|
|
568
571
|
a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
569
572
|
t = [
|
|
570
573
|
"January",
|
|
@@ -613,7 +616,7 @@ var init_dist3 = __esm({
|
|
|
613
616
|
CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
|
|
614
617
|
getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
615
618
|
getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
616
|
-
|
|
619
|
+
C$1 = class C {
|
|
617
620
|
input;
|
|
618
621
|
output;
|
|
619
622
|
_abortSignal;
|
|
@@ -695,16 +698,16 @@ var init_dist3 = __esm({
|
|
|
695
698
|
{ once: true }
|
|
696
699
|
);
|
|
697
700
|
}
|
|
698
|
-
this.rl =
|
|
701
|
+
this.rl = f__default.createInterface({
|
|
699
702
|
input: this.input,
|
|
700
703
|
tabSize: 2,
|
|
701
704
|
prompt: "",
|
|
702
705
|
escapeCodeTimeout: 50,
|
|
703
706
|
terminal: true
|
|
704
707
|
}), 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", () => {
|
|
705
|
-
this.output.write(
|
|
708
|
+
this.output.write(cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
706
709
|
}), this.once("cancel", () => {
|
|
707
|
-
this.output.write(
|
|
710
|
+
this.output.write(cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
708
711
|
});
|
|
709
712
|
});
|
|
710
713
|
}
|
|
@@ -741,18 +744,18 @@ var init_dist3 = __esm({
|
|
|
741
744
|
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
742
745
|
}
|
|
743
746
|
restoreCursor() {
|
|
744
|
-
const t2 = wrapAnsi(this._prevFrame,
|
|
747
|
+
const t2 = wrapAnsi(this._prevFrame, getColumns(this.output), { hard: true, trim: false }).split(`
|
|
745
748
|
`).length - 1;
|
|
746
|
-
this.output.write(
|
|
749
|
+
this.output.write(cursor.move(-999, t2 * -1));
|
|
747
750
|
}
|
|
748
751
|
render() {
|
|
749
|
-
const t2 = wrapAnsi(this._render(this) ?? "",
|
|
752
|
+
const t2 = wrapAnsi(this._render(this) ?? "", getColumns(this.output), {
|
|
750
753
|
hard: true,
|
|
751
754
|
trim: false
|
|
752
755
|
});
|
|
753
756
|
if (t2 !== this._prevFrame) {
|
|
754
757
|
if (this.state === "initial")
|
|
755
|
-
this.output.write(
|
|
758
|
+
this.output.write(cursor.hide);
|
|
756
759
|
else {
|
|
757
760
|
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
758
761
|
if (this.restoreCursor(), e) {
|
|
@@ -763,33 +766,33 @@ var init_dist3 = __esm({
|
|
|
763
766
|
return;
|
|
764
767
|
}
|
|
765
768
|
if (e.lines.length === 1) {
|
|
766
|
-
this.output.write(
|
|
769
|
+
this.output.write(cursor.move(0, n3 - r2)), this.output.write(erase.lines(1));
|
|
767
770
|
const o = t2.split(`
|
|
768
771
|
`);
|
|
769
|
-
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(
|
|
772
|
+
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(cursor.move(0, o.length - n3 - 1));
|
|
770
773
|
return;
|
|
771
774
|
} else if (e.lines.length > 1) {
|
|
772
775
|
if (s < r2)
|
|
773
776
|
n3 = s;
|
|
774
777
|
else {
|
|
775
778
|
const h2 = n3 - r2;
|
|
776
|
-
h2 > 0 && this.output.write(
|
|
779
|
+
h2 > 0 && this.output.write(cursor.move(0, h2));
|
|
777
780
|
}
|
|
778
|
-
this.output.write(
|
|
779
|
-
const
|
|
781
|
+
this.output.write(erase.down());
|
|
782
|
+
const m = t2.split(`
|
|
780
783
|
`).slice(n3);
|
|
781
|
-
this.output.write(
|
|
784
|
+
this.output.write(m.join(`
|
|
782
785
|
`)), this._prevFrame = t2;
|
|
783
786
|
return;
|
|
784
787
|
}
|
|
785
788
|
}
|
|
786
|
-
this.output.write(
|
|
789
|
+
this.output.write(erase.down());
|
|
787
790
|
}
|
|
788
791
|
this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
|
|
789
792
|
}
|
|
790
793
|
}
|
|
791
794
|
};
|
|
792
|
-
n$1 = class n extends
|
|
795
|
+
n$1 = class n extends C$1 {
|
|
793
796
|
options;
|
|
794
797
|
cursor = 0;
|
|
795
798
|
get _selectedValue() {
|
|
@@ -820,7 +823,7 @@ var init_dist3 = __esm({
|
|
|
820
823
|
}
|
|
821
824
|
});
|
|
822
825
|
|
|
823
|
-
// node_modules/.bun/@clack+prompts@1.
|
|
826
|
+
// node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs
|
|
824
827
|
import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
825
828
|
import process$1 from "node:process";
|
|
826
829
|
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
@@ -831,22 +834,23 @@ function isUnicodeSupported() {
|
|
|
831
834
|
}
|
|
832
835
|
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";
|
|
833
836
|
}
|
|
834
|
-
function formatInstructionFooter(o,
|
|
835
|
-
const
|
|
836
|
-
|
|
837
|
+
function formatInstructionFooter(e, o, r2) {
|
|
838
|
+
const s = r2 ? `${styleText2("cyan", S_BAR)} ` : "", n3 = wrapTextWithPrefix(e, o.join(" \u2022 "), s).split(`
|
|
839
|
+
`);
|
|
840
|
+
return r2 && n3.push(styleText2("cyan", S_BAR_END)), n3;
|
|
837
841
|
}
|
|
838
|
-
var
|
|
839
|
-
var
|
|
840
|
-
"node_modules/.bun/@clack+prompts@1.
|
|
842
|
+
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, MULTISELECT_INSTRUCTIONS, log, cancel, intro, outro, Y, Z, spinner, u2, SELECT_INSTRUCTIONS, c2, select, i;
|
|
843
|
+
var init_dist5 = __esm({
|
|
844
|
+
"node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs"() {
|
|
841
845
|
init_utils2();
|
|
842
|
-
|
|
843
|
-
|
|
846
|
+
init_dist4();
|
|
847
|
+
init_dist4();
|
|
844
848
|
init_main();
|
|
845
849
|
init_dist2();
|
|
846
|
-
|
|
850
|
+
init_dist3();
|
|
847
851
|
unicode = isUnicodeSupported();
|
|
848
852
|
isCI = () => process.env.CI === "true";
|
|
849
|
-
unicodeOr = (
|
|
853
|
+
unicodeOr = (e, o) => unicode ? e : o;
|
|
850
854
|
S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
851
855
|
S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
852
856
|
S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
@@ -872,8 +876,8 @@ var init_dist4 = __esm({
|
|
|
872
876
|
S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
873
877
|
S_WARN = unicodeOr("\u25B2", "!");
|
|
874
878
|
S_ERROR = unicodeOr("\u25A0", "x");
|
|
875
|
-
symbol = (
|
|
876
|
-
switch (
|
|
879
|
+
symbol = (e) => {
|
|
880
|
+
switch (e) {
|
|
877
881
|
case "initial":
|
|
878
882
|
case "active":
|
|
879
883
|
return styleText2("cyan", S_STEP_ACTIVE);
|
|
@@ -887,8 +891,8 @@ var init_dist4 = __esm({
|
|
|
887
891
|
return styleText2("dim", S_STEP_ACTIVE);
|
|
888
892
|
}
|
|
889
893
|
};
|
|
890
|
-
symbolBar = (
|
|
891
|
-
switch (
|
|
894
|
+
symbolBar = (e) => {
|
|
895
|
+
switch (e) {
|
|
892
896
|
case "initial":
|
|
893
897
|
case "active":
|
|
894
898
|
return styleText2("cyan", S_BAR);
|
|
@@ -900,45 +904,45 @@ var init_dist4 = __esm({
|
|
|
900
904
|
return styleText2("green", S_BAR);
|
|
901
905
|
}
|
|
902
906
|
};
|
|
903
|
-
|
|
907
|
+
E$1 = (l, e, w, p, b, C2 = false) => {
|
|
904
908
|
let r2 = e, O = 0;
|
|
905
|
-
if (
|
|
909
|
+
if (C2)
|
|
906
910
|
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
907
|
-
const m =
|
|
911
|
+
const m = l[i2];
|
|
908
912
|
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
909
913
|
}
|
|
910
914
|
else
|
|
911
915
|
for (let i2 = w; i2 < p; i2++) {
|
|
912
|
-
const m =
|
|
916
|
+
const m = l[i2];
|
|
913
917
|
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
914
918
|
}
|
|
915
919
|
return { lineCount: r2, removals: O };
|
|
916
920
|
};
|
|
917
921
|
limitOptions = ({
|
|
918
|
-
cursor:
|
|
922
|
+
cursor: l,
|
|
919
923
|
options: e,
|
|
920
924
|
style: w,
|
|
921
925
|
output: p = process.stdout,
|
|
922
926
|
maxItems: b = Number.POSITIVE_INFINITY,
|
|
923
|
-
columnPadding:
|
|
927
|
+
columnPadding: C2 = 0,
|
|
924
928
|
rowPadding: r2 = 4
|
|
925
929
|
}) => {
|
|
926
|
-
const i2 = getColumns(p) -
|
|
930
|
+
const i2 = getColumns(p) - C2, m = getRows(p), M = styleText2("dim", "..."), v = Math.max(m - r2, 0), a2 = Math.max(Math.min(b, v), 5);
|
|
927
931
|
let f = 0;
|
|
928
|
-
|
|
929
|
-
Math.min(
|
|
932
|
+
l >= a2 - 3 && (f = Math.max(
|
|
933
|
+
Math.min(l - a2 + 3, e.length - a2),
|
|
930
934
|
0
|
|
931
935
|
));
|
|
932
|
-
let d = a2 < e.length && f > 0,
|
|
933
|
-
const
|
|
936
|
+
let d = a2 < e.length && f > 0, c3 = a2 < e.length && f + a2 < e.length;
|
|
937
|
+
const I = Math.min(
|
|
934
938
|
f + a2,
|
|
935
939
|
e.length
|
|
936
940
|
), s = [];
|
|
937
941
|
let g = 0;
|
|
938
|
-
d && g++,
|
|
939
|
-
const T = f + (d ? 1 : 0),
|
|
940
|
-
for (let t2 = T; t2 <
|
|
941
|
-
const n3 = e[t2], o = n3 ? w(n3, t2 ===
|
|
942
|
+
d && g++, c3 && g++;
|
|
943
|
+
const T = f + (d ? 1 : 0), W = I - (c3 ? 1 : 0);
|
|
944
|
+
for (let t2 = T; t2 < W; t2++) {
|
|
945
|
+
const n3 = e[t2], o = n3 !== void 0 ? w(n3, t2 === l) : "", h2 = wrapAnsi(o, i2, {
|
|
942
946
|
hard: true,
|
|
943
947
|
trim: false
|
|
944
948
|
}).split(`
|
|
@@ -947,9 +951,9 @@ var init_dist4 = __esm({
|
|
|
947
951
|
}
|
|
948
952
|
if (g > v) {
|
|
949
953
|
let t2 = 0, n3 = 0, o = g;
|
|
950
|
-
const h2 =
|
|
954
|
+
const h2 = l - T;
|
|
951
955
|
let u3 = v;
|
|
952
|
-
const L = () =>
|
|
956
|
+
const L = () => E$1(s, o, 0, h2, u3), y = () => E$1(
|
|
953
957
|
s,
|
|
954
958
|
o,
|
|
955
959
|
h2 + 1,
|
|
@@ -957,14 +961,14 @@ var init_dist4 = __esm({
|
|
|
957
961
|
u3,
|
|
958
962
|
true
|
|
959
963
|
);
|
|
960
|
-
d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (
|
|
964
|
+
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));
|
|
961
965
|
}
|
|
962
966
|
const x = [];
|
|
963
967
|
d && x.push(M);
|
|
964
968
|
for (const t2 of s)
|
|
965
969
|
for (const n3 of t2)
|
|
966
970
|
x.push(n3);
|
|
967
|
-
return
|
|
971
|
+
return c3 && x.push(M), x;
|
|
968
972
|
};
|
|
969
973
|
MULTISELECT_INSTRUCTIONS = [
|
|
970
974
|
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
@@ -976,18 +980,18 @@ var init_dist4 = __esm({
|
|
|
976
980
|
symbol: e = styleText2("gray", S_BAR),
|
|
977
981
|
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
978
982
|
output: m = process.stdout,
|
|
979
|
-
spacing:
|
|
980
|
-
withGuide:
|
|
983
|
+
spacing: l = 1,
|
|
984
|
+
withGuide: c3
|
|
981
985
|
} = {}) => {
|
|
982
|
-
const t2 = [], o =
|
|
983
|
-
for (let i2 = 0; i2 <
|
|
986
|
+
const t2 = [], o = c3 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
|
|
987
|
+
for (let i2 = 0; i2 < l; i2++)
|
|
984
988
|
t2.push(f);
|
|
985
989
|
const g = Array.isArray(s) ? s : s.split(`
|
|
986
990
|
`);
|
|
987
991
|
if (g.length > 0) {
|
|
988
|
-
const [i2, ...
|
|
992
|
+
const [i2, ...y] = g;
|
|
989
993
|
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
990
|
-
for (const p of
|
|
994
|
+
for (const p of y)
|
|
991
995
|
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
992
996
|
}
|
|
993
997
|
m.write(`${t2.join(`
|
|
@@ -1032,83 +1036,102 @@ ${styleText2("gray", S_BAR_END)} ` : "";
|
|
|
1032
1036
|
|
|
1033
1037
|
`);
|
|
1034
1038
|
};
|
|
1035
|
-
|
|
1039
|
+
Y = 3e4;
|
|
1040
|
+
Z = (c3) => styleText2("magenta", c3);
|
|
1036
1041
|
spinner = ({
|
|
1037
|
-
indicator:
|
|
1038
|
-
onCancel:
|
|
1042
|
+
indicator: c3 = "dots",
|
|
1043
|
+
onCancel: b,
|
|
1039
1044
|
output: n3 = process.stdout,
|
|
1040
|
-
cancelMessage:
|
|
1041
|
-
errorMessage:
|
|
1042
|
-
frames:
|
|
1043
|
-
delay:
|
|
1044
|
-
signal:
|
|
1045
|
-
...
|
|
1045
|
+
cancelMessage: _,
|
|
1046
|
+
errorMessage: C2,
|
|
1047
|
+
frames: M = unicode ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"],
|
|
1048
|
+
delay: O = unicode ? 80 : 120,
|
|
1049
|
+
signal: g,
|
|
1050
|
+
...E
|
|
1046
1051
|
} = {}) => {
|
|
1047
|
-
const u3 = isCI();
|
|
1048
|
-
let
|
|
1049
|
-
const
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1052
|
-
},
|
|
1053
|
-
process.on("uncaughtExceptionMonitor",
|
|
1054
|
-
},
|
|
1055
|
-
process.removeListener("uncaughtExceptionMonitor",
|
|
1056
|
-
},
|
|
1057
|
-
if (
|
|
1052
|
+
const u3 = isCI(), h2 = isAccessible(E.accessible);
|
|
1053
|
+
let x, I, p = false, l = false, r2 = "", v, w = performance.now();
|
|
1054
|
+
const y = getColumns(n3), F = E?.styleFrame ?? Z, S = (e) => {
|
|
1055
|
+
const s = e > 1 ? C2 ?? settings.messages.error : _ ?? settings.messages.cancel;
|
|
1056
|
+
l = e === 1, p && (m(s, e), l && typeof b == "function" && b());
|
|
1057
|
+
}, $ = () => S(2), a2 = () => S(1), H = () => {
|
|
1058
|
+
process.on("uncaughtExceptionMonitor", $), process.on("unhandledRejection", $), process.on("SIGINT", a2), process.on("SIGTERM", a2), process.on("exit", S), g && g.addEventListener("abort", a2);
|
|
1059
|
+
}, B = () => {
|
|
1060
|
+
process.removeListener("uncaughtExceptionMonitor", $), process.removeListener("unhandledRejection", $), process.removeListener("SIGINT", a2), process.removeListener("SIGTERM", a2), process.removeListener("exit", S), g && g.removeEventListener("abort", a2);
|
|
1061
|
+
}, R2 = () => {
|
|
1062
|
+
if (v === void 0) return;
|
|
1058
1063
|
u3 && n3.write(`
|
|
1059
1064
|
`);
|
|
1060
|
-
const
|
|
1065
|
+
const s = wrapAnsi(v, y, {
|
|
1061
1066
|
hard: true,
|
|
1062
1067
|
trim: false
|
|
1063
1068
|
}).split(`
|
|
1064
1069
|
`);
|
|
1065
|
-
|
|
1066
|
-
},
|
|
1067
|
-
const
|
|
1068
|
-
return
|
|
1069
|
-
}, N =
|
|
1070
|
-
|
|
1070
|
+
s.length > 1 && n3.write(cursor.up(s.length - 1)), n3.write(cursor.to(0)), n3.write(erase.down());
|
|
1071
|
+
}, L = (e) => e.replace(/\.+$/, ""), T = (e) => {
|
|
1072
|
+
const s = (performance.now() - e) / 1e3, i2 = Math.floor(s / 60), t2 = Math.floor(s % 60);
|
|
1073
|
+
return i2 > 0 ? `[${i2}m ${t2}s]` : `[${t2}s]`;
|
|
1074
|
+
}, N = E.withGuide ?? settings.withGuide, P = (e = "") => {
|
|
1075
|
+
if (p = true, l = false, r2 = L(e), w = performance.now(), H(), h2) {
|
|
1076
|
+
r2 !== "" && n3.write(`${r2}
|
|
1077
|
+
`), I = setInterval(() => {
|
|
1078
|
+
n3.write(r2 === "" ? `still working
|
|
1079
|
+
` : `still working: ${r2}
|
|
1071
1080
|
`);
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1081
|
+
}, Y);
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1084
|
+
x = block({ output: n3 }), N && n3.write(`${styleText2("gray", S_BAR)}
|
|
1085
|
+
`);
|
|
1086
|
+
let s = 0, i2 = 0;
|
|
1087
|
+
I = setInterval(() => {
|
|
1088
|
+
if (u3 && r2 === v)
|
|
1075
1089
|
return;
|
|
1076
|
-
|
|
1077
|
-
const
|
|
1078
|
-
let
|
|
1090
|
+
R2(), v = r2;
|
|
1091
|
+
const t2 = F(M[s]);
|
|
1092
|
+
let o;
|
|
1079
1093
|
if (u3)
|
|
1080
|
-
|
|
1081
|
-
else if (
|
|
1082
|
-
|
|
1094
|
+
o = `${t2} ${r2}...`;
|
|
1095
|
+
else if (c3 === "timer")
|
|
1096
|
+
o = `${t2} ${r2} ${T(w)}`;
|
|
1083
1097
|
else {
|
|
1084
|
-
const
|
|
1085
|
-
|
|
1098
|
+
const j = ".".repeat(Math.floor(i2)).slice(0, 3);
|
|
1099
|
+
o = `${t2} ${r2}${j}`;
|
|
1086
1100
|
}
|
|
1087
|
-
const
|
|
1101
|
+
const D = wrapAnsi(o, y, {
|
|
1088
1102
|
hard: true,
|
|
1089
1103
|
trim: false
|
|
1090
1104
|
});
|
|
1091
|
-
n3.write(
|
|
1092
|
-
},
|
|
1093
|
-
},
|
|
1094
|
-
if (
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
`)
|
|
1105
|
+
n3.write(D), s = s + 1 < M.length ? s + 1 : 0, i2 = i2 < 4 ? i2 + 0.125 : 0;
|
|
1106
|
+
}, O);
|
|
1107
|
+
}, m = (e = "", s = 0, i2 = false) => {
|
|
1108
|
+
if (p) {
|
|
1109
|
+
if (p = false, l = s === 1, clearInterval(I), h2 || R2(), r2 = e ?? r2, !i2)
|
|
1110
|
+
if (h2) {
|
|
1111
|
+
const t2 = s === 1 ? _ ?? settings.messages.cancel : s === 2 ? C2 ?? settings.messages.error : "Done", o = r2 || t2;
|
|
1112
|
+
c3 === "timer" ? n3.write(`${o} ${T(w)}
|
|
1113
|
+
`) : n3.write(`${o}
|
|
1114
|
+
`);
|
|
1115
|
+
} else {
|
|
1116
|
+
const t2 = s === 0 ? styleText2("green", S_STEP_SUBMIT) : s === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
|
|
1117
|
+
c3 === "timer" ? n3.write(`${t2} ${r2} ${T(w)}
|
|
1118
|
+
`) : n3.write(`${t2} ${r2}
|
|
1119
|
+
`);
|
|
1120
|
+
}
|
|
1121
|
+
B(), x?.();
|
|
1122
|
+
}
|
|
1100
1123
|
};
|
|
1101
1124
|
return {
|
|
1102
1125
|
start: P,
|
|
1103
|
-
stop: (e = "") =>
|
|
1126
|
+
stop: (e = "") => m(e, 0),
|
|
1104
1127
|
message: (e = "") => {
|
|
1105
|
-
|
|
1128
|
+
r2 = L(e ?? r2);
|
|
1106
1129
|
},
|
|
1107
|
-
cancel: (e = "") =>
|
|
1108
|
-
error: (e = "") =>
|
|
1109
|
-
clear: () =>
|
|
1130
|
+
cancel: (e = "") => m(e, 1),
|
|
1131
|
+
error: (e = "") => m(e, 2),
|
|
1132
|
+
clear: () => m("", 0, true),
|
|
1110
1133
|
get isCancelled() {
|
|
1111
|
-
return
|
|
1134
|
+
return l;
|
|
1112
1135
|
}
|
|
1113
1136
|
};
|
|
1114
1137
|
};
|
|
@@ -1121,7 +1144,7 @@ ${styleText2("gray", S_BAR_END)} ` : "";
|
|
|
1121
1144
|
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1122
1145
|
`${styleText2("dim", "Enter:")} confirm`
|
|
1123
1146
|
];
|
|
1124
|
-
|
|
1147
|
+
c2 = (t2, o) => t2.includes(`
|
|
1125
1148
|
`) ? t2.split(`
|
|
1126
1149
|
`).map((d) => o(d)).join(`
|
|
1127
1150
|
`) : o(t2);
|
|
@@ -1132,15 +1155,15 @@ ${styleText2("gray", S_BAR_END)} ` : "";
|
|
|
1132
1155
|
const s = n3.label ?? String(n3.value);
|
|
1133
1156
|
switch (m) {
|
|
1134
1157
|
case "disabled":
|
|
1135
|
-
return `${styleText2("gray", S_RADIO_INACTIVE)} ${
|
|
1158
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
|
|
1136
1159
|
case "selected":
|
|
1137
|
-
return `${
|
|
1160
|
+
return `${c2(s, (i2) => styleText2("dim", i2))}`;
|
|
1138
1161
|
case "active":
|
|
1139
1162
|
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
|
|
1140
1163
|
case "cancelled":
|
|
1141
|
-
return `${
|
|
1164
|
+
return `${c2(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
|
|
1142
1165
|
default:
|
|
1143
|
-
return `${styleText2("dim", S_RADIO_INACTIVE)} ${
|
|
1166
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("dim", i2))}`;
|
|
1144
1167
|
}
|
|
1145
1168
|
}, d = t2.showInstructions ?? true;
|
|
1146
1169
|
return new n$1({
|
|
@@ -1178,7 +1201,7 @@ ${styleText2("gray", S_BAR)}` : ""}`;
|
|
|
1178
1201
|
}
|
|
1179
1202
|
default: {
|
|
1180
1203
|
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
|
|
1181
|
-
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
1204
|
+
`).length, p = d ? formatInstructionFooter(t2.output, SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
1182
1205
|
`), b = p.length + 1;
|
|
1183
1206
|
return `${u3}${r2}${limitOptions({
|
|
1184
1207
|
output: t2.output,
|
|
@@ -1247,8 +1270,8 @@ var init_cli_output = __esm({
|
|
|
1247
1270
|
"packages/tooling/src/utils/cli-output.ts"() {
|
|
1248
1271
|
"use strict";
|
|
1249
1272
|
init_utils2();
|
|
1250
|
-
|
|
1251
|
-
|
|
1273
|
+
init_dist5();
|
|
1274
|
+
init_dist5();
|
|
1252
1275
|
colors = {
|
|
1253
1276
|
reset: "\x1B[0m",
|
|
1254
1277
|
// Success (green)
|
|
@@ -1348,6 +1371,148 @@ var init_cli_output = __esm({
|
|
|
1348
1371
|
}
|
|
1349
1372
|
});
|
|
1350
1373
|
|
|
1374
|
+
// packages/tooling/src/utils/errors.ts
|
|
1375
|
+
var DO_NOT_DEV_ERROR_CODES, DoNotDevError;
|
|
1376
|
+
var init_errors = __esm({
|
|
1377
|
+
"packages/tooling/src/utils/errors.ts"() {
|
|
1378
|
+
"use strict";
|
|
1379
|
+
init_utils2();
|
|
1380
|
+
DO_NOT_DEV_ERROR_CODES = {
|
|
1381
|
+
CONFIGURATION_ERROR: "configuration-error",
|
|
1382
|
+
CONFIG_NOT_FOUND: "config-not-found",
|
|
1383
|
+
CONFIG_INVALID: "config-invalid",
|
|
1384
|
+
PATH_RESOLUTION_ERROR: "path-resolution-error",
|
|
1385
|
+
FILE_OPERATION_ERROR: "file-operation-error",
|
|
1386
|
+
FILE_NOT_FOUND: "file-not-found",
|
|
1387
|
+
PERMISSION_DENIED: "permission-denied",
|
|
1388
|
+
GENERATION_ERROR: "generation-error",
|
|
1389
|
+
TEMPLATE_ERROR: "template-error",
|
|
1390
|
+
TEMPLATE_NOT_FOUND: "template-not-found",
|
|
1391
|
+
CLI_EXECUTION_ERROR: "cli-execution-error",
|
|
1392
|
+
COMMAND_NOT_FOUND: "command-not-found",
|
|
1393
|
+
COMMAND_FAILED: "command-failed",
|
|
1394
|
+
VALIDATION_ERROR: "validation-error",
|
|
1395
|
+
SCHEMA_ERROR: "schema-error",
|
|
1396
|
+
DEPENDENCY_ERROR: "dependency-error",
|
|
1397
|
+
DEPENDENCY_NOT_FOUND: "dependency-not-found",
|
|
1398
|
+
DEPENDENCY_VERSION_ERROR: "dependency-version-error",
|
|
1399
|
+
INVALID_ARGUMENT: "invalid-argument",
|
|
1400
|
+
MISSING_ARGUMENT: "missing-argument",
|
|
1401
|
+
MISSING_PROJECT_ID: "missing-project-id",
|
|
1402
|
+
FIREBASE_CLI_ERROR: "firebase-cli-error",
|
|
1403
|
+
DEPLOYMENT_FAILED: "deployment-failed",
|
|
1404
|
+
VERCEL_API_ERROR: "vercel-api-error",
|
|
1405
|
+
OPERATION_CANCELLED: "operation-cancelled",
|
|
1406
|
+
TIMEOUT_ERROR: "timeout-error",
|
|
1407
|
+
UNKNOWN_ERROR: "unknown-error"
|
|
1408
|
+
};
|
|
1409
|
+
DoNotDevError = class _DoNotDevError extends Error {
|
|
1410
|
+
/** The error code categorizing this error */
|
|
1411
|
+
code;
|
|
1412
|
+
/** Original error if this is wrapping another error */
|
|
1413
|
+
originalError;
|
|
1414
|
+
/** Additional context for the error */
|
|
1415
|
+
context;
|
|
1416
|
+
/** Whether this error should be displayed to the user */
|
|
1417
|
+
displayable;
|
|
1418
|
+
/**
|
|
1419
|
+
* Creates a new DoNotDev error
|
|
1420
|
+
*
|
|
1421
|
+
* @param {string} message - Error message
|
|
1422
|
+
* @param {DoNotDevErrorCode} code - Error code
|
|
1423
|
+
* @param {object} [options] - Additional error options
|
|
1424
|
+
* @param {Error} [options.originalError] - Original error if wrapping
|
|
1425
|
+
* @param {Record<string, unknown>} [options.context] - Additional context data
|
|
1426
|
+
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
1427
|
+
*/
|
|
1428
|
+
constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
|
|
1429
|
+
super(message);
|
|
1430
|
+
this.name = "DoNotDevError";
|
|
1431
|
+
this.code = code;
|
|
1432
|
+
this.originalError = options?.originalError;
|
|
1433
|
+
this.context = options?.context;
|
|
1434
|
+
this.displayable = options?.displayable !== false;
|
|
1435
|
+
Object.setPrototypeOf(this, _DoNotDevError.prototype);
|
|
1436
|
+
if (Error.captureStackTrace) {
|
|
1437
|
+
Error.captureStackTrace(this, _DoNotDevError);
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
/**
|
|
1441
|
+
* Formats the error for logging or display
|
|
1442
|
+
*
|
|
1443
|
+
* @returns {string} Formatted error message with code
|
|
1444
|
+
*/
|
|
1445
|
+
format() {
|
|
1446
|
+
return `[${this.code}] ${this.message}`;
|
|
1447
|
+
}
|
|
1448
|
+
/**
|
|
1449
|
+
* Creates a wrapped error from another error
|
|
1450
|
+
*
|
|
1451
|
+
* @param {Error} error - Original error to wrap
|
|
1452
|
+
* @param {string} [context] - Additional context for the error
|
|
1453
|
+
* @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
|
|
1454
|
+
* @param {object} [options] - Additional error options
|
|
1455
|
+
* @param {Record<string, unknown>} [options.context] - Additional context data
|
|
1456
|
+
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
1457
|
+
* @returns {DoNotDevError} New DoNotDev error wrapping the original
|
|
1458
|
+
*/
|
|
1459
|
+
static from(error2, context, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
|
|
1460
|
+
if (!(error2 instanceof Error)) {
|
|
1461
|
+
return new _DoNotDevError(
|
|
1462
|
+
`Unknown error: ${String(error2)}`,
|
|
1463
|
+
code,
|
|
1464
|
+
options
|
|
1465
|
+
);
|
|
1466
|
+
}
|
|
1467
|
+
if (error2 instanceof _DoNotDevError) {
|
|
1468
|
+
if (!context) {
|
|
1469
|
+
return error2;
|
|
1470
|
+
}
|
|
1471
|
+
return new _DoNotDevError(`${context}: ${error2.message}`, error2.code, {
|
|
1472
|
+
originalError: error2.originalError || error2,
|
|
1473
|
+
context: { ...error2.context, ...options?.context || {} },
|
|
1474
|
+
displayable: options?.displayable ?? error2.displayable
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
const message = context ? `${context}: ${error2.message}` : error2.message;
|
|
1478
|
+
return new _DoNotDevError(message, code, {
|
|
1479
|
+
originalError: error2,
|
|
1480
|
+
context: options?.context,
|
|
1481
|
+
displayable: options?.displayable
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
/**
|
|
1485
|
+
* Maps common error types to DoNotDevErrorCode
|
|
1486
|
+
*
|
|
1487
|
+
* @param {Error} error - Error to analyze
|
|
1488
|
+
* @returns {DoNotDevErrorCode} Mapped error code
|
|
1489
|
+
*/
|
|
1490
|
+
static getErrorCodeFromError(error2) {
|
|
1491
|
+
if (error2 instanceof _DoNotDevError) {
|
|
1492
|
+
return error2.code;
|
|
1493
|
+
}
|
|
1494
|
+
const message = error2.message.toLowerCase();
|
|
1495
|
+
if (error2.name === "ValidationError" || message.includes("validation")) {
|
|
1496
|
+
return DO_NOT_DEV_ERROR_CODES.VALIDATION_ERROR;
|
|
1497
|
+
}
|
|
1498
|
+
if (message.includes("not found") || message.includes("no such file")) {
|
|
1499
|
+
return DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND;
|
|
1500
|
+
}
|
|
1501
|
+
if (message.includes("permission") || message.includes("access denied")) {
|
|
1502
|
+
return DO_NOT_DEV_ERROR_CODES.PERMISSION_DENIED;
|
|
1503
|
+
}
|
|
1504
|
+
if (message.includes("timeout") || message.includes("timed out")) {
|
|
1505
|
+
return DO_NOT_DEV_ERROR_CODES.TIMEOUT_ERROR;
|
|
1506
|
+
}
|
|
1507
|
+
if (message.includes("dependency") || message.includes("module not found")) {
|
|
1508
|
+
return DO_NOT_DEV_ERROR_CODES.DEPENDENCY_ERROR;
|
|
1509
|
+
}
|
|
1510
|
+
return DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR;
|
|
1511
|
+
}
|
|
1512
|
+
};
|
|
1513
|
+
}
|
|
1514
|
+
});
|
|
1515
|
+
|
|
1351
1516
|
// node_modules/.bun/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js
|
|
1352
1517
|
var require_array = __commonJS({
|
|
1353
1518
|
"node_modules/.bun/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js"(exports) {
|
|
@@ -7338,6 +7503,9 @@ import {
|
|
|
7338
7503
|
extname
|
|
7339
7504
|
} from "node:path";
|
|
7340
7505
|
import { fileURLToPath } from "node:url";
|
|
7506
|
+
function isEexistError(error2) {
|
|
7507
|
+
return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
|
|
7508
|
+
}
|
|
7341
7509
|
function safeExecuteAsync(fn, message) {
|
|
7342
7510
|
return fn().catch((error2) => {
|
|
7343
7511
|
throw new Error(
|
|
@@ -7709,7 +7877,7 @@ var init_PathResolver = __esm({
|
|
|
7709
7877
|
try {
|
|
7710
7878
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
7711
7879
|
} catch (error2) {
|
|
7712
|
-
if (error2
|
|
7880
|
+
if (!isEexistError(error2)) throw error2;
|
|
7713
7881
|
}
|
|
7714
7882
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
7715
7883
|
let writeContent;
|
|
@@ -7771,7 +7939,7 @@ var init_PathResolver = __esm({
|
|
|
7771
7939
|
try {
|
|
7772
7940
|
fs.mkdirSync(dir, { recursive: true });
|
|
7773
7941
|
} catch (error2) {
|
|
7774
|
-
if (error2
|
|
7942
|
+
if (!isEexistError(error2)) throw error2;
|
|
7775
7943
|
}
|
|
7776
7944
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
7777
7945
|
let writeContent;
|
|
@@ -7828,7 +7996,7 @@ var init_PathResolver = __esm({
|
|
|
7828
7996
|
try {
|
|
7829
7997
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
7830
7998
|
} catch (error2) {
|
|
7831
|
-
if (error2
|
|
7999
|
+
if (!isEexistError(error2)) throw error2;
|
|
7832
8000
|
}
|
|
7833
8001
|
try {
|
|
7834
8002
|
return await safeExecuteAsync(async () => {
|
|
@@ -7870,7 +8038,7 @@ var init_PathResolver = __esm({
|
|
|
7870
8038
|
try {
|
|
7871
8039
|
fs.mkdirSync(dir, { recursive: true });
|
|
7872
8040
|
} catch (error2) {
|
|
7873
|
-
if (error2
|
|
8041
|
+
if (!isEexistError(error2)) throw error2;
|
|
7874
8042
|
}
|
|
7875
8043
|
try {
|
|
7876
8044
|
fs.copyFileSync(srcPath, normalizedDestPath);
|
|
@@ -7986,7 +8154,7 @@ var init_PathResolver = __esm({
|
|
|
7986
8154
|
try {
|
|
7987
8155
|
await fs.promises.mkdir(dirPath, { recursive: true });
|
|
7988
8156
|
} catch (error2) {
|
|
7989
|
-
if (error2
|
|
8157
|
+
if (!isEexistError(error2)) throw error2;
|
|
7990
8158
|
}
|
|
7991
8159
|
}
|
|
7992
8160
|
/**
|
|
@@ -7998,7 +8166,7 @@ var init_PathResolver = __esm({
|
|
|
7998
8166
|
try {
|
|
7999
8167
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
8000
8168
|
} catch (error2) {
|
|
8001
|
-
if (error2
|
|
8169
|
+
if (!isEexistError(error2)) throw error2;
|
|
8002
8170
|
}
|
|
8003
8171
|
}
|
|
8004
8172
|
/**
|
|
@@ -8247,6 +8415,7 @@ var init_PathResolver = __esm({
|
|
|
8247
8415
|
* @param patternType - Type of patterns (css, routes, i18n, assets, pwa)
|
|
8248
8416
|
* @returns Resolved patterns with absolute paths
|
|
8249
8417
|
*/
|
|
8418
|
+
// 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)
|
|
8250
8419
|
async resolvePatterns(patternType) {
|
|
8251
8420
|
if (!constants.getPatternsFor) {
|
|
8252
8421
|
return { framework: [], consumer: [], all: [] };
|
|
@@ -8538,6 +8707,31 @@ var init_pathResolver = __esm({
|
|
|
8538
8707
|
}
|
|
8539
8708
|
});
|
|
8540
8709
|
|
|
8710
|
+
// packages/tooling/src/utils/type-guards.ts
|
|
8711
|
+
function isRecord(value) {
|
|
8712
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8713
|
+
}
|
|
8714
|
+
function asText(value) {
|
|
8715
|
+
return typeof value === "string" ? value : null;
|
|
8716
|
+
}
|
|
8717
|
+
function requireBuffer(value, filePath) {
|
|
8718
|
+
if (!Buffer2.isBuffer(value)) {
|
|
8719
|
+
throw new DoNotDevError(
|
|
8720
|
+
`Cannot read file: ${filePath}`,
|
|
8721
|
+
DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
|
|
8722
|
+
{ context: { filePath } }
|
|
8723
|
+
);
|
|
8724
|
+
}
|
|
8725
|
+
return value;
|
|
8726
|
+
}
|
|
8727
|
+
var init_type_guards = __esm({
|
|
8728
|
+
"packages/tooling/src/utils/type-guards.ts"() {
|
|
8729
|
+
"use strict";
|
|
8730
|
+
init_utils2();
|
|
8731
|
+
init_errors();
|
|
8732
|
+
}
|
|
8733
|
+
});
|
|
8734
|
+
|
|
8541
8735
|
// packages/tooling/src/bundler/utils.ts
|
|
8542
8736
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
8543
8737
|
import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
@@ -8567,27 +8761,54 @@ var init_utils2 = __esm({
|
|
|
8567
8761
|
|
|
8568
8762
|
// packages/tooling/src/utils/cli-input.ts
|
|
8569
8763
|
async function askForSelection(message, choices, defaultValue = 0) {
|
|
8570
|
-
const options = choices.map((choice) =>
|
|
8571
|
-
value
|
|
8572
|
-
label: choice.title,
|
|
8573
|
-
|
|
8574
|
-
|
|
8764
|
+
const options = choices.map((choice) => {
|
|
8765
|
+
const value = choice.value;
|
|
8766
|
+
return { value, label: choice.title, hint: choice.hint };
|
|
8767
|
+
});
|
|
8768
|
+
const initialValue = choices[defaultValue]?.value;
|
|
8575
8769
|
const result = await select({
|
|
8576
8770
|
message,
|
|
8577
8771
|
options,
|
|
8578
|
-
initialValue
|
|
8772
|
+
initialValue
|
|
8579
8773
|
});
|
|
8580
8774
|
if (isCancel(result)) {
|
|
8581
8775
|
cancel("Operation cancelled.");
|
|
8582
8776
|
process.exit(0);
|
|
8583
8777
|
}
|
|
8584
|
-
|
|
8778
|
+
const picked = choices.find((choice) => choice.value === result);
|
|
8779
|
+
if (!picked) {
|
|
8780
|
+
throw new Error(`Unknown selection: ${result}`);
|
|
8781
|
+
}
|
|
8782
|
+
return picked.value;
|
|
8585
8783
|
}
|
|
8586
8784
|
var init_cli_input = __esm({
|
|
8587
8785
|
"packages/tooling/src/utils/cli-input.ts"() {
|
|
8588
8786
|
"use strict";
|
|
8589
8787
|
init_utils2();
|
|
8590
|
-
|
|
8788
|
+
init_dist5();
|
|
8789
|
+
}
|
|
8790
|
+
});
|
|
8791
|
+
|
|
8792
|
+
// packages/tooling/src/utils/error-handling.ts
|
|
8793
|
+
function isError(error2) {
|
|
8794
|
+
return error2 instanceof Error;
|
|
8795
|
+
}
|
|
8796
|
+
function getErrorMessage(error2) {
|
|
8797
|
+
if (isError(error2)) {
|
|
8798
|
+
return error2.message;
|
|
8799
|
+
}
|
|
8800
|
+
if (typeof error2 === "string") {
|
|
8801
|
+
return error2;
|
|
8802
|
+
}
|
|
8803
|
+
if (error2 && typeof error2 === "object" && "message" in error2) {
|
|
8804
|
+
return String(error2.message);
|
|
8805
|
+
}
|
|
8806
|
+
return String(error2);
|
|
8807
|
+
}
|
|
8808
|
+
var init_error_handling = __esm({
|
|
8809
|
+
"packages/tooling/src/utils/error-handling.ts"() {
|
|
8810
|
+
"use strict";
|
|
8811
|
+
init_utils2();
|
|
8591
8812
|
}
|
|
8592
8813
|
});
|
|
8593
8814
|
|
|
@@ -8603,7 +8824,9 @@ init_utils2();
|
|
|
8603
8824
|
// packages/tooling/src/utils/create-utils.ts
|
|
8604
8825
|
init_utils2();
|
|
8605
8826
|
init_cli_output();
|
|
8827
|
+
init_error_handling();
|
|
8606
8828
|
init_pathResolver();
|
|
8829
|
+
init_type_guards();
|
|
8607
8830
|
async function copyTemplateFiles(sourceDir, destDir, replacements) {
|
|
8608
8831
|
if (!pathExists(sourceDir)) {
|
|
8609
8832
|
log2.warn(`Warning: Template directory does not exist: ${sourceDir}`);
|
|
@@ -8674,7 +8897,10 @@ async function isTextFile(filePath) {
|
|
|
8674
8897
|
if (textExtensions.some((ext) => filePath.toLowerCase().endsWith(ext)))
|
|
8675
8898
|
return true;
|
|
8676
8899
|
try {
|
|
8677
|
-
const buffer =
|
|
8900
|
+
const buffer = requireBuffer(
|
|
8901
|
+
await read(filePath, { format: "buffer" }),
|
|
8902
|
+
filePath
|
|
8903
|
+
);
|
|
8678
8904
|
if (buffer.length === 0) return true;
|
|
8679
8905
|
for (let i2 = 0; i2 < Math.min(buffer.length, 1e3); i2++) {
|
|
8680
8906
|
if (buffer[i2] === 0) return false;
|
|
@@ -8686,7 +8912,7 @@ async function isTextFile(filePath) {
|
|
|
8686
8912
|
}
|
|
8687
8913
|
async function replacePlaceholders(filePath, replacements) {
|
|
8688
8914
|
try {
|
|
8689
|
-
let content = await read(filePath, { format: "text" });
|
|
8915
|
+
let content = asText(await read(filePath, { format: "text" }));
|
|
8690
8916
|
if (typeof content !== "string") {
|
|
8691
8917
|
content = typeof content === "object" ? JSON.stringify(content, null, 2) : String(content);
|
|
8692
8918
|
}
|
|
@@ -8703,7 +8929,7 @@ async function replacePlaceholders(filePath, replacements) {
|
|
|
8703
8929
|
await write(filePath, content, { overwrite: true });
|
|
8704
8930
|
} catch (error2) {
|
|
8705
8931
|
log2.warn(
|
|
8706
|
-
`Warning: Could not process file ${filePath}: ${error2
|
|
8932
|
+
`Warning: Could not process file ${filePath}: ${getErrorMessage(error2) || "Unknown error"}`
|
|
8707
8933
|
);
|
|
8708
8934
|
}
|
|
8709
8935
|
}
|
|
@@ -9024,6 +9250,7 @@ init_utils2();
|
|
|
9024
9250
|
init_cli_input();
|
|
9025
9251
|
init_cli_output();
|
|
9026
9252
|
init_pathResolver();
|
|
9253
|
+
init_type_guards();
|
|
9027
9254
|
async function main(options) {
|
|
9028
9255
|
intro("get-demo");
|
|
9029
9256
|
const cwd = normalizePath(process.cwd());
|
|
@@ -9104,14 +9331,12 @@ async function main(options) {
|
|
|
9104
9331
|
outro("Done");
|
|
9105
9332
|
}
|
|
9106
9333
|
function getProjectName(cwd) {
|
|
9107
|
-
|
|
9108
|
-
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
|
|
9112
|
-
if (pkg.name) return pkg.name;
|
|
9334
|
+
const pkgPath = joinPath(cwd, "package.json");
|
|
9335
|
+
if (pathExists(pkgPath)) {
|
|
9336
|
+
const pkg = readSync(pkgPath);
|
|
9337
|
+
if (isRecord(pkg) && typeof pkg.name === "string" && pkg.name) {
|
|
9338
|
+
return pkg.name;
|
|
9113
9339
|
}
|
|
9114
|
-
} catch {
|
|
9115
9340
|
}
|
|
9116
9341
|
return cwd.split("/").pop() || "my-project";
|
|
9117
9342
|
}
|