@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
|
@@ -405,25 +405,29 @@ var init_main = __esm({
|
|
|
405
405
|
}
|
|
406
406
|
});
|
|
407
407
|
|
|
408
|
-
// node_modules/.bun/sisteransi@
|
|
409
|
-
var
|
|
410
|
-
|
|
411
|
-
|
|
408
|
+
// node_modules/.bun/sisteransi@2.0.0/node_modules/sisteransi/dist/index.js
|
|
409
|
+
var ESC2, CSI2, cursor, erase, clear;
|
|
410
|
+
var init_dist3 = __esm({
|
|
411
|
+
"node_modules/.bun/sisteransi@2.0.0/node_modules/sisteransi/dist/index.js"() {
|
|
412
412
|
init_utils2();
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
return `${CSI2}${
|
|
413
|
+
ESC2 = "\x1B";
|
|
414
|
+
CSI2 = `${ESC2}[`;
|
|
415
|
+
cursor = {
|
|
416
|
+
to(x, y) {
|
|
417
|
+
if (!y)
|
|
418
|
+
return `${CSI2}${x + 1}G`;
|
|
419
|
+
return `${CSI2}${y + 1};${x + 1}H`;
|
|
420
420
|
},
|
|
421
|
-
move(x,
|
|
421
|
+
move(x, y) {
|
|
422
422
|
let ret = "";
|
|
423
|
-
if (x < 0)
|
|
424
|
-
|
|
425
|
-
if (
|
|
426
|
-
|
|
423
|
+
if (x < 0)
|
|
424
|
+
ret += `${CSI2}${-x}D`;
|
|
425
|
+
else if (x > 0)
|
|
426
|
+
ret += `${CSI2}${x}C`;
|
|
427
|
+
if (y < 0)
|
|
428
|
+
ret += `${CSI2}${-y}A`;
|
|
429
|
+
else if (y > 0)
|
|
430
|
+
ret += `${CSI2}${y}B`;
|
|
427
431
|
return ret;
|
|
428
432
|
},
|
|
429
433
|
up: (count = 1) => `${CSI2}${count}A`,
|
|
@@ -438,11 +442,7 @@ var require_src = __commonJS({
|
|
|
438
442
|
save: `${ESC2}7`,
|
|
439
443
|
restore: `${ESC2}8`
|
|
440
444
|
};
|
|
441
|
-
|
|
442
|
-
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
443
|
-
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
444
|
-
};
|
|
445
|
-
var erase3 = {
|
|
445
|
+
erase = {
|
|
446
446
|
screen: `${CSI2}2J`,
|
|
447
447
|
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
448
448
|
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
@@ -450,28 +450,30 @@ var require_src = __commonJS({
|
|
|
450
450
|
lineEnd: `${CSI2}K`,
|
|
451
451
|
lineStart: `${CSI2}1K`,
|
|
452
452
|
lines(count) {
|
|
453
|
-
let
|
|
453
|
+
let clear2 = "";
|
|
454
454
|
for (let i2 = 0; i2 < count; i2++)
|
|
455
|
-
|
|
455
|
+
clear2 += this.line + (i2 < count - 1 ? cursor.up() : "");
|
|
456
456
|
if (count)
|
|
457
|
-
|
|
458
|
-
return
|
|
457
|
+
clear2 += cursor.left;
|
|
458
|
+
return clear2;
|
|
459
459
|
}
|
|
460
460
|
};
|
|
461
|
-
|
|
461
|
+
clear = {
|
|
462
|
+
screen: `${ESC2}c`
|
|
463
|
+
};
|
|
462
464
|
}
|
|
463
465
|
});
|
|
464
466
|
|
|
465
|
-
// node_modules/.bun/@clack+core@1.
|
|
467
|
+
// node_modules/.bun/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs
|
|
466
468
|
import { styleText } from "node:util";
|
|
467
469
|
import { stdout, stdin } from "node:process";
|
|
468
|
-
import
|
|
470
|
+
import f__default from "node:readline";
|
|
469
471
|
import { ReadStream } from "node:tty";
|
|
470
|
-
function findCursor(
|
|
472
|
+
function findCursor(o, s, l) {
|
|
471
473
|
if (!l.some((r2) => !r2.disabled))
|
|
472
|
-
return
|
|
473
|
-
const t2 =
|
|
474
|
-
return l[e]?.disabled ? findCursor(e,
|
|
474
|
+
return o;
|
|
475
|
+
const t2 = o + s, n3 = Math.max(l.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
|
|
476
|
+
return l[e]?.disabled ? findCursor(e, s < 0 ? -1 : 1, l) : e;
|
|
475
477
|
}
|
|
476
478
|
function isAccessible(n3) {
|
|
477
479
|
if (n3 !== void 0) return n3;
|
|
@@ -509,14 +511,14 @@ function setRawMode(e, r2) {
|
|
|
509
511
|
o.isTTY && o.setRawMode(r2);
|
|
510
512
|
}
|
|
511
513
|
function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
|
|
512
|
-
const
|
|
513
|
-
return wrapAnsi(r2,
|
|
514
|
+
const l = getColumns(e ?? stdout), i2 = dist_default2(o);
|
|
515
|
+
return wrapAnsi(r2, l - i2, {
|
|
514
516
|
hard: true,
|
|
515
517
|
trim: false
|
|
516
518
|
}).split(`
|
|
517
|
-
`).map((
|
|
518
|
-
const
|
|
519
|
-
return
|
|
519
|
+
`).map((c3, a2, g) => {
|
|
520
|
+
const m = t2 ? t2(c3, a2) : c3;
|
|
521
|
+
return a2 === 0 ? `${n3}${m}` : a2 === g.length - 1 ? `${s}${m}` : `${o}${m}`;
|
|
520
522
|
}).join(`
|
|
521
523
|
`);
|
|
522
524
|
}
|
|
@@ -527,12 +529,13 @@ function runValidation(e, a2) {
|
|
|
527
529
|
}
|
|
528
530
|
return e(a2);
|
|
529
531
|
}
|
|
530
|
-
var
|
|
531
|
-
var
|
|
532
|
-
"node_modules/.bun/@clack+core@1.
|
|
532
|
+
var a$1, t, settings, R, CANCEL_SYMBOL, getColumns, getRows, C$1, n$1;
|
|
533
|
+
var init_dist4 = __esm({
|
|
534
|
+
"node_modules/.bun/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs"() {
|
|
533
535
|
init_utils2();
|
|
534
536
|
init_main();
|
|
535
|
-
|
|
537
|
+
init_dist3();
|
|
538
|
+
init_dist2();
|
|
536
539
|
a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
537
540
|
t = [
|
|
538
541
|
"January",
|
|
@@ -581,7 +584,7 @@ var init_dist3 = __esm({
|
|
|
581
584
|
CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
|
|
582
585
|
getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
583
586
|
getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
584
|
-
|
|
587
|
+
C$1 = class C {
|
|
585
588
|
input;
|
|
586
589
|
output;
|
|
587
590
|
_abortSignal;
|
|
@@ -663,16 +666,16 @@ var init_dist3 = __esm({
|
|
|
663
666
|
{ once: true }
|
|
664
667
|
);
|
|
665
668
|
}
|
|
666
|
-
this.rl =
|
|
669
|
+
this.rl = f__default.createInterface({
|
|
667
670
|
input: this.input,
|
|
668
671
|
tabSize: 2,
|
|
669
672
|
prompt: "",
|
|
670
673
|
escapeCodeTimeout: 50,
|
|
671
674
|
terminal: true
|
|
672
675
|
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
673
|
-
this.output.write(
|
|
676
|
+
this.output.write(cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
674
677
|
}), this.once("cancel", () => {
|
|
675
|
-
this.output.write(
|
|
678
|
+
this.output.write(cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
676
679
|
});
|
|
677
680
|
});
|
|
678
681
|
}
|
|
@@ -709,18 +712,18 @@ var init_dist3 = __esm({
|
|
|
709
712
|
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
710
713
|
}
|
|
711
714
|
restoreCursor() {
|
|
712
|
-
const t2 = wrapAnsi(this._prevFrame,
|
|
715
|
+
const t2 = wrapAnsi(this._prevFrame, getColumns(this.output), { hard: true, trim: false }).split(`
|
|
713
716
|
`).length - 1;
|
|
714
|
-
this.output.write(
|
|
717
|
+
this.output.write(cursor.move(-999, t2 * -1));
|
|
715
718
|
}
|
|
716
719
|
render() {
|
|
717
|
-
const t2 = wrapAnsi(this._render(this) ?? "",
|
|
720
|
+
const t2 = wrapAnsi(this._render(this) ?? "", getColumns(this.output), {
|
|
718
721
|
hard: true,
|
|
719
722
|
trim: false
|
|
720
723
|
});
|
|
721
724
|
if (t2 !== this._prevFrame) {
|
|
722
725
|
if (this.state === "initial")
|
|
723
|
-
this.output.write(
|
|
726
|
+
this.output.write(cursor.hide);
|
|
724
727
|
else {
|
|
725
728
|
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
726
729
|
if (this.restoreCursor(), e) {
|
|
@@ -731,33 +734,33 @@ var init_dist3 = __esm({
|
|
|
731
734
|
return;
|
|
732
735
|
}
|
|
733
736
|
if (e.lines.length === 1) {
|
|
734
|
-
this.output.write(
|
|
737
|
+
this.output.write(cursor.move(0, n3 - r2)), this.output.write(erase.lines(1));
|
|
735
738
|
const o = t2.split(`
|
|
736
739
|
`);
|
|
737
|
-
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(
|
|
740
|
+
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(cursor.move(0, o.length - n3 - 1));
|
|
738
741
|
return;
|
|
739
742
|
} else if (e.lines.length > 1) {
|
|
740
743
|
if (s < r2)
|
|
741
744
|
n3 = s;
|
|
742
745
|
else {
|
|
743
746
|
const h2 = n3 - r2;
|
|
744
|
-
h2 > 0 && this.output.write(
|
|
747
|
+
h2 > 0 && this.output.write(cursor.move(0, h2));
|
|
745
748
|
}
|
|
746
|
-
this.output.write(
|
|
747
|
-
const
|
|
749
|
+
this.output.write(erase.down());
|
|
750
|
+
const m = t2.split(`
|
|
748
751
|
`).slice(n3);
|
|
749
|
-
this.output.write(
|
|
752
|
+
this.output.write(m.join(`
|
|
750
753
|
`)), this._prevFrame = t2;
|
|
751
754
|
return;
|
|
752
755
|
}
|
|
753
756
|
}
|
|
754
|
-
this.output.write(
|
|
757
|
+
this.output.write(erase.down());
|
|
755
758
|
}
|
|
756
759
|
this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
|
|
757
760
|
}
|
|
758
761
|
}
|
|
759
762
|
};
|
|
760
|
-
n$1 = class n extends
|
|
763
|
+
n$1 = class n extends C$1 {
|
|
761
764
|
options;
|
|
762
765
|
cursor = 0;
|
|
763
766
|
get _selectedValue() {
|
|
@@ -788,7 +791,7 @@ var init_dist3 = __esm({
|
|
|
788
791
|
}
|
|
789
792
|
});
|
|
790
793
|
|
|
791
|
-
// node_modules/.bun/@clack+prompts@1.
|
|
794
|
+
// node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs
|
|
792
795
|
import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
793
796
|
import process$1 from "node:process";
|
|
794
797
|
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
@@ -799,21 +802,22 @@ function isUnicodeSupported() {
|
|
|
799
802
|
}
|
|
800
803
|
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";
|
|
801
804
|
}
|
|
802
|
-
function formatInstructionFooter(o,
|
|
803
|
-
const
|
|
804
|
-
|
|
805
|
+
function formatInstructionFooter(e, o, r2) {
|
|
806
|
+
const s = r2 ? `${styleText2("cyan", S_BAR)} ` : "", n3 = wrapTextWithPrefix(e, o.join(" \u2022 "), s).split(`
|
|
807
|
+
`);
|
|
808
|
+
return r2 && n3.push(styleText2("cyan", S_BAR_END)), n3;
|
|
805
809
|
}
|
|
806
|
-
var
|
|
807
|
-
var
|
|
808
|
-
"node_modules/.bun/@clack+prompts@1.
|
|
810
|
+
var unicode, unicodeOr, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR_START, S_BAR, S_BAR_END, S_BAR_START_RIGHT, S_BAR_END_RIGHT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, S_PASSWORD_MASK, S_BAR_H, S_CORNER_TOP_RIGHT, S_CONNECT_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_BOTTOM_LEFT, S_CORNER_TOP_LEFT, S_INFO, S_SUCCESS, S_WARN, S_ERROR, symbol, symbolBar, E$1, limitOptions, MULTISELECT_INSTRUCTIONS, log, cancel, W, C2, note, u2, SELECT_INSTRUCTIONS, c2, select, i;
|
|
811
|
+
var init_dist5 = __esm({
|
|
812
|
+
"node_modules/.bun/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs"() {
|
|
809
813
|
init_utils2();
|
|
810
|
-
|
|
811
|
-
|
|
814
|
+
init_dist4();
|
|
815
|
+
init_dist4();
|
|
812
816
|
init_main();
|
|
813
817
|
init_dist2();
|
|
814
|
-
|
|
818
|
+
init_dist3();
|
|
815
819
|
unicode = isUnicodeSupported();
|
|
816
|
-
unicodeOr = (
|
|
820
|
+
unicodeOr = (e, o) => unicode ? e : o;
|
|
817
821
|
S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
818
822
|
S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
819
823
|
S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
@@ -839,8 +843,8 @@ var init_dist4 = __esm({
|
|
|
839
843
|
S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
840
844
|
S_WARN = unicodeOr("\u25B2", "!");
|
|
841
845
|
S_ERROR = unicodeOr("\u25A0", "x");
|
|
842
|
-
symbol = (
|
|
843
|
-
switch (
|
|
846
|
+
symbol = (e) => {
|
|
847
|
+
switch (e) {
|
|
844
848
|
case "initial":
|
|
845
849
|
case "active":
|
|
846
850
|
return styleText2("cyan", S_STEP_ACTIVE);
|
|
@@ -854,8 +858,8 @@ var init_dist4 = __esm({
|
|
|
854
858
|
return styleText2("dim", S_STEP_ACTIVE);
|
|
855
859
|
}
|
|
856
860
|
};
|
|
857
|
-
symbolBar = (
|
|
858
|
-
switch (
|
|
861
|
+
symbolBar = (e) => {
|
|
862
|
+
switch (e) {
|
|
859
863
|
case "initial":
|
|
860
864
|
case "active":
|
|
861
865
|
return styleText2("cyan", S_BAR);
|
|
@@ -867,9 +871,9 @@ var init_dist4 = __esm({
|
|
|
867
871
|
return styleText2("green", S_BAR);
|
|
868
872
|
}
|
|
869
873
|
};
|
|
870
|
-
|
|
874
|
+
E$1 = (l, e, w, p, b, C3 = false) => {
|
|
871
875
|
let r2 = e, O = 0;
|
|
872
|
-
if (
|
|
876
|
+
if (C3)
|
|
873
877
|
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
874
878
|
const m = l[i2];
|
|
875
879
|
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
@@ -887,25 +891,25 @@ var init_dist4 = __esm({
|
|
|
887
891
|
style: w,
|
|
888
892
|
output: p = process.stdout,
|
|
889
893
|
maxItems: b = Number.POSITIVE_INFINITY,
|
|
890
|
-
columnPadding:
|
|
894
|
+
columnPadding: C3 = 0,
|
|
891
895
|
rowPadding: r2 = 4
|
|
892
896
|
}) => {
|
|
893
|
-
const i2 = getColumns(p) -
|
|
897
|
+
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);
|
|
894
898
|
let f = 0;
|
|
895
899
|
l >= a2 - 3 && (f = Math.max(
|
|
896
900
|
Math.min(l - a2 + 3, e.length - a2),
|
|
897
901
|
0
|
|
898
902
|
));
|
|
899
|
-
let d = a2 < e.length && f > 0,
|
|
900
|
-
const
|
|
903
|
+
let d = a2 < e.length && f > 0, c3 = a2 < e.length && f + a2 < e.length;
|
|
904
|
+
const I = Math.min(
|
|
901
905
|
f + a2,
|
|
902
906
|
e.length
|
|
903
907
|
), s = [];
|
|
904
908
|
let g = 0;
|
|
905
|
-
d && g++,
|
|
906
|
-
const T = f + (d ? 1 : 0),
|
|
907
|
-
for (let t2 = T; t2 <
|
|
908
|
-
const n3 = e[t2], o = n3 ? w(n3, t2 === l) : "", h2 = wrapAnsi(o, i2, {
|
|
909
|
+
d && g++, c3 && g++;
|
|
910
|
+
const T = f + (d ? 1 : 0), W2 = I - (c3 ? 1 : 0);
|
|
911
|
+
for (let t2 = T; t2 < W2; t2++) {
|
|
912
|
+
const n3 = e[t2], o = n3 !== void 0 ? w(n3, t2 === l) : "", h2 = wrapAnsi(o, i2, {
|
|
909
913
|
hard: true,
|
|
910
914
|
trim: false
|
|
911
915
|
}).split(`
|
|
@@ -916,7 +920,7 @@ var init_dist4 = __esm({
|
|
|
916
920
|
let t2 = 0, n3 = 0, o = g;
|
|
917
921
|
const h2 = l - T;
|
|
918
922
|
let u3 = v;
|
|
919
|
-
const L = () =>
|
|
923
|
+
const L = () => E$1(s, o, 0, h2, u3), y = () => E$1(
|
|
920
924
|
s,
|
|
921
925
|
o,
|
|
922
926
|
h2 + 1,
|
|
@@ -924,14 +928,14 @@ var init_dist4 = __esm({
|
|
|
924
928
|
u3,
|
|
925
929
|
true
|
|
926
930
|
);
|
|
927
|
-
d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (
|
|
931
|
+
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));
|
|
928
932
|
}
|
|
929
933
|
const x = [];
|
|
930
934
|
d && x.push(M);
|
|
931
935
|
for (const t2 of s)
|
|
932
936
|
for (const n3 of t2)
|
|
933
937
|
x.push(n3);
|
|
934
|
-
return
|
|
938
|
+
return c3 && x.push(M), x;
|
|
935
939
|
};
|
|
936
940
|
MULTISELECT_INSTRUCTIONS = [
|
|
937
941
|
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
@@ -944,17 +948,17 @@ var init_dist4 = __esm({
|
|
|
944
948
|
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
945
949
|
output: m = process.stdout,
|
|
946
950
|
spacing: l = 1,
|
|
947
|
-
withGuide:
|
|
951
|
+
withGuide: c3
|
|
948
952
|
} = {}) => {
|
|
949
|
-
const t2 = [], o =
|
|
953
|
+
const t2 = [], o = c3 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
|
|
950
954
|
for (let i2 = 0; i2 < l; i2++)
|
|
951
955
|
t2.push(f);
|
|
952
956
|
const g = Array.isArray(s) ? s : s.split(`
|
|
953
957
|
`);
|
|
954
958
|
if (g.length > 0) {
|
|
955
|
-
const [i2, ...
|
|
959
|
+
const [i2, ...y] = g;
|
|
956
960
|
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
957
|
-
for (const p of
|
|
961
|
+
for (const p of y)
|
|
958
962
|
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
959
963
|
}
|
|
960
964
|
m.write(`${t2.join(`
|
|
@@ -987,18 +991,18 @@ var init_dist4 = __esm({
|
|
|
987
991
|
|
|
988
992
|
`);
|
|
989
993
|
};
|
|
990
|
-
W
|
|
991
|
-
|
|
994
|
+
W = (o) => o;
|
|
995
|
+
C2 = (o, e, s) => {
|
|
992
996
|
const a2 = {
|
|
993
997
|
hard: true,
|
|
994
998
|
trim: false
|
|
995
999
|
}, i2 = wrapAnsi(o, e, a2).split(`
|
|
996
|
-
`),
|
|
1000
|
+
`), 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);
|
|
997
1001
|
return wrapAnsi(o, g, a2);
|
|
998
1002
|
};
|
|
999
1003
|
note = (o = "", e = "", s) => {
|
|
1000
|
-
const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide,
|
|
1001
|
-
`).map(
|
|
1004
|
+
const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c3 = s?.format ?? W, g = ["", ...C2(o, getColumns(a2) - 6, c3).split(`
|
|
1005
|
+
`).map(c3), ""], n3 = dist_default2(e), t2 = Math.max(
|
|
1002
1006
|
g.reduce((m, F) => {
|
|
1003
1007
|
const O = dist_default2(F);
|
|
1004
1008
|
return O > m ? O : m;
|
|
@@ -1028,7 +1032,7 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
|
1028
1032
|
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
1029
1033
|
`${styleText2("dim", "Enter:")} confirm`
|
|
1030
1034
|
];
|
|
1031
|
-
|
|
1035
|
+
c2 = (t2, o) => t2.includes(`
|
|
1032
1036
|
`) ? t2.split(`
|
|
1033
1037
|
`).map((d) => o(d)).join(`
|
|
1034
1038
|
`) : o(t2);
|
|
@@ -1039,15 +1043,15 @@ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
|
|
|
1039
1043
|
const s = n3.label ?? String(n3.value);
|
|
1040
1044
|
switch (m) {
|
|
1041
1045
|
case "disabled":
|
|
1042
|
-
return `${styleText2("gray", S_RADIO_INACTIVE)} ${
|
|
1046
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
|
|
1043
1047
|
case "selected":
|
|
1044
|
-
return `${
|
|
1048
|
+
return `${c2(s, (i2) => styleText2("dim", i2))}`;
|
|
1045
1049
|
case "active":
|
|
1046
1050
|
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
|
|
1047
1051
|
case "cancelled":
|
|
1048
|
-
return `${
|
|
1052
|
+
return `${c2(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
|
|
1049
1053
|
default:
|
|
1050
|
-
return `${styleText2("dim", S_RADIO_INACTIVE)} ${
|
|
1054
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("dim", i2))}`;
|
|
1051
1055
|
}
|
|
1052
1056
|
}, d = t2.showInstructions ?? true;
|
|
1053
1057
|
return new n$1({
|
|
@@ -1085,7 +1089,7 @@ ${styleText2("gray", S_BAR)}` : ""}`;
|
|
|
1085
1089
|
}
|
|
1086
1090
|
default: {
|
|
1087
1091
|
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
|
|
1088
|
-
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
1092
|
+
`).length, p = d ? formatInstructionFooter(t2.output, SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
1089
1093
|
`), b = p.length + 1;
|
|
1090
1094
|
return `${u3}${r2}${limitOptions({
|
|
1091
1095
|
output: t2.output,
|
|
@@ -1154,8 +1158,8 @@ var init_cli_output = __esm({
|
|
|
1154
1158
|
"packages/tooling/src/utils/cli-output.ts"() {
|
|
1155
1159
|
"use strict";
|
|
1156
1160
|
init_utils2();
|
|
1157
|
-
|
|
1158
|
-
|
|
1161
|
+
init_dist5();
|
|
1162
|
+
init_dist5();
|
|
1159
1163
|
colors = {
|
|
1160
1164
|
reset: "\x1B[0m",
|
|
1161
1165
|
// Success (green)
|
|
@@ -1306,7 +1310,7 @@ var init_errors = __esm({
|
|
|
1306
1310
|
* @param {DoNotDevErrorCode} code - Error code
|
|
1307
1311
|
* @param {object} [options] - Additional error options
|
|
1308
1312
|
* @param {Error} [options.originalError] - Original error if wrapping
|
|
1309
|
-
* @param {Record<string,
|
|
1313
|
+
* @param {Record<string, unknown>} [options.context] - Additional context data
|
|
1310
1314
|
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
1311
1315
|
*/
|
|
1312
1316
|
constructor(message, code = DO_NOT_DEV_ERROR_CODES.UNKNOWN_ERROR, options) {
|
|
@@ -1336,7 +1340,7 @@ var init_errors = __esm({
|
|
|
1336
1340
|
* @param {string} [context] - Additional context for the error
|
|
1337
1341
|
* @param {DoNotDevErrorCode} [code='unknown-error'] - Error code
|
|
1338
1342
|
* @param {object} [options] - Additional error options
|
|
1339
|
-
* @param {Record<string,
|
|
1343
|
+
* @param {Record<string, unknown>} [options.context] - Additional context data
|
|
1340
1344
|
* @param {boolean} [options.displayable=true] - Whether this error should be displayed to the user
|
|
1341
1345
|
* @returns {DoNotDevError} New DoNotDev error wrapping the original
|
|
1342
1346
|
*/
|
|
@@ -7387,6 +7391,9 @@ import {
|
|
|
7387
7391
|
extname
|
|
7388
7392
|
} from "node:path";
|
|
7389
7393
|
import { fileURLToPath } from "node:url";
|
|
7394
|
+
function isEexistError(error2) {
|
|
7395
|
+
return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "EEXIST";
|
|
7396
|
+
}
|
|
7390
7397
|
function safeExecuteAsync(fn, message) {
|
|
7391
7398
|
return fn().catch((error2) => {
|
|
7392
7399
|
throw new Error(
|
|
@@ -7758,7 +7765,7 @@ var init_PathResolver = __esm({
|
|
|
7758
7765
|
try {
|
|
7759
7766
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
7760
7767
|
} catch (error2) {
|
|
7761
|
-
if (error2
|
|
7768
|
+
if (!isEexistError(error2)) throw error2;
|
|
7762
7769
|
}
|
|
7763
7770
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
7764
7771
|
let writeContent;
|
|
@@ -7820,7 +7827,7 @@ var init_PathResolver = __esm({
|
|
|
7820
7827
|
try {
|
|
7821
7828
|
fs.mkdirSync(dir, { recursive: true });
|
|
7822
7829
|
} catch (error2) {
|
|
7823
|
-
if (error2
|
|
7830
|
+
if (!isEexistError(error2)) throw error2;
|
|
7824
7831
|
}
|
|
7825
7832
|
const detectedFormat = this._detectFormat(filePath, format);
|
|
7826
7833
|
let writeContent;
|
|
@@ -7877,7 +7884,7 @@ var init_PathResolver = __esm({
|
|
|
7877
7884
|
try {
|
|
7878
7885
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
7879
7886
|
} catch (error2) {
|
|
7880
|
-
if (error2
|
|
7887
|
+
if (!isEexistError(error2)) throw error2;
|
|
7881
7888
|
}
|
|
7882
7889
|
try {
|
|
7883
7890
|
return await safeExecuteAsync(async () => {
|
|
@@ -7919,7 +7926,7 @@ var init_PathResolver = __esm({
|
|
|
7919
7926
|
try {
|
|
7920
7927
|
fs.mkdirSync(dir, { recursive: true });
|
|
7921
7928
|
} catch (error2) {
|
|
7922
|
-
if (error2
|
|
7929
|
+
if (!isEexistError(error2)) throw error2;
|
|
7923
7930
|
}
|
|
7924
7931
|
try {
|
|
7925
7932
|
fs.copyFileSync(srcPath, normalizedDestPath);
|
|
@@ -8035,7 +8042,7 @@ var init_PathResolver = __esm({
|
|
|
8035
8042
|
try {
|
|
8036
8043
|
await fs.promises.mkdir(dirPath, { recursive: true });
|
|
8037
8044
|
} catch (error2) {
|
|
8038
|
-
if (error2
|
|
8045
|
+
if (!isEexistError(error2)) throw error2;
|
|
8039
8046
|
}
|
|
8040
8047
|
}
|
|
8041
8048
|
/**
|
|
@@ -8047,7 +8054,7 @@ var init_PathResolver = __esm({
|
|
|
8047
8054
|
try {
|
|
8048
8055
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
8049
8056
|
} catch (error2) {
|
|
8050
|
-
if (error2
|
|
8057
|
+
if (!isEexistError(error2)) throw error2;
|
|
8051
8058
|
}
|
|
8052
8059
|
}
|
|
8053
8060
|
/**
|
|
@@ -8296,6 +8303,7 @@ var init_PathResolver = __esm({
|
|
|
8296
8303
|
* @param patternType - Type of patterns (css, routes, i18n, assets, pwa)
|
|
8297
8304
|
* @returns Resolved patterns with absolute paths
|
|
8298
8305
|
*/
|
|
8306
|
+
// 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)
|
|
8299
8307
|
async resolvePatterns(patternType) {
|
|
8300
8308
|
if (!constants.getPatternsFor) {
|
|
8301
8309
|
return { framework: [], consumer: [], all: [] };
|
|
@@ -8450,6 +8458,9 @@ import {
|
|
|
8450
8458
|
} from "node:path";
|
|
8451
8459
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8452
8460
|
function readdirSync3(dirPath, options) {
|
|
8461
|
+
if (options !== null && typeof options === "object" && options.withFileTypes === true) {
|
|
8462
|
+
return pathResolverInstance.readdirSync(dirPath, options);
|
|
8463
|
+
}
|
|
8453
8464
|
return pathResolverInstance.readdirSync(dirPath, options);
|
|
8454
8465
|
}
|
|
8455
8466
|
var pathResolverInstance, getRepoRoot, normalizePath, pathExists, readSync, statSync2, getRelativePathBetween, getDirname, joinPath;
|
|
@@ -8478,6 +8489,56 @@ var init_pathResolver = __esm({
|
|
|
8478
8489
|
}
|
|
8479
8490
|
});
|
|
8480
8491
|
|
|
8492
|
+
// packages/tooling/src/utils/typed-file-operations.ts
|
|
8493
|
+
function readPackageJson(filePath) {
|
|
8494
|
+
if (!pathExists(filePath)) {
|
|
8495
|
+
throw new DoNotDevError(
|
|
8496
|
+
`package.json not found: ${filePath}`,
|
|
8497
|
+
DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
|
|
8498
|
+
{ context: { filePath } }
|
|
8499
|
+
);
|
|
8500
|
+
}
|
|
8501
|
+
const content = readSync(filePath, { format: "json" });
|
|
8502
|
+
if (!content || typeof content !== "object" || !("name" in content)) {
|
|
8503
|
+
throw new DoNotDevError(
|
|
8504
|
+
`Invalid package.json: ${filePath}`,
|
|
8505
|
+
DO_NOT_DEV_ERROR_CODES.CONFIG_INVALID,
|
|
8506
|
+
{ context: { filePath } }
|
|
8507
|
+
);
|
|
8508
|
+
}
|
|
8509
|
+
return content;
|
|
8510
|
+
}
|
|
8511
|
+
var init_typed_file_operations = __esm({
|
|
8512
|
+
"packages/tooling/src/utils/typed-file-operations.ts"() {
|
|
8513
|
+
"use strict";
|
|
8514
|
+
init_utils2();
|
|
8515
|
+
init_errors();
|
|
8516
|
+
init_pathResolver();
|
|
8517
|
+
}
|
|
8518
|
+
});
|
|
8519
|
+
|
|
8520
|
+
// packages/tooling/src/utils/type-guards.ts
|
|
8521
|
+
function isObjectLike(value) {
|
|
8522
|
+
return typeof value === "object" && value !== null;
|
|
8523
|
+
}
|
|
8524
|
+
function requireText(value, filePath) {
|
|
8525
|
+
if (typeof value !== "string") {
|
|
8526
|
+
throw new DoNotDevError(
|
|
8527
|
+
`Cannot read text file: ${filePath}`,
|
|
8528
|
+
DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
|
|
8529
|
+
{ context: { filePath } }
|
|
8530
|
+
);
|
|
8531
|
+
}
|
|
8532
|
+
return value;
|
|
8533
|
+
}
|
|
8534
|
+
var init_type_guards = __esm({
|
|
8535
|
+
"packages/tooling/src/utils/type-guards.ts"() {
|
|
8536
|
+
"use strict";
|
|
8537
|
+
init_utils2();
|
|
8538
|
+
init_errors();
|
|
8539
|
+
}
|
|
8540
|
+
});
|
|
8541
|
+
|
|
8481
8542
|
// packages/tooling/src/bundler/utils.ts
|
|
8482
8543
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
8483
8544
|
import { copyFileSync as copyFileSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
@@ -8505,29 +8566,216 @@ var init_utils2 = __esm({
|
|
|
8505
8566
|
}
|
|
8506
8567
|
});
|
|
8507
8568
|
|
|
8569
|
+
// packages/tooling/src/utils/app-detection.ts
|
|
8570
|
+
function usesVercel(app) {
|
|
8571
|
+
return app.hosting === "vercel" || app.functions === "vercel";
|
|
8572
|
+
}
|
|
8573
|
+
function detectApps(projectRoot) {
|
|
8574
|
+
const apps = [];
|
|
8575
|
+
const appsDir = joinPath(projectRoot, "apps");
|
|
8576
|
+
const appsDirStat = statSync2(appsDir);
|
|
8577
|
+
if (pathExists(appsDir) && appsDirStat?.isDirectory()) {
|
|
8578
|
+
const appDirs = readdirSync3(appsDir, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name).sort();
|
|
8579
|
+
for (const appDir of appDirs) {
|
|
8580
|
+
const appPath = joinPath(appsDir, appDir);
|
|
8581
|
+
const packageJsonPath = joinPath(appPath, "package.json");
|
|
8582
|
+
if (pathExists(packageJsonPath)) {
|
|
8583
|
+
const appInfo = analyzeApp(appPath, appDir);
|
|
8584
|
+
if (appInfo) {
|
|
8585
|
+
apps.push(appInfo);
|
|
8586
|
+
}
|
|
8587
|
+
}
|
|
8588
|
+
}
|
|
8589
|
+
} else {
|
|
8590
|
+
const packageJsonPath = joinPath(projectRoot, "package.json");
|
|
8591
|
+
if (pathExists(packageJsonPath)) {
|
|
8592
|
+
try {
|
|
8593
|
+
const packageJson = readPackageJson(packageJsonPath);
|
|
8594
|
+
if (packageJson && (packageJson.dependencies?.vite || packageJson.devDependencies?.vite || packageJson.dependencies?.next || packageJson.devDependencies?.next)) {
|
|
8595
|
+
const pathParts = projectRoot.split(/[/\\]/);
|
|
8596
|
+
const appName = pathParts[pathParts.length - 1] || "app";
|
|
8597
|
+
const appInfo = analyzeApp(projectRoot, appName);
|
|
8598
|
+
if (appInfo) {
|
|
8599
|
+
apps.push(appInfo);
|
|
8600
|
+
}
|
|
8601
|
+
}
|
|
8602
|
+
} catch {
|
|
8603
|
+
}
|
|
8604
|
+
}
|
|
8605
|
+
}
|
|
8606
|
+
return apps;
|
|
8607
|
+
}
|
|
8608
|
+
function analyzeApp(appPath, appName) {
|
|
8609
|
+
const packageJsonPath = joinPath(appPath, "package.json");
|
|
8610
|
+
if (!pathExists(packageJsonPath)) {
|
|
8611
|
+
return null;
|
|
8612
|
+
}
|
|
8613
|
+
let packageJson = null;
|
|
8614
|
+
try {
|
|
8615
|
+
packageJson = readPackageJson(packageJsonPath);
|
|
8616
|
+
if (!packageJson.name) {
|
|
8617
|
+
return null;
|
|
8618
|
+
}
|
|
8619
|
+
} catch {
|
|
8620
|
+
return null;
|
|
8621
|
+
}
|
|
8622
|
+
let framework = "unknown";
|
|
8623
|
+
if (pathExists(joinPath(appPath, "next.config.js")) || pathExists(joinPath(appPath, "next.config.ts")) || pathExists(joinPath(appPath, "next.config.mjs")) || packageJson.dependencies?.next || packageJson.devDependencies?.next) {
|
|
8624
|
+
framework = "nextjs";
|
|
8625
|
+
} else if (pathExists(joinPath(appPath, "vite.config.ts")) || pathExists(joinPath(appPath, "vite.config.js")) || pathExists(joinPath(appPath, "vite.config.mjs")) || packageJson.dependencies?.vite || packageJson.devDependencies?.vite) {
|
|
8626
|
+
framework = "vite";
|
|
8627
|
+
}
|
|
8628
|
+
const firebaseJsonPath = joinPath(appPath, "firebase.json");
|
|
8629
|
+
const hasFirebase = pathExists(firebaseJsonPath);
|
|
8630
|
+
const supabaseDir = joinPath(appPath, "supabase");
|
|
8631
|
+
const supabaseConfigPath = joinPath(supabaseDir, "config.toml");
|
|
8632
|
+
const hasSupabaseDep = !!(packageJson.dependencies?.["@donotdev/supabase"] || packageJson.dependencies?.["@supabase/supabase-js"]);
|
|
8633
|
+
let hasSupabase = pathExists(supabaseDir) || pathExists(supabaseConfigPath) || hasSupabaseDep;
|
|
8634
|
+
if (!hasSupabase) {
|
|
8635
|
+
try {
|
|
8636
|
+
const envPath = joinPath(appPath, ".env");
|
|
8637
|
+
if (pathExists(envPath)) {
|
|
8638
|
+
const envContent = requireText(readSync(envPath), envPath);
|
|
8639
|
+
if (envContent.match(/VITE_SUPABASE_URL=.+/)) {
|
|
8640
|
+
hasSupabase = true;
|
|
8641
|
+
}
|
|
8642
|
+
}
|
|
8643
|
+
} catch {
|
|
8644
|
+
}
|
|
8645
|
+
}
|
|
8646
|
+
let provider = "unknown";
|
|
8647
|
+
if (hasFirebase && hasSupabase) {
|
|
8648
|
+
provider = "both";
|
|
8649
|
+
} else if (hasFirebase) {
|
|
8650
|
+
provider = "firebase";
|
|
8651
|
+
} else if (hasSupabase) {
|
|
8652
|
+
provider = "supabase";
|
|
8653
|
+
}
|
|
8654
|
+
let firebaseConfig;
|
|
8655
|
+
if (hasFirebase) {
|
|
8656
|
+
try {
|
|
8657
|
+
const config = readSync(firebaseJsonPath, { format: "json" });
|
|
8658
|
+
if (config && typeof config === "object") {
|
|
8659
|
+
const fb = config;
|
|
8660
|
+
firebaseConfig = {
|
|
8661
|
+
projectId: fb.projectId,
|
|
8662
|
+
hasHosting: !!fb.hosting,
|
|
8663
|
+
hasFunctions: !!fb.functions,
|
|
8664
|
+
hasFirestoreRules: !!fb.firestore?.rules,
|
|
8665
|
+
hasStorageRules: !!fb.storage?.rules
|
|
8666
|
+
};
|
|
8667
|
+
}
|
|
8668
|
+
} catch {
|
|
8669
|
+
firebaseConfig = {
|
|
8670
|
+
hasHosting: false,
|
|
8671
|
+
hasFunctions: false,
|
|
8672
|
+
hasFirestoreRules: false,
|
|
8673
|
+
hasStorageRules: false
|
|
8674
|
+
};
|
|
8675
|
+
}
|
|
8676
|
+
}
|
|
8677
|
+
const supabaseFunctionsDir = joinPath(supabaseDir, "functions");
|
|
8678
|
+
const supabaseMigrationsDir = joinPath(supabaseDir, "migrations");
|
|
8679
|
+
let supabaseConfig;
|
|
8680
|
+
if (hasSupabase) {
|
|
8681
|
+
let url;
|
|
8682
|
+
try {
|
|
8683
|
+
const envPath = joinPath(appPath, ".env");
|
|
8684
|
+
if (pathExists(envPath)) {
|
|
8685
|
+
const envContent = requireText(readSync(envPath), envPath);
|
|
8686
|
+
const urlMatch = envContent.match(/VITE_SUPABASE_URL=(.+)/);
|
|
8687
|
+
if (urlMatch && urlMatch[1]) {
|
|
8688
|
+
url = urlMatch[1].trim();
|
|
8689
|
+
}
|
|
8690
|
+
}
|
|
8691
|
+
} catch {
|
|
8692
|
+
}
|
|
8693
|
+
supabaseConfig = {
|
|
8694
|
+
url,
|
|
8695
|
+
hasFunctions: pathExists(supabaseFunctionsDir),
|
|
8696
|
+
hasMigrations: pathExists(supabaseMigrationsDir)
|
|
8697
|
+
};
|
|
8698
|
+
}
|
|
8699
|
+
let functions;
|
|
8700
|
+
if (hasFirebase && firebaseConfig?.hasFunctions) {
|
|
8701
|
+
const firebaseFunctionsDir = joinPath(appPath, "functions");
|
|
8702
|
+
const firebaseFunctionsStat = statSync2(firebaseFunctionsDir);
|
|
8703
|
+
if (pathExists(firebaseFunctionsDir) && (firebaseFunctionsStat?.isDirectory() ?? false)) {
|
|
8704
|
+
functions = "firebase";
|
|
8705
|
+
}
|
|
8706
|
+
}
|
|
8707
|
+
if (!functions && hasSupabase) {
|
|
8708
|
+
const sbFunctionsStat = statSync2(supabaseFunctionsDir);
|
|
8709
|
+
if (pathExists(supabaseFunctionsDir) && (sbFunctionsStat?.isDirectory() ?? false)) {
|
|
8710
|
+
functions = "supabase";
|
|
8711
|
+
}
|
|
8712
|
+
}
|
|
8713
|
+
if (!functions) {
|
|
8714
|
+
const vercelJsonPath = joinPath(appPath, "vercel.json");
|
|
8715
|
+
const apiDir = joinPath(appPath, "api");
|
|
8716
|
+
const apiDirStat = statSync2(apiDir);
|
|
8717
|
+
if (pathExists(vercelJsonPath) && pathExists(apiDir) && (apiDirStat?.isDirectory() ?? false)) {
|
|
8718
|
+
functions = "vercel";
|
|
8719
|
+
}
|
|
8720
|
+
}
|
|
8721
|
+
let hosting;
|
|
8722
|
+
if (hasFirebase && firebaseConfig?.hasHosting) {
|
|
8723
|
+
hosting = "firebase";
|
|
8724
|
+
}
|
|
8725
|
+
if (!hosting) {
|
|
8726
|
+
if (pathExists(joinPath(appPath, "vercel.json")) || pathExists(joinPath(appPath, ".vercel"))) {
|
|
8727
|
+
hosting = "vercel";
|
|
8728
|
+
}
|
|
8729
|
+
}
|
|
8730
|
+
return {
|
|
8731
|
+
name: appName,
|
|
8732
|
+
packageName: packageJson.name || appName,
|
|
8733
|
+
path: appPath,
|
|
8734
|
+
framework,
|
|
8735
|
+
provider,
|
|
8736
|
+
functions,
|
|
8737
|
+
hosting,
|
|
8738
|
+
firebaseConfig,
|
|
8739
|
+
supabaseConfig
|
|
8740
|
+
};
|
|
8741
|
+
}
|
|
8742
|
+
var init_app_detection = __esm({
|
|
8743
|
+
"packages/tooling/src/utils/app-detection.ts"() {
|
|
8744
|
+
"use strict";
|
|
8745
|
+
init_utils2();
|
|
8746
|
+
init_pathResolver();
|
|
8747
|
+
init_typed_file_operations();
|
|
8748
|
+
init_type_guards();
|
|
8749
|
+
}
|
|
8750
|
+
});
|
|
8751
|
+
|
|
8508
8752
|
// packages/tooling/src/utils/cli-input.ts
|
|
8509
8753
|
async function askForSelection(message, choices, defaultValue = 0) {
|
|
8510
|
-
const options = choices.map((choice) =>
|
|
8511
|
-
value
|
|
8512
|
-
label: choice.title,
|
|
8513
|
-
|
|
8514
|
-
|
|
8754
|
+
const options = choices.map((choice) => {
|
|
8755
|
+
const value = choice.value;
|
|
8756
|
+
return { value, label: choice.title, hint: choice.hint };
|
|
8757
|
+
});
|
|
8758
|
+
const initialValue = choices[defaultValue]?.value;
|
|
8515
8759
|
const result = await select({
|
|
8516
8760
|
message,
|
|
8517
8761
|
options,
|
|
8518
|
-
initialValue
|
|
8762
|
+
initialValue
|
|
8519
8763
|
});
|
|
8520
8764
|
if (isCancel(result)) {
|
|
8521
8765
|
cancel("Operation cancelled.");
|
|
8522
8766
|
process.exit(0);
|
|
8523
8767
|
}
|
|
8524
|
-
|
|
8768
|
+
const picked = choices.find((choice) => choice.value === result);
|
|
8769
|
+
if (!picked) {
|
|
8770
|
+
throw new Error(`Unknown selection: ${result}`);
|
|
8771
|
+
}
|
|
8772
|
+
return picked.value;
|
|
8525
8773
|
}
|
|
8526
8774
|
var init_cli_input = __esm({
|
|
8527
8775
|
"packages/tooling/src/utils/cli-input.ts"() {
|
|
8528
8776
|
"use strict";
|
|
8529
8777
|
init_utils2();
|
|
8530
|
-
|
|
8778
|
+
init_dist5();
|
|
8531
8779
|
}
|
|
8532
8780
|
});
|
|
8533
8781
|
|
|
@@ -8845,8 +9093,12 @@ function detectFirebaseProjectId(cwd) {
|
|
|
8845
9093
|
const firebasercPath = joinPath(searchDir, ".firebaserc");
|
|
8846
9094
|
if (pathExists(firebasercPath)) {
|
|
8847
9095
|
try {
|
|
8848
|
-
const firebasercRaw = readSync(firebasercPath, {
|
|
8849
|
-
|
|
9096
|
+
const firebasercRaw = readSync(firebasercPath, {
|
|
9097
|
+
format: "json"
|
|
9098
|
+
});
|
|
9099
|
+
const projects = isObjectLike(firebasercRaw) ? firebasercRaw.projects : void 0;
|
|
9100
|
+
const defaultProject = isObjectLike(projects) ? projects.default : void 0;
|
|
9101
|
+
const firebaserc = typeof defaultProject === "string" ? { projects: { default: defaultProject } } : null;
|
|
8850
9102
|
if (firebaserc && firebaserc.projects?.default) {
|
|
8851
9103
|
return firebaserc.projects.default;
|
|
8852
9104
|
}
|
|
@@ -8859,8 +9111,12 @@ function detectFirebaseProjectId(cwd) {
|
|
|
8859
9111
|
const firebasercPath2 = joinPath(current, ".firebaserc");
|
|
8860
9112
|
if (pathExists(firebasercPath2)) {
|
|
8861
9113
|
try {
|
|
8862
|
-
const firebasercRaw = readSync(firebasercPath2, {
|
|
8863
|
-
|
|
9114
|
+
const firebasercRaw = readSync(firebasercPath2, {
|
|
9115
|
+
format: "json"
|
|
9116
|
+
});
|
|
9117
|
+
const projects = isObjectLike(firebasercRaw) ? firebasercRaw.projects : void 0;
|
|
9118
|
+
const defaultProject = isObjectLike(projects) ? projects.default : void 0;
|
|
9119
|
+
const firebaserc = typeof defaultProject === "string" ? { projects: { default: defaultProject } } : null;
|
|
8864
9120
|
if (firebaserc && firebaserc.projects?.default) {
|
|
8865
9121
|
return firebaserc.projects.default;
|
|
8866
9122
|
}
|
|
@@ -9033,6 +9289,44 @@ ${errorOutput}`
|
|
|
9033
9289
|
);
|
|
9034
9290
|
}
|
|
9035
9291
|
}
|
|
9292
|
+
async function selectVercelAppDir(projectRoot, appName) {
|
|
9293
|
+
const apps = detectApps(projectRoot).filter(usesVercel);
|
|
9294
|
+
if (apps.length === 0) {
|
|
9295
|
+
throw new DoNotDevError(
|
|
9296
|
+
`No Vercel app found under ${projectRoot}. An app targets Vercel when its folder has vercel.json or .vercel/.`,
|
|
9297
|
+
"configuration-error",
|
|
9298
|
+
{ context: { platform: "vercel" } }
|
|
9299
|
+
);
|
|
9300
|
+
}
|
|
9301
|
+
if (appName) {
|
|
9302
|
+
const named = apps.find((app) => app.name === appName);
|
|
9303
|
+
if (!named) {
|
|
9304
|
+
throw new DoNotDevError(
|
|
9305
|
+
`App "${appName}" is not a Vercel app. Vercel apps: ${apps.map((app) => app.name).join(", ")}.`,
|
|
9306
|
+
"configuration-error",
|
|
9307
|
+
{ context: { platform: "vercel", app: appName } }
|
|
9308
|
+
);
|
|
9309
|
+
}
|
|
9310
|
+
return named.path;
|
|
9311
|
+
}
|
|
9312
|
+
if (apps.length === 1) {
|
|
9313
|
+
note(`Using app: ${apps[0].name}`, "Auto-detected");
|
|
9314
|
+
return apps[0].path;
|
|
9315
|
+
}
|
|
9316
|
+
const picked = await askForSelection(
|
|
9317
|
+
"Which app would you like to sync secrets for?",
|
|
9318
|
+
apps.map((app) => ({ title: app.name, value: app.name }))
|
|
9319
|
+
);
|
|
9320
|
+
const selected = apps.find((app) => app.name === picked);
|
|
9321
|
+
if (!selected) {
|
|
9322
|
+
throw new DoNotDevError(
|
|
9323
|
+
`App "${picked}" is not a Vercel app.`,
|
|
9324
|
+
"configuration-error",
|
|
9325
|
+
{ context: { platform: "vercel", app: picked } }
|
|
9326
|
+
);
|
|
9327
|
+
}
|
|
9328
|
+
return selected.path;
|
|
9329
|
+
}
|
|
9036
9330
|
async function resolveVercelCredentialsForSync(appDir, projectIdOverride, dryRun) {
|
|
9037
9331
|
const credResult = resolveVercelCredentials(appDir);
|
|
9038
9332
|
if (credResult.missing) {
|
|
@@ -9068,6 +9362,32 @@ async function resolveVercelCredentialsForSync(appDir, projectIdOverride, dryRun
|
|
|
9068
9362
|
}
|
|
9069
9363
|
return credentials;
|
|
9070
9364
|
}
|
|
9365
|
+
function readPublicAppEnv(appDir) {
|
|
9366
|
+
const env = parseEnvFile2(joinPath(appDir, ".env"));
|
|
9367
|
+
return Object.fromEntries(
|
|
9368
|
+
Object.entries(env).filter(
|
|
9369
|
+
([key]) => PUBLIC_ENV_PREFIXES.some((prefix) => key.startsWith(prefix))
|
|
9370
|
+
)
|
|
9371
|
+
);
|
|
9372
|
+
}
|
|
9373
|
+
async function syncVercelPublicEnv(appDir, options = {}) {
|
|
9374
|
+
const dryRun = options.dryRun ?? false;
|
|
9375
|
+
const publicEnv = readPublicAppEnv(appDir);
|
|
9376
|
+
const keys = Object.keys(publicEnv);
|
|
9377
|
+
if (keys.length === 0) {
|
|
9378
|
+
log2.info(`No public variables (${PUBLIC_ENV_PREFIXES.join(", ")}) in ${joinPath(appDir, ".env")}`);
|
|
9379
|
+
return;
|
|
9380
|
+
}
|
|
9381
|
+
const credentials = await resolveVercelCredentialsForSync(
|
|
9382
|
+
appDir,
|
|
9383
|
+
options.vercelProjectId,
|
|
9384
|
+
dryRun
|
|
9385
|
+
);
|
|
9386
|
+
log2.info(`Syncing ${keys.length} public variables to Vercel:`);
|
|
9387
|
+
for (const [key, value] of Object.entries(publicEnv)) {
|
|
9388
|
+
await setVercelSecret(key, value, credentials, dryRun);
|
|
9389
|
+
}
|
|
9390
|
+
}
|
|
9071
9391
|
async function setVercelSecret(key, value, credentials, dryRun = false) {
|
|
9072
9392
|
if (dryRun) {
|
|
9073
9393
|
log2.info(`[DRY RUN] Would set Vercel environment variable: ${key}`);
|
|
@@ -9206,6 +9526,7 @@ async function main(options = {}) {
|
|
|
9206
9526
|
platform: options.platform,
|
|
9207
9527
|
projectId: options.projectId,
|
|
9208
9528
|
vercelProjectId: options.vercelProjectId,
|
|
9529
|
+
app: options.app,
|
|
9209
9530
|
target: options.target || "runtime",
|
|
9210
9531
|
repo: options.repo,
|
|
9211
9532
|
dryRun: options.dryRun ?? false,
|
|
@@ -9222,7 +9543,11 @@ Options:
|
|
|
9222
9543
|
--target <target> Sync target: 'runtime' (default) or 'github'
|
|
9223
9544
|
--platform <platform> Platform to sync to: 'firebase' or 'vercel' (runtime target only, auto-detected)
|
|
9224
9545
|
--project <id> Firebase project ID (for Firebase platform)
|
|
9225
|
-
--
|
|
9546
|
+
--app <name> Vercel app to sync (apps/<name>); prompts when several exist
|
|
9547
|
+
--vercel-project <id> Vercel project ID (overrides VERCEL_PROJECT_ID from apps/<app>/.env)
|
|
9548
|
+
|
|
9549
|
+
Vercel receives only the public variables (NEXT_PUBLIC_*, VITE_*, EXPO_PUBLIC_*)
|
|
9550
|
+
of apps/<app>/.env. .dndev.secrets is never sent to Vercel.
|
|
9226
9551
|
--repo <owner/repo> GitHub repository (github target only, auto-detected from git remote)
|
|
9227
9552
|
--dry-run, --dry Show what would be done without actually setting secrets
|
|
9228
9553
|
--verbose Show detailed output
|
|
@@ -9233,6 +9558,7 @@ Examples:
|
|
|
9233
9558
|
dndev sync-secrets --target github # sync to GitHub Secrets
|
|
9234
9559
|
dndev sync-secrets --target github --repo owner/repo # sync to specific repo
|
|
9235
9560
|
dndev sync-secrets --platform=firebase
|
|
9561
|
+
dndev sync-secrets --platform vercel --app web # public vars of apps/web
|
|
9236
9562
|
dndev sync-secrets --dry-run
|
|
9237
9563
|
dndev sync-secrets --env-file .env.production --project my-project
|
|
9238
9564
|
`);
|
|
@@ -9241,7 +9567,7 @@ Examples:
|
|
|
9241
9567
|
try {
|
|
9242
9568
|
const currentDir = process.cwd();
|
|
9243
9569
|
let firebaseProjectDir;
|
|
9244
|
-
if (!options.envFile || config.envFile === ".env") {
|
|
9570
|
+
if (config.platform !== "vercel" && (!options.envFile || config.envFile === ".env")) {
|
|
9245
9571
|
const appsWithFunctions = detectAppsWithFunctions();
|
|
9246
9572
|
if (appsWithFunctions.length > 0) {
|
|
9247
9573
|
let selectedApp;
|
|
@@ -9320,6 +9646,16 @@ Examples:
|
|
|
9320
9646
|
return 0;
|
|
9321
9647
|
}
|
|
9322
9648
|
const platform = config.platform || detectPlatform();
|
|
9649
|
+
if (platform === "vercel") {
|
|
9650
|
+
await syncVercelPublicEnv(
|
|
9651
|
+
await selectVercelAppDir(currentDir, config.app),
|
|
9652
|
+
{ vercelProjectId: config.vercelProjectId, dryRun: config.dryRun }
|
|
9653
|
+
);
|
|
9654
|
+
log2.success(
|
|
9655
|
+
config.dryRun ? "\nDry run completed. Nothing was set on Vercel." : "\nPublic variables synced to Vercel."
|
|
9656
|
+
);
|
|
9657
|
+
return 0;
|
|
9658
|
+
}
|
|
9323
9659
|
if (config.verbose) {
|
|
9324
9660
|
log2.debug(`Working directory: ${currentDir}`);
|
|
9325
9661
|
log2.debug(`Environment file: ${envFilePath}`);
|
|
@@ -9341,27 +9677,18 @@ Examples:
|
|
|
9341
9677
|
log2.info(` ${key}`);
|
|
9342
9678
|
}
|
|
9343
9679
|
});
|
|
9344
|
-
const finalFirebaseProjectDir =
|
|
9680
|
+
const finalFirebaseProjectDir = firebaseProjectDir || findFirebaseProjectDir(config.envFile);
|
|
9345
9681
|
if (config.verbose && finalFirebaseProjectDir) {
|
|
9346
9682
|
log2.debug(`Firebase project directory: ${finalFirebaseProjectDir}`);
|
|
9347
9683
|
}
|
|
9348
|
-
const vercelCredentials = platform === "vercel" ? await resolveVercelCredentialsForSync(
|
|
9349
|
-
currentDir,
|
|
9350
|
-
config.vercelProjectId,
|
|
9351
|
-
config.dryRun ?? false
|
|
9352
|
-
) : void 0;
|
|
9353
9684
|
for (const [key, value] of Object.entries(secrets)) {
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
);
|
|
9362
|
-
} else if (platform === "vercel") {
|
|
9363
|
-
await setVercelSecret(key, value, vercelCredentials, config.dryRun);
|
|
9364
|
-
}
|
|
9685
|
+
await setFirebaseSecret(
|
|
9686
|
+
key,
|
|
9687
|
+
value,
|
|
9688
|
+
config.projectId,
|
|
9689
|
+
config.dryRun,
|
|
9690
|
+
finalFirebaseProjectDir
|
|
9691
|
+
);
|
|
9365
9692
|
}
|
|
9366
9693
|
if (config.dryRun) {
|
|
9367
9694
|
log2.success(
|
|
@@ -9381,17 +9708,21 @@ All secrets synced successfully to ${platform}!`);
|
|
|
9381
9708
|
return 1;
|
|
9382
9709
|
}
|
|
9383
9710
|
}
|
|
9711
|
+
var PUBLIC_ENV_PREFIXES;
|
|
9384
9712
|
var init_sync_secrets = __esm({
|
|
9385
9713
|
"packages/tooling/src/apps/sync-secrets.ts"() {
|
|
9386
9714
|
"use strict";
|
|
9387
9715
|
init_utils2();
|
|
9388
9716
|
init_vercel_api();
|
|
9389
9717
|
init_vercel_token();
|
|
9718
|
+
init_app_detection();
|
|
9390
9719
|
init_cli_input();
|
|
9391
9720
|
init_cli_output();
|
|
9392
9721
|
init_errors();
|
|
9393
9722
|
init_pathResolver();
|
|
9394
9723
|
init_secrets_resolver();
|
|
9724
|
+
init_type_guards();
|
|
9725
|
+
PUBLIC_ENV_PREFIXES = ["NEXT_PUBLIC_", "VITE_", "EXPO_PUBLIC_"];
|
|
9395
9726
|
}
|
|
9396
9727
|
});
|
|
9397
9728
|
|