@donotdev/cli 0.0.15 → 0.0.16
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 +36 -20
- package/dist/bin/commands/build.js +69 -52
- package/dist/bin/commands/bump.js +7 -13
- package/dist/bin/commands/create-app.js +77 -29
- package/dist/bin/commands/create-project.js +109 -135
- package/dist/bin/commands/deploy.js +97 -45
- package/dist/bin/commands/dev.js +43 -24
- package/dist/bin/commands/doctor.d.ts +6 -0
- package/dist/bin/commands/doctor.d.ts.map +1 -0
- package/dist/bin/commands/{lint.js → doctor.js} +1178 -147
- package/dist/bin/commands/doctor.js.map +1 -0
- package/dist/bin/commands/emu.js +297 -107
- package/dist/bin/commands/make-admin.js +77499 -11
- package/dist/bin/commands/preview.js +44 -25
- package/dist/bin/commands/setup.d.ts +6 -0
- package/dist/bin/commands/setup.d.ts.map +1 -0
- package/dist/bin/commands/setup.js +11733 -0
- package/dist/bin/commands/setup.js.map +1 -0
- package/dist/bin/commands/type-check.js +2018 -283
- package/dist/bin/dndev.js +54 -58
- package/dist/bin/donotdev.js +28 -44
- package/dist/index.js +633 -416
- package/package.json +2 -2
- package/templates/app-expo/.env.example +2 -22
- package/templates/app-expo/README.md.example +1 -1
- package/templates/app-expo/assets/adaptive-icon.png +0 -0
- package/templates/app-expo/assets/favicon.png +0 -0
- package/templates/app-expo/assets/icon.png +0 -0
- package/templates/app-expo/assets/splash.png +0 -0
- package/templates/app-expo/src/config/app.ts.example +46 -0
- package/templates/app-expo/src/config/providers.ts.example +7 -0
- package/templates/app-next/src/config/providers.ts.example +7 -0
- package/templates/app-vite/src/config/providers.ts.example +7 -0
- package/templates/app-vite/src/pages/HomePage.tsx.example +1 -1
- package/templates/functions-firebase/README.md.example +1 -1
- package/templates/functions-firebase/functions-firebase/.env.example.example +1 -1
- package/templates/functions-firebase/functions-firebase/README.md.example +1 -1
- package/templates/functions-firebase/functions-firebase/tsconfig.json.example +1 -1
- package/templates/functions-firebase/functions.config.js.example +1 -1
- package/templates/functions-supabase/supabase/config.toml.example +59 -0
- package/templates/functions-supabase/supabase/functions/.env.example +13 -0
- package/templates/functions-supabase/supabase/functions/deno.json.example +8 -0
- package/templates/overlay-firebase/env.fragment.example +1 -1
- package/templates/overlay-firebase/env.fragment.expo.example +1 -1
- package/templates/overlay-firebase/env.fragment.nextjs.example +1 -1
- package/templates/overlay-supabase/env.fragment.example +8 -3
- package/templates/overlay-supabase/env.fragment.expo.example +8 -3
- package/templates/overlay-supabase/env.fragment.nextjs.example +8 -3
- package/templates/overlay-vercel/env.fragment.example +1 -1
- package/templates/overlay-vercel/env.fragment.nextjs.example +1 -1
- package/templates/root-consumer/AI.md.example +15 -0
- package/templates/root-consumer/guides/dndev/AGENT_START_HERE.md.example +2 -2
- package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +6 -6
- package/templates/root-consumer/guides/dndev/INDEX.md.example +2 -2
- package/templates/root-consumer/guides/dndev/SETUP_APP_CONFIG.md.example +3 -3
- package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +98 -0
- package/templates/root-consumer/guides/dndev/SETUP_FIREBASE.md.example +4 -4
- package/templates/root-consumer/guides/dndev/SETUP_OAUTH_PROVIDERS.md.example +60 -0
- package/templates/root-consumer/guides/dndev/SETUP_STRIPE.md.example +62 -0
- package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +3 -3
- package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +2 -2
- package/templates/root-consumer/guides/wai-way/WAI_WAY_CLI.md.example +7 -8
- package/templates/root-consumer/guides/wai-way/blueprints/1_scaffold.md.example +9 -5
- package/dist/bin/commands/lint.d.ts +0 -11
- package/dist/bin/commands/lint.d.ts.map +0 -1
- package/dist/bin/commands/lint.js.map +0 -1
- package/dist/bin/commands/staging.d.ts +0 -11
- package/dist/bin/commands/staging.d.ts.map +0 -1
- package/dist/bin/commands/staging.js +0 -12
- package/dist/bin/commands/staging.js.map +0 -1
|
@@ -4,11 +4,11 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __require = /* @__PURE__ */ ((
|
|
8
|
-
get: (a,
|
|
9
|
-
}) :
|
|
7
|
+
var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
|
|
8
|
+
get: (a, b3) => (typeof require !== "undefined" ? require : a)[b3]
|
|
9
|
+
}) : x2)(function(x2) {
|
|
10
10
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
-
throw Error('Dynamic require of "' +
|
|
11
|
+
throw Error('Dynamic require of "' + x2 + '" is not supported');
|
|
12
12
|
});
|
|
13
13
|
var __esm = (fn, res) => function __init() {
|
|
14
14
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
@@ -16,6 +16,10 @@ var __esm = (fn, res) => function __init() {
|
|
|
16
16
|
var __commonJS = (cb, mod) => function __require2() {
|
|
17
17
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
18
|
};
|
|
19
|
+
var __export = (target, all) => {
|
|
20
|
+
for (var name in all)
|
|
21
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
22
|
+
};
|
|
19
23
|
var __copyProps = (to, from, except, desc) => {
|
|
20
24
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
21
25
|
for (let key of __getOwnPropNames(from))
|
|
@@ -42,16 +46,16 @@ var require_src = __commonJS({
|
|
|
42
46
|
var CSI = `${ESC}[`;
|
|
43
47
|
var beep = "\x07";
|
|
44
48
|
var cursor = {
|
|
45
|
-
to(
|
|
46
|
-
if (!
|
|
47
|
-
return `${CSI}${
|
|
49
|
+
to(x2, y3) {
|
|
50
|
+
if (!y3) return `${CSI}${x2 + 1}G`;
|
|
51
|
+
return `${CSI}${y3 + 1};${x2 + 1}H`;
|
|
48
52
|
},
|
|
49
|
-
move(
|
|
53
|
+
move(x2, y3) {
|
|
50
54
|
let ret = "";
|
|
51
|
-
if (
|
|
52
|
-
else if (
|
|
53
|
-
if (
|
|
54
|
-
else if (
|
|
55
|
+
if (x2 < 0) ret += `${CSI}${-x2}D`;
|
|
56
|
+
else if (x2 > 0) ret += `${CSI}${x2}C`;
|
|
57
|
+
if (y3 < 0) ret += `${CSI}${-y3}A`;
|
|
58
|
+
else if (y3 > 0) ret += `${CSI}${y3}B`;
|
|
55
59
|
return ret;
|
|
56
60
|
},
|
|
57
61
|
up: (count = 1) => `${CSI}${count}A`,
|
|
@@ -94,10 +98,10 @@ var require_src = __commonJS({
|
|
|
94
98
|
var require_picocolors = __commonJS({
|
|
95
99
|
"node_modules/.bun/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
|
|
96
100
|
init_utils();
|
|
97
|
-
var
|
|
98
|
-
var argv =
|
|
99
|
-
var env =
|
|
100
|
-
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") ||
|
|
101
|
+
var p2 = process || {};
|
|
102
|
+
var argv = p2.argv || [];
|
|
103
|
+
var env = p2.env || {};
|
|
104
|
+
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p2.platform === "win32" || (p2.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
101
105
|
var formatter = (open, close, replace = open) => (input) => {
|
|
102
106
|
let string = "" + input, index = string.indexOf(close, open.length);
|
|
103
107
|
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
@@ -165,14 +169,41 @@ var require_picocolors = __commonJS({
|
|
|
165
169
|
|
|
166
170
|
// node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/node_modules/@clack/core/dist/index.mjs
|
|
167
171
|
import { stdin as j, stdout as M } from "node:process";
|
|
172
|
+
import O from "node:readline";
|
|
168
173
|
import { Writable as X } from "node:stream";
|
|
169
174
|
function DD({ onlyFirst: e2 = false } = {}) {
|
|
170
175
|
const t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
171
176
|
return new RegExp(t, e2 ? void 0 : "g");
|
|
172
177
|
}
|
|
178
|
+
function P(e2) {
|
|
179
|
+
if (typeof e2 != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof e2}\``);
|
|
180
|
+
return e2.replace(uD, "");
|
|
181
|
+
}
|
|
173
182
|
function L(e2) {
|
|
174
183
|
return e2 && e2.__esModule && Object.prototype.hasOwnProperty.call(e2, "default") ? e2.default : e2;
|
|
175
184
|
}
|
|
185
|
+
function p(e2, u2 = {}) {
|
|
186
|
+
if (typeof e2 != "string" || e2.length === 0 || (u2 = { ambiguousIsNarrow: true, ...u2 }, e2 = P(e2), e2.length === 0)) return 0;
|
|
187
|
+
e2 = e2.replace(sD(), " ");
|
|
188
|
+
const t = u2.ambiguousIsNarrow ? 1 : 2;
|
|
189
|
+
let F2 = 0;
|
|
190
|
+
for (const s of e2) {
|
|
191
|
+
const i = s.codePointAt(0);
|
|
192
|
+
if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879) continue;
|
|
193
|
+
switch (eD.eastAsianWidth(s)) {
|
|
194
|
+
case "F":
|
|
195
|
+
case "W":
|
|
196
|
+
F2 += 2;
|
|
197
|
+
break;
|
|
198
|
+
case "A":
|
|
199
|
+
F2 += t;
|
|
200
|
+
break;
|
|
201
|
+
default:
|
|
202
|
+
F2 += 1;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return F2;
|
|
206
|
+
}
|
|
176
207
|
function rD() {
|
|
177
208
|
const e2 = /* @__PURE__ */ new Map();
|
|
178
209
|
for (const [u2, t] of Object.entries(r)) {
|
|
@@ -202,7 +233,30 @@ function rD() {
|
|
|
202
233
|
return i === 2 && (D2 += 60), D2;
|
|
203
234
|
}, enumerable: false }, rgbToAnsi: { value: (u2, t, F2) => r.ansi256ToAnsi(r.rgbToAnsi256(u2, t, F2)), enumerable: false }, hexToAnsi: { value: (u2) => r.ansi256ToAnsi(r.hexToAnsi256(u2)), enumerable: false } }), r;
|
|
204
235
|
}
|
|
205
|
-
|
|
236
|
+
function Y(e2, u2, t) {
|
|
237
|
+
return String(e2).normalize().replace(/\r\n/g, `
|
|
238
|
+
`).split(`
|
|
239
|
+
`).map((F2) => lD(F2, u2, t)).join(`
|
|
240
|
+
`);
|
|
241
|
+
}
|
|
242
|
+
function $(e2, u2) {
|
|
243
|
+
if (typeof e2 == "string") return B.aliases.get(e2) === u2;
|
|
244
|
+
for (const t of e2) if (t !== void 0 && $(t, u2)) return true;
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
function BD(e2, u2) {
|
|
248
|
+
if (e2 === u2) return;
|
|
249
|
+
const t = e2.split(`
|
|
250
|
+
`), F2 = u2.split(`
|
|
251
|
+
`), s = [];
|
|
252
|
+
for (let i = 0; i < Math.max(t.length, F2.length); i++) t[i] !== F2[i] && s.push(i);
|
|
253
|
+
return s;
|
|
254
|
+
}
|
|
255
|
+
function m(e2, u2) {
|
|
256
|
+
const t = e2;
|
|
257
|
+
t.isTTY && t.setRawMode(u2);
|
|
258
|
+
}
|
|
259
|
+
var import_sisteransi, uD, W, tD, eD, FD, sD, w, N, I, R, r, iD, CD, ED, d, oD, y, V, nD, G, _, z, K, aD, k, hD, lD, xD, B, AD, S, gD, vD, h, x, A, OD, PD, J, LD;
|
|
206
260
|
var init_dist = __esm({
|
|
207
261
|
"node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/node_modules/@clack/core/dist/index.mjs"() {
|
|
208
262
|
init_utils();
|
|
@@ -251,22 +305,213 @@ var init_dist = __esm({
|
|
|
251
305
|
CD = Object.keys(r.bgColor);
|
|
252
306
|
[...iD, ...CD];
|
|
253
307
|
ED = rD();
|
|
308
|
+
d = /* @__PURE__ */ new Set(["\x1B", "\x9B"]);
|
|
309
|
+
oD = 39;
|
|
310
|
+
y = "\x07";
|
|
311
|
+
V = "[";
|
|
254
312
|
nD = "]";
|
|
313
|
+
G = "m";
|
|
255
314
|
_ = `${nD}8;;`;
|
|
315
|
+
z = (e2) => `${d.values().next().value}${V}${e2}${G}`;
|
|
316
|
+
K = (e2) => `${d.values().next().value}${_}${e2}${y}`;
|
|
317
|
+
aD = (e2) => e2.split(" ").map((u2) => p(u2));
|
|
318
|
+
k = (e2, u2, t) => {
|
|
319
|
+
const F2 = [...u2];
|
|
320
|
+
let s = false, i = false, D2 = p(P(e2[e2.length - 1]));
|
|
321
|
+
for (const [C2, n] of F2.entries()) {
|
|
322
|
+
const E = p(n);
|
|
323
|
+
if (D2 + E <= t ? e2[e2.length - 1] += n : (e2.push(n), D2 = 0), d.has(n) && (s = true, i = F2.slice(C2 + 1).join("").startsWith(_)), s) {
|
|
324
|
+
i ? n === y && (s = false, i = false) : n === G && (s = false);
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
D2 += E, D2 === t && C2 < F2.length - 1 && (e2.push(""), D2 = 0);
|
|
328
|
+
}
|
|
329
|
+
!D2 && e2[e2.length - 1].length > 0 && e2.length > 1 && (e2[e2.length - 2] += e2.pop());
|
|
330
|
+
};
|
|
331
|
+
hD = (e2) => {
|
|
332
|
+
const u2 = e2.split(" ");
|
|
333
|
+
let t = u2.length;
|
|
334
|
+
for (; t > 0 && !(p(u2[t - 1]) > 0); ) t--;
|
|
335
|
+
return t === u2.length ? e2 : u2.slice(0, t).join(" ") + u2.slice(t).join("");
|
|
336
|
+
};
|
|
337
|
+
lD = (e2, u2, t = {}) => {
|
|
338
|
+
if (t.trim !== false && e2.trim() === "") return "";
|
|
339
|
+
let F2 = "", s, i;
|
|
340
|
+
const D2 = aD(e2);
|
|
341
|
+
let C2 = [""];
|
|
342
|
+
for (const [E, a] of e2.split(" ").entries()) {
|
|
343
|
+
t.trim !== false && (C2[C2.length - 1] = C2[C2.length - 1].trimStart());
|
|
344
|
+
let o2 = p(C2[C2.length - 1]);
|
|
345
|
+
if (E !== 0 && (o2 >= u2 && (t.wordWrap === false || t.trim === false) && (C2.push(""), o2 = 0), (o2 > 0 || t.trim === false) && (C2[C2.length - 1] += " ", o2++)), t.hard && D2[E] > u2) {
|
|
346
|
+
const c = u2 - o2, f = 1 + Math.floor((D2[E] - c - 1) / u2);
|
|
347
|
+
Math.floor((D2[E] - 1) / u2) < f && C2.push(""), k(C2, a, u2);
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
350
|
+
if (o2 + D2[E] > u2 && o2 > 0 && D2[E] > 0) {
|
|
351
|
+
if (t.wordWrap === false && o2 < u2) {
|
|
352
|
+
k(C2, a, u2);
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
C2.push("");
|
|
356
|
+
}
|
|
357
|
+
if (o2 + D2[E] > u2 && t.wordWrap === false) {
|
|
358
|
+
k(C2, a, u2);
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
C2[C2.length - 1] += a;
|
|
362
|
+
}
|
|
363
|
+
t.trim !== false && (C2 = C2.map((E) => hD(E)));
|
|
364
|
+
const n = [...C2.join(`
|
|
365
|
+
`)];
|
|
366
|
+
for (const [E, a] of n.entries()) {
|
|
367
|
+
if (F2 += a, d.has(a)) {
|
|
368
|
+
const { groups: c } = new RegExp(`(?:\\${V}(?<code>\\d+)m|\\${_}(?<uri>.*)${y})`).exec(n.slice(E).join("")) || { groups: {} };
|
|
369
|
+
if (c.code !== void 0) {
|
|
370
|
+
const f = Number.parseFloat(c.code);
|
|
371
|
+
s = f === oD ? void 0 : f;
|
|
372
|
+
} else c.uri !== void 0 && (i = c.uri.length === 0 ? void 0 : c.uri);
|
|
373
|
+
}
|
|
374
|
+
const o2 = ED.codes.get(Number(s));
|
|
375
|
+
n[E + 1] === `
|
|
376
|
+
` ? (i && (F2 += K("")), s && o2 && (F2 += z(o2))) : a === `
|
|
377
|
+
` && (s && o2 && (F2 += z(s)), i && (F2 += K(i)));
|
|
378
|
+
}
|
|
379
|
+
return F2;
|
|
380
|
+
};
|
|
256
381
|
xD = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
257
382
|
B = { actions: new Set(xD), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]) };
|
|
258
383
|
AD = globalThis.process.platform.startsWith("win");
|
|
384
|
+
S = /* @__PURE__ */ Symbol("clack:cancel");
|
|
385
|
+
gD = Object.defineProperty;
|
|
386
|
+
vD = (e2, u2, t) => u2 in e2 ? gD(e2, u2, { enumerable: true, configurable: true, writable: true, value: t }) : e2[u2] = t;
|
|
387
|
+
h = (e2, u2, t) => (vD(e2, typeof u2 != "symbol" ? u2 + "" : u2, t), t);
|
|
388
|
+
x = class {
|
|
389
|
+
constructor(u2, t = true) {
|
|
390
|
+
h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
|
|
391
|
+
const { input: F2 = j, output: s = M, render: i, signal: D2, ...C2 } = u2;
|
|
392
|
+
this.opts = C2, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = t, this._abortSignal = D2, this.input = F2, this.output = s;
|
|
393
|
+
}
|
|
394
|
+
unsubscribe() {
|
|
395
|
+
this._subscribers.clear();
|
|
396
|
+
}
|
|
397
|
+
setSubscriber(u2, t) {
|
|
398
|
+
const F2 = this._subscribers.get(u2) ?? [];
|
|
399
|
+
F2.push(t), this._subscribers.set(u2, F2);
|
|
400
|
+
}
|
|
401
|
+
on(u2, t) {
|
|
402
|
+
this.setSubscriber(u2, { cb: t });
|
|
403
|
+
}
|
|
404
|
+
once(u2, t) {
|
|
405
|
+
this.setSubscriber(u2, { cb: t, once: true });
|
|
406
|
+
}
|
|
407
|
+
emit(u2, ...t) {
|
|
408
|
+
const F2 = this._subscribers.get(u2) ?? [], s = [];
|
|
409
|
+
for (const i of F2) i.cb(...t), i.once && s.push(() => F2.splice(F2.indexOf(i), 1));
|
|
410
|
+
for (const i of s) i();
|
|
411
|
+
}
|
|
412
|
+
prompt() {
|
|
413
|
+
return new Promise((u2, t) => {
|
|
414
|
+
if (this._abortSignal) {
|
|
415
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), u2(S);
|
|
416
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
417
|
+
this.state = "cancel", this.close();
|
|
418
|
+
}, { once: true });
|
|
419
|
+
}
|
|
420
|
+
const F2 = new X();
|
|
421
|
+
F2._write = (s, i, D2) => {
|
|
422
|
+
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D2();
|
|
423
|
+
}, this.input.pipe(F2), this.rl = O.createInterface({ input: this.input, output: F2, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), O.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), m(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
424
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u2(this.value);
|
|
425
|
+
}), this.once("cancel", () => {
|
|
426
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u2(S);
|
|
427
|
+
});
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
onKeypress(u2, t) {
|
|
431
|
+
if (this.state === "error" && (this.state = "active"), t?.name && (!this._track && B.aliases.has(t.name) && this.emit("cursor", B.aliases.get(t.name)), B.actions.has(t.name) && this.emit("cursor", t.name)), u2 && (u2.toLowerCase() === "y" || u2.toLowerCase() === "n") && this.emit("confirm", u2.toLowerCase() === "y"), u2 === " " && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u2 && this.emit("key", u2.toLowerCase()), t?.name === "return") {
|
|
432
|
+
if (this.opts.validate) {
|
|
433
|
+
const F2 = this.opts.validate(this.value);
|
|
434
|
+
F2 && (this.error = F2 instanceof Error ? F2.message : F2, this.state = "error", this.rl?.write(this.value));
|
|
435
|
+
}
|
|
436
|
+
this.state !== "error" && (this.state = "submit");
|
|
437
|
+
}
|
|
438
|
+
$([u2, t?.name, t?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
439
|
+
}
|
|
440
|
+
close() {
|
|
441
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
442
|
+
`), m(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
443
|
+
}
|
|
444
|
+
restoreCursor() {
|
|
445
|
+
const u2 = Y(this._prevFrame, process.stdout.columns, { hard: true }).split(`
|
|
446
|
+
`).length - 1;
|
|
447
|
+
this.output.write(import_sisteransi.cursor.move(-999, u2 * -1));
|
|
448
|
+
}
|
|
449
|
+
render() {
|
|
450
|
+
const u2 = Y(this._render(this) ?? "", process.stdout.columns, { hard: true });
|
|
451
|
+
if (u2 !== this._prevFrame) {
|
|
452
|
+
if (this.state === "initial") this.output.write(import_sisteransi.cursor.hide);
|
|
453
|
+
else {
|
|
454
|
+
const t = BD(this._prevFrame, u2);
|
|
455
|
+
if (this.restoreCursor(), t && t?.length === 1) {
|
|
456
|
+
const F2 = t[0];
|
|
457
|
+
this.output.write(import_sisteransi.cursor.move(0, F2)), this.output.write(import_sisteransi.erase.lines(1));
|
|
458
|
+
const s = u2.split(`
|
|
459
|
+
`);
|
|
460
|
+
this.output.write(s[F2]), this._prevFrame = u2, this.output.write(import_sisteransi.cursor.move(0, s.length - F2 - 1));
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
if (t && t?.length > 1) {
|
|
464
|
+
const F2 = t[0];
|
|
465
|
+
this.output.write(import_sisteransi.cursor.move(0, F2)), this.output.write(import_sisteransi.erase.down());
|
|
466
|
+
const s = u2.split(`
|
|
467
|
+
`).slice(F2);
|
|
468
|
+
this.output.write(s.join(`
|
|
469
|
+
`)), this._prevFrame = u2;
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
this.output.write(import_sisteransi.erase.down());
|
|
473
|
+
}
|
|
474
|
+
this.output.write(u2), this.state === "initial" && (this.state = "active"), this._prevFrame = u2;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
};
|
|
259
478
|
A = /* @__PURE__ */ new WeakMap();
|
|
479
|
+
OD = Object.defineProperty;
|
|
480
|
+
PD = (e2, u2, t) => u2 in e2 ? OD(e2, u2, { enumerable: true, configurable: true, writable: true, value: t }) : e2[u2] = t;
|
|
481
|
+
J = (e2, u2, t) => (PD(e2, typeof u2 != "symbol" ? u2 + "" : u2, t), t);
|
|
482
|
+
LD = class extends x {
|
|
483
|
+
constructor(u2) {
|
|
484
|
+
super(u2, false), J(this, "options"), J(this, "cursor", 0), this.options = u2.options, this.cursor = this.options.findIndex(({ value: t }) => t === u2.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (t) => {
|
|
485
|
+
switch (t) {
|
|
486
|
+
case "left":
|
|
487
|
+
case "up":
|
|
488
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
489
|
+
break;
|
|
490
|
+
case "down":
|
|
491
|
+
case "right":
|
|
492
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
493
|
+
break;
|
|
494
|
+
}
|
|
495
|
+
this.changeValue();
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
get _value() {
|
|
499
|
+
return this.options[this.cursor];
|
|
500
|
+
}
|
|
501
|
+
changeValue() {
|
|
502
|
+
this.value = this._value.value;
|
|
503
|
+
}
|
|
504
|
+
};
|
|
260
505
|
}
|
|
261
506
|
});
|
|
262
507
|
|
|
263
508
|
// node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs
|
|
264
|
-
import { stripVTControlCharacters as
|
|
265
|
-
import
|
|
509
|
+
import { stripVTControlCharacters as S2 } from "node:util";
|
|
510
|
+
import y2 from "node:process";
|
|
266
511
|
function ce() {
|
|
267
|
-
return
|
|
512
|
+
return y2.platform !== "win32" ? y2.env.TERM !== "linux" : !!y2.env.CI || !!y2.env.WT_SESSION || !!y2.env.TERMINUS_SUBLIME || y2.env.ConEmuTask === "{cmd::Cmder}" || y2.env.TERM_PROGRAM === "Terminus-Sublime" || y2.env.TERM_PROGRAM === "vscode" || y2.env.TERM === "xterm-256color" || y2.env.TERM === "alacritty" || y2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
268
513
|
}
|
|
269
|
-
var import_picocolors, import_sisteransi2,
|
|
514
|
+
var import_picocolors, import_sisteransi2, V2, u, le, L2, W2, C, ue, o, d2, k2, P2, A2, T, F, $e, _2, me, de, pe, q, D, U, K2, b2, G2, ve, Me, Ie, Se, M2, J2;
|
|
270
515
|
var init_dist2 = __esm({
|
|
271
516
|
"node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs"() {
|
|
272
517
|
init_utils();
|
|
@@ -274,17 +519,17 @@ var init_dist2 = __esm({
|
|
|
274
519
|
init_dist();
|
|
275
520
|
import_picocolors = __toESM(require_picocolors(), 1);
|
|
276
521
|
import_sisteransi2 = __toESM(require_src(), 1);
|
|
277
|
-
|
|
278
|
-
u = (t, n) =>
|
|
522
|
+
V2 = ce();
|
|
523
|
+
u = (t, n) => V2 ? t : n;
|
|
279
524
|
le = u("\u25C6", "*");
|
|
280
525
|
L2 = u("\u25A0", "x");
|
|
281
526
|
W2 = u("\u25B2", "x");
|
|
282
527
|
C = u("\u25C7", "o");
|
|
283
528
|
ue = u("\u250C", "T");
|
|
284
529
|
o = u("\u2502", "|");
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
530
|
+
d2 = u("\u2514", "\u2014");
|
|
531
|
+
k2 = u("\u25CF", ">");
|
|
532
|
+
P2 = u("\u25CB", " ");
|
|
288
533
|
A2 = u("\u25FB", "[\u2022]");
|
|
289
534
|
T = u("\u25FC", "[+]");
|
|
290
535
|
F = u("\u25FB", "[ ]");
|
|
@@ -296,7 +541,87 @@ var init_dist2 = __esm({
|
|
|
296
541
|
q = u("\u25CF", "\u2022");
|
|
297
542
|
D = u("\u25C6", "*");
|
|
298
543
|
U = u("\u25B2", "!");
|
|
299
|
-
|
|
544
|
+
K2 = u("\u25A0", "x");
|
|
545
|
+
b2 = (t) => {
|
|
546
|
+
switch (t) {
|
|
547
|
+
case "initial":
|
|
548
|
+
case "active":
|
|
549
|
+
return import_picocolors.default.cyan(le);
|
|
550
|
+
case "cancel":
|
|
551
|
+
return import_picocolors.default.red(L2);
|
|
552
|
+
case "error":
|
|
553
|
+
return import_picocolors.default.yellow(W2);
|
|
554
|
+
case "submit":
|
|
555
|
+
return import_picocolors.default.green(C);
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
G2 = (t) => {
|
|
559
|
+
const { cursor: n, options: r2, style: i } = t, s = t.maxItems ?? Number.POSITIVE_INFINITY, c = Math.max(process.stdout.rows - 4, 0), a = Math.min(c, Math.max(s, 5));
|
|
560
|
+
let l2 = 0;
|
|
561
|
+
n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3, r2.length - a), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
|
|
562
|
+
const $2 = a < r2.length && l2 > 0, g = a < r2.length && l2 + a < r2.length;
|
|
563
|
+
return r2.slice(l2, l2 + a).map((p2, v, f) => {
|
|
564
|
+
const j2 = v === 0 && $2, E = v === f.length - 1 && g;
|
|
565
|
+
return j2 || E ? import_picocolors.default.dim("...") : i(p2, v + l2 === n);
|
|
566
|
+
});
|
|
567
|
+
};
|
|
568
|
+
ve = (t) => {
|
|
569
|
+
const n = (r2, i) => {
|
|
570
|
+
const s = r2.label ?? String(r2.value);
|
|
571
|
+
switch (i) {
|
|
572
|
+
case "selected":
|
|
573
|
+
return `${import_picocolors.default.dim(s)}`;
|
|
574
|
+
case "active":
|
|
575
|
+
return `${import_picocolors.default.green(k2)} ${s} ${r2.hint ? import_picocolors.default.dim(`(${r2.hint})`) : ""}`;
|
|
576
|
+
case "cancelled":
|
|
577
|
+
return `${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}`;
|
|
578
|
+
default:
|
|
579
|
+
return `${import_picocolors.default.dim(P2)} ${import_picocolors.default.dim(s)}`;
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
return new LD({ options: t.options, initialValue: t.initialValue, render() {
|
|
583
|
+
const r2 = `${import_picocolors.default.gray(o)}
|
|
584
|
+
${b2(this.state)} ${t.message}
|
|
585
|
+
`;
|
|
586
|
+
switch (this.state) {
|
|
587
|
+
case "submit":
|
|
588
|
+
return `${r2}${import_picocolors.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
|
|
589
|
+
case "cancel":
|
|
590
|
+
return `${r2}${import_picocolors.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
|
|
591
|
+
${import_picocolors.default.gray(o)}`;
|
|
592
|
+
default:
|
|
593
|
+
return `${r2}${import_picocolors.default.cyan(o)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, s) => n(i, s ? "active" : "inactive") }).join(`
|
|
594
|
+
${import_picocolors.default.cyan(o)} `)}
|
|
595
|
+
${import_picocolors.default.cyan(d2)}
|
|
596
|
+
`;
|
|
597
|
+
}
|
|
598
|
+
} }).prompt();
|
|
599
|
+
};
|
|
600
|
+
Me = (t = "", n = "") => {
|
|
601
|
+
const r2 = `
|
|
602
|
+
${t}
|
|
603
|
+
`.split(`
|
|
604
|
+
`), i = S2(n).length, s = Math.max(r2.reduce((a, l2) => {
|
|
605
|
+
const $2 = S2(l2);
|
|
606
|
+
return $2.length > a ? $2.length : a;
|
|
607
|
+
}, 0), i) + 2, c = r2.map((a) => `${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(a)}${" ".repeat(s - S2(a).length)}${import_picocolors.default.gray(o)}`).join(`
|
|
608
|
+
`);
|
|
609
|
+
process.stdout.write(`${import_picocolors.default.gray(o)}
|
|
610
|
+
${import_picocolors.default.green(C)} ${import_picocolors.default.reset(n)} ${import_picocolors.default.gray(_2.repeat(Math.max(s - i - 1, 1)) + me)}
|
|
611
|
+
${c}
|
|
612
|
+
${import_picocolors.default.gray(de + _2.repeat(s + 2) + pe)}
|
|
613
|
+
`);
|
|
614
|
+
};
|
|
615
|
+
Ie = (t = "") => {
|
|
616
|
+
process.stdout.write(`${import_picocolors.default.gray(ue)} ${t}
|
|
617
|
+
`);
|
|
618
|
+
};
|
|
619
|
+
Se = (t = "") => {
|
|
620
|
+
process.stdout.write(`${import_picocolors.default.gray(o)}
|
|
621
|
+
${import_picocolors.default.gray(d2)} ${t}
|
|
622
|
+
|
|
623
|
+
`);
|
|
624
|
+
};
|
|
300
625
|
M2 = { message: (t = "", { symbol: n = import_picocolors.default.gray(o) } = {}) => {
|
|
301
626
|
const r2 = [`${import_picocolors.default.gray(o)}`];
|
|
302
627
|
if (t) {
|
|
@@ -318,9 +643,9 @@ var init_dist2 = __esm({
|
|
|
318
643
|
}, warning: (t) => {
|
|
319
644
|
M2.warn(t);
|
|
320
645
|
}, error: (t) => {
|
|
321
|
-
M2.message(t, { symbol: import_picocolors.default.red(
|
|
646
|
+
M2.message(t, { symbol: import_picocolors.default.red(K2) });
|
|
322
647
|
} };
|
|
323
|
-
|
|
648
|
+
J2 = `${import_picocolors.default.gray(o)} `;
|
|
324
649
|
}
|
|
325
650
|
});
|
|
326
651
|
|
|
@@ -934,8 +1259,8 @@ var require_to_regex_range = __commonJS({
|
|
|
934
1259
|
return toRegexRange.cache[cacheKey].result;
|
|
935
1260
|
}
|
|
936
1261
|
let a = Math.min(min, max);
|
|
937
|
-
let
|
|
938
|
-
if (Math.abs(a -
|
|
1262
|
+
let b3 = Math.max(min, max);
|
|
1263
|
+
if (Math.abs(a - b3) === 1) {
|
|
939
1264
|
let result = min + "|" + max;
|
|
940
1265
|
if (opts.capture) {
|
|
941
1266
|
return `(${result})`;
|
|
@@ -946,7 +1271,7 @@ var require_to_regex_range = __commonJS({
|
|
|
946
1271
|
return `(?:${result})`;
|
|
947
1272
|
}
|
|
948
1273
|
let isPadded = hasPadding(min) || hasPadding(max);
|
|
949
|
-
let state = { min, max, a, b:
|
|
1274
|
+
let state = { min, max, a, b: b3 };
|
|
950
1275
|
let positives = [];
|
|
951
1276
|
let negatives = [];
|
|
952
1277
|
if (isPadded) {
|
|
@@ -954,12 +1279,12 @@ var require_to_regex_range = __commonJS({
|
|
|
954
1279
|
state.maxLen = String(state.max).length;
|
|
955
1280
|
}
|
|
956
1281
|
if (a < 0) {
|
|
957
|
-
let newMin =
|
|
1282
|
+
let newMin = b3 < 0 ? Math.abs(b3) : 1;
|
|
958
1283
|
negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
|
|
959
1284
|
a = state.a = 0;
|
|
960
1285
|
}
|
|
961
|
-
if (
|
|
962
|
-
positives = splitToPatterns(a,
|
|
1286
|
+
if (b3 >= 0) {
|
|
1287
|
+
positives = splitToPatterns(a, b3, state, opts);
|
|
963
1288
|
}
|
|
964
1289
|
state.negatives = negatives;
|
|
965
1290
|
state.positives = positives;
|
|
@@ -1063,13 +1388,13 @@ var require_to_regex_range = __commonJS({
|
|
|
1063
1388
|
}
|
|
1064
1389
|
return result;
|
|
1065
1390
|
}
|
|
1066
|
-
function zip(a,
|
|
1391
|
+
function zip(a, b3) {
|
|
1067
1392
|
let arr = [];
|
|
1068
|
-
for (let i = 0; i < a.length; i++) arr.push([a[i],
|
|
1393
|
+
for (let i = 0; i < a.length; i++) arr.push([a[i], b3[i]]);
|
|
1069
1394
|
return arr;
|
|
1070
1395
|
}
|
|
1071
|
-
function compare(a,
|
|
1072
|
-
return a >
|
|
1396
|
+
function compare(a, b3) {
|
|
1397
|
+
return a > b3 ? 1 : b3 > a ? -1 : 0;
|
|
1073
1398
|
}
|
|
1074
1399
|
function contains(arr, key, val) {
|
|
1075
1400
|
return arr.some((ele) => ele[key] === val);
|
|
@@ -1087,8 +1412,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1087
1412
|
}
|
|
1088
1413
|
return "";
|
|
1089
1414
|
}
|
|
1090
|
-
function toCharacterClass(a,
|
|
1091
|
-
return `[${a}${
|
|
1415
|
+
function toCharacterClass(a, b3, options) {
|
|
1416
|
+
return `[${a}${b3 - a === 1 ? "" : "-"}${b3}]`;
|
|
1092
1417
|
}
|
|
1093
1418
|
function hasPadding(str) {
|
|
1094
1419
|
return /^-?(0+)\d/.test(str);
|
|
@@ -1167,8 +1492,8 @@ var require_fill_range = __commonJS({
|
|
|
1167
1492
|
return negative ? "-" + input : input;
|
|
1168
1493
|
};
|
|
1169
1494
|
var toSequence = (parts, options, maxLen) => {
|
|
1170
|
-
parts.negatives.sort((a,
|
|
1171
|
-
parts.positives.sort((a,
|
|
1495
|
+
parts.negatives.sort((a, b3) => a < b3 ? -1 : a > b3 ? 1 : 0);
|
|
1496
|
+
parts.positives.sort((a, b3) => a < b3 ? -1 : a > b3 ? 1 : 0);
|
|
1172
1497
|
let prefix = options.capture ? "" : "?:";
|
|
1173
1498
|
let positives = "";
|
|
1174
1499
|
let negatives = "";
|
|
@@ -1189,13 +1514,13 @@ var require_fill_range = __commonJS({
|
|
|
1189
1514
|
}
|
|
1190
1515
|
return result;
|
|
1191
1516
|
};
|
|
1192
|
-
var toRange = (a,
|
|
1517
|
+
var toRange = (a, b3, isNumbers, options) => {
|
|
1193
1518
|
if (isNumbers) {
|
|
1194
|
-
return toRegexRange(a,
|
|
1519
|
+
return toRegexRange(a, b3, { wrap: false, ...options });
|
|
1195
1520
|
}
|
|
1196
1521
|
let start = String.fromCharCode(a);
|
|
1197
|
-
if (a ===
|
|
1198
|
-
let stop = String.fromCharCode(
|
|
1522
|
+
if (a === b3) return start;
|
|
1523
|
+
let stop = String.fromCharCode(b3);
|
|
1199
1524
|
return `[${start}-${stop}]`;
|
|
1200
1525
|
};
|
|
1201
1526
|
var toRegex = (start, end, options) => {
|
|
@@ -1221,14 +1546,14 @@ var require_fill_range = __commonJS({
|
|
|
1221
1546
|
};
|
|
1222
1547
|
var fillNumbers = (start, end, step = 1, options = {}) => {
|
|
1223
1548
|
let a = Number(start);
|
|
1224
|
-
let
|
|
1225
|
-
if (!Number.isInteger(a) || !Number.isInteger(
|
|
1549
|
+
let b3 = Number(end);
|
|
1550
|
+
if (!Number.isInteger(a) || !Number.isInteger(b3)) {
|
|
1226
1551
|
if (options.strictRanges === true) throw rangeError([start, end]);
|
|
1227
1552
|
return [];
|
|
1228
1553
|
}
|
|
1229
1554
|
if (a === 0) a = 0;
|
|
1230
|
-
if (
|
|
1231
|
-
let descending = a >
|
|
1555
|
+
if (b3 === 0) b3 = 0;
|
|
1556
|
+
let descending = a > b3;
|
|
1232
1557
|
let startString = String(start);
|
|
1233
1558
|
let endString = String(end);
|
|
1234
1559
|
let stepString = String(step);
|
|
@@ -1244,7 +1569,7 @@ var require_fill_range = __commonJS({
|
|
|
1244
1569
|
let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
|
|
1245
1570
|
let range = [];
|
|
1246
1571
|
let index = 0;
|
|
1247
|
-
while (descending ? a >=
|
|
1572
|
+
while (descending ? a >= b3 : a <= b3) {
|
|
1248
1573
|
if (options.toRegex === true && step > 1) {
|
|
1249
1574
|
push(a);
|
|
1250
1575
|
} else {
|
|
@@ -1264,16 +1589,16 @@ var require_fill_range = __commonJS({
|
|
|
1264
1589
|
}
|
|
1265
1590
|
let format = options.transform || ((val) => String.fromCharCode(val));
|
|
1266
1591
|
let a = `${start}`.charCodeAt(0);
|
|
1267
|
-
let
|
|
1268
|
-
let descending = a >
|
|
1269
|
-
let min = Math.min(a,
|
|
1270
|
-
let max = Math.max(a,
|
|
1592
|
+
let b3 = `${end}`.charCodeAt(0);
|
|
1593
|
+
let descending = a > b3;
|
|
1594
|
+
let min = Math.min(a, b3);
|
|
1595
|
+
let max = Math.max(a, b3);
|
|
1271
1596
|
if (options.toRegex && step === 1) {
|
|
1272
1597
|
return toRange(min, max, false, options);
|
|
1273
1598
|
}
|
|
1274
1599
|
let range = [];
|
|
1275
1600
|
let index = 0;
|
|
1276
|
-
while (descending ? a >=
|
|
1601
|
+
while (descending ? a >= b3 : a <= b3) {
|
|
1277
1602
|
range.push(format(a, index));
|
|
1278
1603
|
a = descending ? a - step : a + step;
|
|
1279
1604
|
index++;
|
|
@@ -1398,11 +1723,11 @@ var require_expand = __commonJS({
|
|
|
1398
1723
|
const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
|
1399
1724
|
const walk = (node, parent = {}) => {
|
|
1400
1725
|
node.queue = [];
|
|
1401
|
-
let
|
|
1726
|
+
let p2 = parent;
|
|
1402
1727
|
let q2 = parent.queue;
|
|
1403
|
-
while (
|
|
1404
|
-
|
|
1405
|
-
q2 =
|
|
1728
|
+
while (p2.type !== "brace" && p2.type !== "root" && p2.parent) {
|
|
1729
|
+
p2 = p2.parent;
|
|
1730
|
+
q2 = p2.queue;
|
|
1406
1731
|
}
|
|
1407
1732
|
if (node.invalid || node.dollar) {
|
|
1408
1733
|
q2.push(append(q2.pop(), stringify2(node, options)));
|
|
@@ -2646,10 +2971,10 @@ var require_parse2 = __commonJS({
|
|
|
2646
2971
|
};
|
|
2647
2972
|
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
2648
2973
|
let backslashes = false;
|
|
2649
|
-
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (
|
|
2974
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m2, esc, chars, first, rest, index) => {
|
|
2650
2975
|
if (first === "\\") {
|
|
2651
2976
|
backslashes = true;
|
|
2652
|
-
return
|
|
2977
|
+
return m2;
|
|
2653
2978
|
}
|
|
2654
2979
|
if (first === "?") {
|
|
2655
2980
|
if (esc) {
|
|
@@ -2669,14 +2994,14 @@ var require_parse2 = __commonJS({
|
|
|
2669
2994
|
}
|
|
2670
2995
|
return star;
|
|
2671
2996
|
}
|
|
2672
|
-
return esc ?
|
|
2997
|
+
return esc ? m2 : `\\${m2}`;
|
|
2673
2998
|
});
|
|
2674
2999
|
if (backslashes === true) {
|
|
2675
3000
|
if (opts.unescape === true) {
|
|
2676
3001
|
output = output.replace(/\\/g, "");
|
|
2677
3002
|
} else {
|
|
2678
|
-
output = output.replace(/\\+/g, (
|
|
2679
|
-
return
|
|
3003
|
+
output = output.replace(/\\+/g, (m2) => {
|
|
3004
|
+
return m2.length % 2 === 0 ? "\\\\" : m2 ? "\\" : "";
|
|
2680
3005
|
});
|
|
2681
3006
|
}
|
|
2682
3007
|
}
|
|
@@ -3323,7 +3648,7 @@ var require_picomatch = __commonJS({
|
|
|
3323
3648
|
};
|
|
3324
3649
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
3325
3650
|
picomatch.parse = (pattern, options) => {
|
|
3326
|
-
if (Array.isArray(pattern)) return pattern.map((
|
|
3651
|
+
if (Array.isArray(pattern)) return pattern.map((p2) => picomatch.parse(p2, options));
|
|
3327
3652
|
return parse2(pattern, { ...options, fastpaths: false });
|
|
3328
3653
|
};
|
|
3329
3654
|
picomatch.scan = (input, options) => scan(input, options);
|
|
@@ -3430,7 +3755,7 @@ var require_micromatch = __commonJS({
|
|
|
3430
3755
|
throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
|
3431
3756
|
}
|
|
3432
3757
|
if (options.nonull === true || options.nullglob === true) {
|
|
3433
|
-
return options.unescape ? patterns.map((
|
|
3758
|
+
return options.unescape ? patterns.map((p2) => p2.replace(/\\/g, "")) : patterns;
|
|
3434
3759
|
}
|
|
3435
3760
|
}
|
|
3436
3761
|
return matches;
|
|
@@ -3460,7 +3785,7 @@ var require_micromatch = __commonJS({
|
|
|
3460
3785
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
3461
3786
|
}
|
|
3462
3787
|
if (Array.isArray(pattern)) {
|
|
3463
|
-
return pattern.some((
|
|
3788
|
+
return pattern.some((p2) => micromatch.contains(str, p2, options));
|
|
3464
3789
|
}
|
|
3465
3790
|
if (typeof pattern === "string") {
|
|
3466
3791
|
if (isEmptyString(str) || isEmptyString(pattern)) {
|
|
@@ -3505,7 +3830,7 @@ var require_micromatch = __commonJS({
|
|
|
3505
3830
|
if (typeof str !== "string") {
|
|
3506
3831
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
3507
3832
|
}
|
|
3508
|
-
return [].concat(patterns).every((
|
|
3833
|
+
return [].concat(patterns).every((p2) => picomatch(p2, options)(str));
|
|
3509
3834
|
};
|
|
3510
3835
|
micromatch.capture = (glob, input, options) => {
|
|
3511
3836
|
let posix = utils.isWindows(options);
|
|
@@ -3656,7 +3981,7 @@ var require_pattern = __commonJS({
|
|
|
3656
3981
|
exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
|
|
3657
3982
|
function expandBraceExpansion(pattern) {
|
|
3658
3983
|
const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });
|
|
3659
|
-
patterns.sort((a,
|
|
3984
|
+
patterns.sort((a, b3) => a.length - b3.length);
|
|
3660
3985
|
return patterns.filter((pattern2) => pattern2 !== "");
|
|
3661
3986
|
}
|
|
3662
3987
|
exports.expandBraceExpansion = expandBraceExpansion;
|
|
@@ -4129,11 +4454,11 @@ var require_out = __commonJS({
|
|
|
4129
4454
|
async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
|
|
4130
4455
|
}
|
|
4131
4456
|
exports.stat = stat;
|
|
4132
|
-
function
|
|
4457
|
+
function statSync3(path, optionsOrSettings) {
|
|
4133
4458
|
const settings = getSettings(optionsOrSettings);
|
|
4134
4459
|
return sync.read(path, settings);
|
|
4135
4460
|
}
|
|
4136
|
-
exports.statSync =
|
|
4461
|
+
exports.statSync = statSync3;
|
|
4137
4462
|
function getSettings(settingsOrOptions = {}) {
|
|
4138
4463
|
if (settingsOrOptions instanceof settings_1.default) {
|
|
4139
4464
|
return settingsOrOptions;
|
|
@@ -4271,11 +4596,11 @@ var require_common = __commonJS({
|
|
|
4271
4596
|
init_utils();
|
|
4272
4597
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4273
4598
|
exports.joinPathSegments = void 0;
|
|
4274
|
-
function joinPathSegments(a,
|
|
4599
|
+
function joinPathSegments(a, b3, separator) {
|
|
4275
4600
|
if (a.endsWith(separator)) {
|
|
4276
|
-
return a +
|
|
4601
|
+
return a + b3;
|
|
4277
4602
|
}
|
|
4278
|
-
return a + separator +
|
|
4603
|
+
return a + separator + b3;
|
|
4279
4604
|
}
|
|
4280
4605
|
exports.joinPathSegments = joinPathSegments;
|
|
4281
4606
|
}
|
|
@@ -4811,7 +5136,7 @@ var require_queue = __commonJS({
|
|
|
4811
5136
|
queue.drained = drained;
|
|
4812
5137
|
return queue;
|
|
4813
5138
|
function push(value) {
|
|
4814
|
-
var
|
|
5139
|
+
var p2 = new Promise(function(resolve4, reject) {
|
|
4815
5140
|
pushCb(value, function(err, result) {
|
|
4816
5141
|
if (err) {
|
|
4817
5142
|
reject(err);
|
|
@@ -4820,11 +5145,11 @@ var require_queue = __commonJS({
|
|
|
4820
5145
|
resolve4(result);
|
|
4821
5146
|
});
|
|
4822
5147
|
});
|
|
4823
|
-
|
|
4824
|
-
return
|
|
5148
|
+
p2.catch(noop);
|
|
5149
|
+
return p2;
|
|
4825
5150
|
}
|
|
4826
5151
|
function unshift(value) {
|
|
4827
|
-
var
|
|
5152
|
+
var p2 = new Promise(function(resolve4, reject) {
|
|
4828
5153
|
unshiftCb(value, function(err, result) {
|
|
4829
5154
|
if (err) {
|
|
4830
5155
|
reject(err);
|
|
@@ -4833,11 +5158,11 @@ var require_queue = __commonJS({
|
|
|
4833
5158
|
resolve4(result);
|
|
4834
5159
|
});
|
|
4835
5160
|
});
|
|
4836
|
-
|
|
4837
|
-
return
|
|
5161
|
+
p2.catch(noop);
|
|
5162
|
+
return p2;
|
|
4838
5163
|
}
|
|
4839
5164
|
function drained() {
|
|
4840
|
-
var
|
|
5165
|
+
var p2 = new Promise(function(resolve4) {
|
|
4841
5166
|
process.nextTick(function() {
|
|
4842
5167
|
if (queue.idle()) {
|
|
4843
5168
|
resolve4();
|
|
@@ -4851,7 +5176,7 @@ var require_queue = __commonJS({
|
|
|
4851
5176
|
}
|
|
4852
5177
|
});
|
|
4853
5178
|
});
|
|
4854
|
-
return
|
|
5179
|
+
return p2;
|
|
4855
5180
|
}
|
|
4856
5181
|
}
|
|
4857
5182
|
module.exports = fastqueue;
|
|
@@ -4881,14 +5206,14 @@ var require_common2 = __commonJS({
|
|
|
4881
5206
|
return filepath.split(/[/\\]/).join(separator);
|
|
4882
5207
|
}
|
|
4883
5208
|
exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
|
|
4884
|
-
function joinPathSegments(a,
|
|
5209
|
+
function joinPathSegments(a, b3, separator) {
|
|
4885
5210
|
if (a === "") {
|
|
4886
|
-
return
|
|
5211
|
+
return b3;
|
|
4887
5212
|
}
|
|
4888
5213
|
if (a.endsWith(separator)) {
|
|
4889
|
-
return a +
|
|
5214
|
+
return a + b3;
|
|
4890
5215
|
}
|
|
4891
|
-
return a + separator +
|
|
5216
|
+
return a + separator + b3;
|
|
4892
5217
|
}
|
|
4893
5218
|
exports.joinPathSegments = joinPathSegments;
|
|
4894
5219
|
}
|
|
@@ -7368,7 +7693,10 @@ import {
|
|
|
7368
7693
|
isAbsolute as pathIsAbsolute
|
|
7369
7694
|
} from "node:path";
|
|
7370
7695
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
7371
|
-
|
|
7696
|
+
function readdirSync2(dirPath, options) {
|
|
7697
|
+
return pathResolverInstance.readdirSync(dirPath, options);
|
|
7698
|
+
}
|
|
7699
|
+
var pathResolverInstance, normalizePath, pathExists, readSync, statSync2, joinPath;
|
|
7372
7700
|
var init_pathResolver = __esm({
|
|
7373
7701
|
"packages/tooling/src/utils/pathResolver.ts"() {
|
|
7374
7702
|
"use strict";
|
|
@@ -7379,12 +7707,42 @@ var init_pathResolver = __esm({
|
|
|
7379
7707
|
return pathResolverInstance.normalizePath(join2(...pathSegments));
|
|
7380
7708
|
};
|
|
7381
7709
|
pathExists = (filePath, silent = false) => pathResolverInstance.pathExists(filePath, silent);
|
|
7710
|
+
readSync = (filePath, options) => pathResolverInstance.readSync(filePath, options);
|
|
7711
|
+
statSync2 = (filePath) => pathResolverInstance.statSync(filePath);
|
|
7382
7712
|
joinPath = (...pathSegments) => {
|
|
7383
7713
|
return normalizePath(...pathSegments);
|
|
7384
7714
|
};
|
|
7385
7715
|
}
|
|
7386
7716
|
});
|
|
7387
7717
|
|
|
7718
|
+
// packages/tooling/src/utils/typed-file-operations.ts
|
|
7719
|
+
function readPackageJson(filePath) {
|
|
7720
|
+
if (!pathExists(filePath)) {
|
|
7721
|
+
throw new DoNotDevError(
|
|
7722
|
+
`package.json not found: ${filePath}`,
|
|
7723
|
+
DO_NOT_DEV_ERROR_CODES.FILE_NOT_FOUND,
|
|
7724
|
+
{ context: { filePath } }
|
|
7725
|
+
);
|
|
7726
|
+
}
|
|
7727
|
+
const content = readSync(filePath, { format: "json" });
|
|
7728
|
+
if (!content || typeof content !== "object" || !("name" in content)) {
|
|
7729
|
+
throw new DoNotDevError(
|
|
7730
|
+
`Invalid package.json: ${filePath}`,
|
|
7731
|
+
DO_NOT_DEV_ERROR_CODES.CONFIG_INVALID,
|
|
7732
|
+
{ context: { filePath } }
|
|
7733
|
+
);
|
|
7734
|
+
}
|
|
7735
|
+
return content;
|
|
7736
|
+
}
|
|
7737
|
+
var init_typed_file_operations = __esm({
|
|
7738
|
+
"packages/tooling/src/utils/typed-file-operations.ts"() {
|
|
7739
|
+
"use strict";
|
|
7740
|
+
init_utils();
|
|
7741
|
+
init_pathResolver();
|
|
7742
|
+
init_errors();
|
|
7743
|
+
}
|
|
7744
|
+
});
|
|
7745
|
+
|
|
7388
7746
|
// packages/tooling/src/bundler/utils.ts
|
|
7389
7747
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
7390
7748
|
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
@@ -7412,77 +7770,750 @@ var init_utils = __esm({
|
|
|
7412
7770
|
}
|
|
7413
7771
|
});
|
|
7414
7772
|
|
|
7415
|
-
// packages/
|
|
7416
|
-
|
|
7773
|
+
// packages/tooling/src/utils/app-detection.ts
|
|
7774
|
+
function detectApps(projectRoot) {
|
|
7775
|
+
const apps = [];
|
|
7776
|
+
const appsDir = joinPath(projectRoot, "apps");
|
|
7777
|
+
const appsDirStat = statSync2(appsDir);
|
|
7778
|
+
if (pathExists(appsDir) && appsDirStat?.isDirectory()) {
|
|
7779
|
+
const appDirs = readdirSync2(appsDir, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name).sort();
|
|
7780
|
+
for (const appDir of appDirs) {
|
|
7781
|
+
const appPath = joinPath(appsDir, appDir);
|
|
7782
|
+
const packageJsonPath = joinPath(appPath, "package.json");
|
|
7783
|
+
if (pathExists(packageJsonPath)) {
|
|
7784
|
+
const appInfo = analyzeApp(appPath, appDir);
|
|
7785
|
+
if (appInfo) {
|
|
7786
|
+
apps.push(appInfo);
|
|
7787
|
+
}
|
|
7788
|
+
}
|
|
7789
|
+
}
|
|
7790
|
+
} else {
|
|
7791
|
+
const packageJsonPath = joinPath(projectRoot, "package.json");
|
|
7792
|
+
if (pathExists(packageJsonPath)) {
|
|
7793
|
+
try {
|
|
7794
|
+
const packageJson = readPackageJson(packageJsonPath);
|
|
7795
|
+
if (packageJson && (packageJson.dependencies?.vite || packageJson.devDependencies?.vite || packageJson.dependencies?.next || packageJson.devDependencies?.next)) {
|
|
7796
|
+
const pathParts = projectRoot.split(/[/\\]/);
|
|
7797
|
+
const appName = pathParts[pathParts.length - 1] || "app";
|
|
7798
|
+
const appInfo = analyzeApp(projectRoot, appName);
|
|
7799
|
+
if (appInfo) {
|
|
7800
|
+
apps.push(appInfo);
|
|
7801
|
+
}
|
|
7802
|
+
}
|
|
7803
|
+
} catch {
|
|
7804
|
+
}
|
|
7805
|
+
}
|
|
7806
|
+
}
|
|
7807
|
+
return apps;
|
|
7808
|
+
}
|
|
7809
|
+
function analyzeApp(appPath, appName) {
|
|
7810
|
+
const packageJsonPath = joinPath(appPath, "package.json");
|
|
7811
|
+
if (!pathExists(packageJsonPath)) {
|
|
7812
|
+
return null;
|
|
7813
|
+
}
|
|
7814
|
+
let packageJson = null;
|
|
7815
|
+
try {
|
|
7816
|
+
packageJson = readPackageJson(packageJsonPath);
|
|
7817
|
+
if (!packageJson.name) {
|
|
7818
|
+
return null;
|
|
7819
|
+
}
|
|
7820
|
+
} catch {
|
|
7821
|
+
return null;
|
|
7822
|
+
}
|
|
7823
|
+
let framework = "unknown";
|
|
7824
|
+
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) {
|
|
7825
|
+
framework = "nextjs";
|
|
7826
|
+
} 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) {
|
|
7827
|
+
framework = "vite";
|
|
7828
|
+
}
|
|
7829
|
+
const functionsPath = joinPath(appPath, "functions");
|
|
7830
|
+
const functionsStat = statSync2(functionsPath);
|
|
7831
|
+
const hasFunctions = pathExists(functionsPath) && (functionsStat?.isDirectory() ?? false);
|
|
7832
|
+
let platform;
|
|
7833
|
+
const firebaseJsonInFunctions = hasFunctions && pathExists(joinPath(functionsPath, "firebase.json"));
|
|
7834
|
+
const firebaseJsonInApp = pathExists(joinPath(appPath, "firebase.json"));
|
|
7835
|
+
if (firebaseJsonInFunctions || firebaseJsonInApp) {
|
|
7836
|
+
platform = "firebase";
|
|
7837
|
+
}
|
|
7838
|
+
if (!platform) {
|
|
7839
|
+
const supabaseConfigPath = joinPath(appPath, "supabase", "config.toml");
|
|
7840
|
+
const hasSupabaseDep = !!(packageJson.dependencies?.["@donotdev/supabase"] || packageJson.dependencies?.["@supabase/supabase-js"]);
|
|
7841
|
+
if (pathExists(supabaseConfigPath) || hasSupabaseDep) {
|
|
7842
|
+
platform = "supabase";
|
|
7843
|
+
}
|
|
7844
|
+
}
|
|
7845
|
+
if (!platform) {
|
|
7846
|
+
const vercelJsonPath = joinPath(appPath, "vercel.json");
|
|
7847
|
+
if (pathExists(vercelJsonPath)) {
|
|
7848
|
+
platform = "vercel";
|
|
7849
|
+
}
|
|
7850
|
+
}
|
|
7851
|
+
return {
|
|
7852
|
+
name: appName,
|
|
7853
|
+
packageName: packageJson.name || appName,
|
|
7854
|
+
path: appPath,
|
|
7855
|
+
packageJsonPath,
|
|
7856
|
+
framework,
|
|
7857
|
+
hasFunctions,
|
|
7858
|
+
functionsPath: hasFunctions ? functionsPath : void 0,
|
|
7859
|
+
platform
|
|
7860
|
+
};
|
|
7861
|
+
}
|
|
7862
|
+
var init_app_detection = __esm({
|
|
7863
|
+
"packages/tooling/src/utils/app-detection.ts"() {
|
|
7864
|
+
"use strict";
|
|
7865
|
+
init_utils();
|
|
7866
|
+
init_pathResolver();
|
|
7867
|
+
init_typed_file_operations();
|
|
7868
|
+
}
|
|
7869
|
+
});
|
|
7417
7870
|
|
|
7418
|
-
// packages/tooling/src/
|
|
7419
|
-
|
|
7871
|
+
// packages/tooling/src/utils/app-selector.ts
|
|
7872
|
+
async function selectApp(projectRoot, appName) {
|
|
7873
|
+
const apps = detectApps(projectRoot);
|
|
7874
|
+
if (apps.length === 0) {
|
|
7875
|
+
log.error("No apps found in this project.");
|
|
7876
|
+
log.info('Run "dndev init" to create a new project.');
|
|
7877
|
+
return null;
|
|
7878
|
+
}
|
|
7879
|
+
if (appName) {
|
|
7880
|
+
const app = apps.find((a) => a.name === appName);
|
|
7881
|
+
if (!app) {
|
|
7882
|
+
log.warn(`App "${appName}" not found.`);
|
|
7883
|
+
log.info("Available apps:");
|
|
7884
|
+
apps.forEach((a) => log.info(` - ${a.name}`));
|
|
7885
|
+
log.info("Please select from the list:");
|
|
7886
|
+
} else {
|
|
7887
|
+
return app;
|
|
7888
|
+
}
|
|
7889
|
+
}
|
|
7890
|
+
if (apps.length === 1) {
|
|
7891
|
+
return apps[0] || null;
|
|
7892
|
+
}
|
|
7893
|
+
const selected = await ve({
|
|
7894
|
+
message: "Select app:",
|
|
7895
|
+
options: apps.map((app) => ({
|
|
7896
|
+
value: app.name,
|
|
7897
|
+
label: `${app.name} (${app.framework === "nextjs" ? "Next.js" : "Vite"}${app.hasFunctions ? ` + ${app.platform || "functions"}` : ""})`
|
|
7898
|
+
}))
|
|
7899
|
+
});
|
|
7900
|
+
if (typeof selected !== "string") {
|
|
7901
|
+
return null;
|
|
7902
|
+
}
|
|
7903
|
+
return apps.find((a) => a.name === selected) || null;
|
|
7904
|
+
}
|
|
7905
|
+
var init_app_selector = __esm({
|
|
7906
|
+
"packages/tooling/src/utils/app-selector.ts"() {
|
|
7907
|
+
"use strict";
|
|
7908
|
+
init_utils();
|
|
7909
|
+
init_dist2();
|
|
7910
|
+
init_app_detection();
|
|
7911
|
+
init_cli_output();
|
|
7912
|
+
}
|
|
7913
|
+
});
|
|
7420
7914
|
|
|
7421
|
-
// packages/tooling/src/cli/
|
|
7422
|
-
|
|
7915
|
+
// packages/tooling/src/cli/doctor/check-env.ts
|
|
7916
|
+
var check_env_exports = {};
|
|
7917
|
+
__export(check_env_exports, {
|
|
7918
|
+
envCheck: () => envCheck,
|
|
7919
|
+
parseEnvFile: () => parseEnvFile
|
|
7920
|
+
});
|
|
7921
|
+
function parseEnvFile(filePath) {
|
|
7922
|
+
const map = /* @__PURE__ */ new Map();
|
|
7923
|
+
if (!pathExists(filePath)) return map;
|
|
7924
|
+
const content = readSync(filePath, { format: "text" });
|
|
7925
|
+
if (typeof content !== "string") return map;
|
|
7926
|
+
for (const line of content.split(/\r?\n/)) {
|
|
7927
|
+
const trimmed = line.trim();
|
|
7928
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
7929
|
+
const eqIdx = trimmed.indexOf("=");
|
|
7930
|
+
if (eqIdx < 0) continue;
|
|
7931
|
+
const key = trimmed.substring(0, eqIdx).trim();
|
|
7932
|
+
const value = trimmed.substring(eqIdx + 1).trim();
|
|
7933
|
+
if (key) map.set(key, value);
|
|
7934
|
+
}
|
|
7935
|
+
return map;
|
|
7936
|
+
}
|
|
7937
|
+
var envCheck;
|
|
7938
|
+
var init_check_env = __esm({
|
|
7939
|
+
"packages/tooling/src/cli/doctor/check-env.ts"() {
|
|
7940
|
+
"use strict";
|
|
7941
|
+
init_utils();
|
|
7942
|
+
init_pathResolver();
|
|
7943
|
+
envCheck = {
|
|
7944
|
+
id: "env",
|
|
7945
|
+
name: "Environment Files",
|
|
7946
|
+
isRelevant(_ctx) {
|
|
7947
|
+
return true;
|
|
7948
|
+
},
|
|
7949
|
+
async run(ctx) {
|
|
7950
|
+
const results = [];
|
|
7951
|
+
const envPath = joinPath(ctx.appDir, ".env");
|
|
7952
|
+
const examplePath = joinPath(ctx.appDir, ".env.example");
|
|
7953
|
+
if (!pathExists(envPath)) {
|
|
7954
|
+
results.push({ name: ".env file", status: "fail", message: "Not found \u2014 run dndev setup" });
|
|
7955
|
+
return results;
|
|
7956
|
+
}
|
|
7957
|
+
results.push({ name: ".env file", status: "pass", message: "Found" });
|
|
7958
|
+
if (pathExists(examplePath)) {
|
|
7959
|
+
const example = parseEnvFile(examplePath);
|
|
7960
|
+
const actual = parseEnvFile(envPath);
|
|
7961
|
+
const missing = [];
|
|
7962
|
+
const empty = [];
|
|
7963
|
+
for (const [key] of example) {
|
|
7964
|
+
if (!actual.has(key)) {
|
|
7965
|
+
missing.push(key);
|
|
7966
|
+
} else if (!actual.get(key)) {
|
|
7967
|
+
empty.push(key);
|
|
7968
|
+
}
|
|
7969
|
+
}
|
|
7970
|
+
if (missing.length > 0) {
|
|
7971
|
+
results.push({
|
|
7972
|
+
name: "Missing vars",
|
|
7973
|
+
status: "fail",
|
|
7974
|
+
message: `${missing.length} var(s) in .env.example not in .env: ${missing.join(", ")}`
|
|
7975
|
+
});
|
|
7976
|
+
}
|
|
7977
|
+
if (empty.length > 0) {
|
|
7978
|
+
results.push({
|
|
7979
|
+
name: "Empty vars",
|
|
7980
|
+
status: "warn",
|
|
7981
|
+
message: `${empty.length} var(s) are empty: ${empty.join(", ")}`
|
|
7982
|
+
});
|
|
7983
|
+
}
|
|
7984
|
+
if (missing.length === 0 && empty.length === 0) {
|
|
7985
|
+
results.push({
|
|
7986
|
+
name: ".env vs .env.example",
|
|
7987
|
+
status: "pass",
|
|
7988
|
+
message: `All ${example.size} expected vars present`
|
|
7989
|
+
});
|
|
7990
|
+
}
|
|
7991
|
+
}
|
|
7992
|
+
const gitignorePath = joinPath(ctx.projectRoot, ".gitignore");
|
|
7993
|
+
if (pathExists(gitignorePath)) {
|
|
7994
|
+
const content = readSync(gitignorePath, { format: "text" });
|
|
7995
|
+
if (typeof content === "string") {
|
|
7996
|
+
const hasEnvIgnore = content.split("\n").some((line) => {
|
|
7997
|
+
const trimmed = line.trim();
|
|
7998
|
+
if (!trimmed || trimmed.startsWith("#")) return false;
|
|
7999
|
+
return /^\.env(\*|\..*)?$/.test(trimmed);
|
|
8000
|
+
});
|
|
8001
|
+
if (hasEnvIgnore) {
|
|
8002
|
+
results.push({ name: ".gitignore", status: "pass", message: ".env is gitignored" });
|
|
8003
|
+
} else {
|
|
8004
|
+
results.push({ name: ".gitignore", status: "warn", message: ".env might not be gitignored \u2014 verify manually" });
|
|
8005
|
+
}
|
|
8006
|
+
}
|
|
8007
|
+
}
|
|
8008
|
+
return results;
|
|
8009
|
+
}
|
|
8010
|
+
};
|
|
8011
|
+
}
|
|
8012
|
+
});
|
|
7423
8013
|
|
|
7424
|
-
// packages/tooling/src/
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
8014
|
+
// packages/tooling/src/cli/doctor/check-firebase.ts
|
|
8015
|
+
var check_firebase_exports = {};
|
|
8016
|
+
__export(check_firebase_exports, {
|
|
8017
|
+
firebaseCheck: () => firebaseCheck
|
|
8018
|
+
});
|
|
7429
8019
|
import { spawnSync } from "node:child_process";
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
8020
|
+
var firebaseCheck;
|
|
8021
|
+
var init_check_firebase = __esm({
|
|
8022
|
+
"packages/tooling/src/cli/doctor/check-firebase.ts"() {
|
|
8023
|
+
"use strict";
|
|
8024
|
+
init_utils();
|
|
8025
|
+
init_pathResolver();
|
|
8026
|
+
firebaseCheck = {
|
|
8027
|
+
id: "firebase",
|
|
8028
|
+
name: "Firebase",
|
|
8029
|
+
isRelevant(ctx) {
|
|
8030
|
+
return pathExists(joinPath(ctx.appDir, "firebase.json")) || pathExists(joinPath(ctx.projectRoot, "firebase.json")) || pathExists(joinPath(ctx.projectRoot, ".firebaserc"));
|
|
8031
|
+
},
|
|
8032
|
+
async run(ctx) {
|
|
8033
|
+
const results = [];
|
|
8034
|
+
try {
|
|
8035
|
+
const result = spawnSync("firebase", ["--version"], {
|
|
8036
|
+
stdio: "pipe",
|
|
8037
|
+
encoding: "utf-8",
|
|
8038
|
+
timeout: 1e4
|
|
8039
|
+
});
|
|
8040
|
+
if (result.status === 0) {
|
|
8041
|
+
results.push({ name: "Firebase CLI", status: "pass", message: result.stdout.trim() });
|
|
8042
|
+
} else {
|
|
8043
|
+
results.push({ name: "Firebase CLI", status: "fail", message: "Not installed" });
|
|
8044
|
+
}
|
|
8045
|
+
} catch {
|
|
8046
|
+
results.push({ name: "Firebase CLI", status: "fail", message: "Not installed" });
|
|
8047
|
+
}
|
|
8048
|
+
const rcPath = joinPath(ctx.projectRoot, ".firebaserc");
|
|
8049
|
+
if (pathExists(rcPath)) {
|
|
8050
|
+
try {
|
|
8051
|
+
const raw = readSync(rcPath, { format: "text" });
|
|
8052
|
+
if (typeof raw !== "string") throw new Error("Not a string");
|
|
8053
|
+
const rc = JSON.parse(raw);
|
|
8054
|
+
const projects = rc?.projects;
|
|
8055
|
+
const projectId = projects && typeof projects === "object" ? projects.default : void 0;
|
|
8056
|
+
if (projectId && typeof projectId === "string") {
|
|
8057
|
+
results.push({ name: ".firebaserc", status: "pass", message: `Project: ${projectId}` });
|
|
8058
|
+
} else {
|
|
8059
|
+
results.push({ name: ".firebaserc", status: "warn", message: "No default project set" });
|
|
8060
|
+
}
|
|
8061
|
+
} catch {
|
|
8062
|
+
results.push({ name: ".firebaserc", status: "warn", message: "Invalid JSON" });
|
|
8063
|
+
}
|
|
8064
|
+
} else {
|
|
8065
|
+
results.push({ name: ".firebaserc", status: "fail", message: "Missing \u2014 run dndev setup firebase" });
|
|
8066
|
+
}
|
|
8067
|
+
const framework = ctx.app?.framework ?? "vite";
|
|
8068
|
+
const prefix = framework === "nextjs" ? "NEXT_PUBLIC_" : "VITE_";
|
|
8069
|
+
const envPath = joinPath(ctx.appDir, ".env");
|
|
8070
|
+
if (pathExists(envPath)) {
|
|
8071
|
+
const content = readSync(envPath, { format: "text" });
|
|
8072
|
+
if (typeof content === "string") {
|
|
8073
|
+
const requiredKeys = ["FIREBASE_API_KEY", "FIREBASE_PROJECT_ID", "FIREBASE_AUTH_DOMAIN"];
|
|
8074
|
+
const missing = requiredKeys.filter((key) => !content.includes(`${prefix}${key}=`));
|
|
8075
|
+
if (missing.length === 0) {
|
|
8076
|
+
results.push({ name: "Firebase .env", status: "pass", message: "All required keys present" });
|
|
8077
|
+
} else {
|
|
8078
|
+
results.push({ name: "Firebase .env", status: "fail", message: `Missing: ${missing.join(", ")}` });
|
|
8079
|
+
}
|
|
8080
|
+
}
|
|
8081
|
+
} else {
|
|
8082
|
+
results.push({ name: "Firebase .env", status: "fail", message: ".env file not found" });
|
|
8083
|
+
}
|
|
8084
|
+
const saKeyPaths = [
|
|
8085
|
+
joinPath(ctx.appDir, "service-account-key.json"),
|
|
8086
|
+
joinPath(ctx.projectRoot, "service-account-key.json")
|
|
8087
|
+
];
|
|
8088
|
+
const saFound = saKeyPaths.some((p2) => pathExists(p2));
|
|
8089
|
+
if (saFound) {
|
|
8090
|
+
results.push({ name: "Service account key", status: "pass", message: "Found" });
|
|
8091
|
+
} else {
|
|
8092
|
+
results.push({ name: "Service account key", status: "warn", message: "Not found (needed for deploy/emu)" });
|
|
8093
|
+
}
|
|
8094
|
+
return results;
|
|
8095
|
+
}
|
|
8096
|
+
};
|
|
7445
8097
|
}
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
8098
|
+
});
|
|
8099
|
+
|
|
8100
|
+
// packages/tooling/src/cli/setup/supabase.ts
|
|
8101
|
+
function isValidSupabaseUrl(url) {
|
|
8102
|
+
try {
|
|
8103
|
+
const parsed = new URL(url);
|
|
8104
|
+
return parsed.protocol === "https:" && (parsed.hostname.endsWith(".supabase.co") || parsed.hostname.endsWith(".supabase.in") || // Self-hosted or local
|
|
8105
|
+
parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1");
|
|
8106
|
+
} catch {
|
|
8107
|
+
return false;
|
|
7449
8108
|
}
|
|
7450
|
-
|
|
7451
|
-
|
|
8109
|
+
}
|
|
8110
|
+
function isValidPublicKey(key) {
|
|
8111
|
+
return key.trim().length > 0;
|
|
8112
|
+
}
|
|
8113
|
+
var init_supabase = __esm({
|
|
8114
|
+
"packages/tooling/src/cli/setup/supabase.ts"() {
|
|
8115
|
+
"use strict";
|
|
8116
|
+
init_utils();
|
|
7452
8117
|
}
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
8118
|
+
});
|
|
8119
|
+
|
|
8120
|
+
// packages/tooling/src/cli/doctor/check-supabase.ts
|
|
8121
|
+
var check_supabase_exports = {};
|
|
8122
|
+
__export(check_supabase_exports, {
|
|
8123
|
+
supabaseCheck: () => supabaseCheck
|
|
8124
|
+
});
|
|
8125
|
+
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
8126
|
+
var supabaseCheck;
|
|
8127
|
+
var init_check_supabase = __esm({
|
|
8128
|
+
"packages/tooling/src/cli/doctor/check-supabase.ts"() {
|
|
8129
|
+
"use strict";
|
|
8130
|
+
init_utils();
|
|
8131
|
+
init_pathResolver();
|
|
8132
|
+
init_supabase();
|
|
8133
|
+
supabaseCheck = {
|
|
8134
|
+
id: "supabase",
|
|
8135
|
+
name: "Supabase",
|
|
8136
|
+
isRelevant(ctx) {
|
|
8137
|
+
return pathExists(joinPath(ctx.appDir, "supabase")) || pathExists(joinPath(ctx.appDir, "supabase", "config.toml"));
|
|
8138
|
+
},
|
|
8139
|
+
async run(ctx) {
|
|
8140
|
+
const results = [];
|
|
8141
|
+
const framework = ctx.app?.framework === "nextjs" ? "nextjs" : "vite";
|
|
8142
|
+
const prefix = framework === "nextjs" ? "NEXT_PUBLIC_" : "VITE_";
|
|
8143
|
+
try {
|
|
8144
|
+
const result = spawnSync2("supabase", ["--version"], {
|
|
8145
|
+
stdio: "pipe",
|
|
8146
|
+
encoding: "utf-8",
|
|
8147
|
+
timeout: 1e4
|
|
8148
|
+
});
|
|
8149
|
+
if (result.status === 0) {
|
|
8150
|
+
results.push({ name: "Supabase CLI", status: "pass", message: result.stdout.trim() });
|
|
8151
|
+
} else {
|
|
8152
|
+
results.push({ name: "Supabase CLI", status: "warn", message: "Not installed (needed for migrations)" });
|
|
8153
|
+
}
|
|
8154
|
+
} catch {
|
|
8155
|
+
results.push({ name: "Supabase CLI", status: "warn", message: "Not installed" });
|
|
8156
|
+
}
|
|
8157
|
+
const configPath = joinPath(ctx.appDir, "supabase", "config.toml");
|
|
8158
|
+
if (pathExists(configPath)) {
|
|
8159
|
+
results.push({ name: "config.toml", status: "pass", message: "Found" });
|
|
8160
|
+
} else {
|
|
8161
|
+
results.push({ name: "config.toml", status: "warn", message: "Missing (expected at supabase/config.toml)" });
|
|
8162
|
+
}
|
|
8163
|
+
const envPath = joinPath(ctx.appDir, ".env");
|
|
8164
|
+
if (pathExists(envPath)) {
|
|
8165
|
+
const content = readSync(envPath, { format: "text" });
|
|
8166
|
+
if (typeof content === "string") {
|
|
8167
|
+
const urlMatch = content.match(new RegExp(`${prefix}SUPABASE_URL=(.+)`));
|
|
8168
|
+
const url = urlMatch?.[1]?.trim();
|
|
8169
|
+
if (url && isValidSupabaseUrl(url)) {
|
|
8170
|
+
results.push({ name: "Supabase URL", status: "pass", message: url });
|
|
8171
|
+
} else if (url) {
|
|
8172
|
+
results.push({ name: "Supabase URL", status: "fail", message: "Invalid URL format" });
|
|
8173
|
+
} else {
|
|
8174
|
+
results.push({ name: "Supabase URL", status: "fail", message: "Missing in .env" });
|
|
8175
|
+
}
|
|
8176
|
+
const keyMatch = content.match(new RegExp(`${prefix}SUPABASE_(?:PUBLIC_KEY|ANON_KEY)=(.+)`));
|
|
8177
|
+
const key = keyMatch?.[1]?.trim();
|
|
8178
|
+
if (key && isValidPublicKey(key)) {
|
|
8179
|
+
results.push({ name: "Supabase public key", status: "pass", message: "Present" });
|
|
8180
|
+
} else {
|
|
8181
|
+
results.push({ name: "Supabase public key", status: "fail", message: "Missing in .env" });
|
|
8182
|
+
}
|
|
8183
|
+
}
|
|
8184
|
+
} else {
|
|
8185
|
+
results.push({ name: "Supabase .env", status: "fail", message: ".env file not found" });
|
|
8186
|
+
}
|
|
8187
|
+
const functionsEnvCandidates = [
|
|
8188
|
+
joinPath(ctx.appDir, "supabase", "functions", ".env"),
|
|
8189
|
+
joinPath(ctx.appDir, "functions", ".env")
|
|
8190
|
+
];
|
|
8191
|
+
let secretFound = false;
|
|
8192
|
+
for (const fenvPath of functionsEnvCandidates) {
|
|
8193
|
+
if (!pathExists(fenvPath)) continue;
|
|
8194
|
+
const content = readSync(fenvPath, { format: "text" });
|
|
8195
|
+
if (typeof content === "string" && content.match(/SUPABASE_(?:SECRET|SERVICE_ROLE)_KEY=.+/)) {
|
|
8196
|
+
secretFound = true;
|
|
8197
|
+
results.push({ name: "Secret key", status: "pass", message: `Found in ${fenvPath.split("/").pop()}` });
|
|
8198
|
+
break;
|
|
8199
|
+
}
|
|
8200
|
+
}
|
|
8201
|
+
if (!secretFound) {
|
|
8202
|
+
results.push({ name: "Secret key", status: "warn", message: "Not found (needed for migrations + deploy)" });
|
|
8203
|
+
}
|
|
8204
|
+
return results;
|
|
8205
|
+
}
|
|
8206
|
+
};
|
|
7459
8207
|
}
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
8208
|
+
});
|
|
8209
|
+
|
|
8210
|
+
// packages/tooling/src/cli/doctor/check-stripe.ts
|
|
8211
|
+
var check_stripe_exports = {};
|
|
8212
|
+
__export(check_stripe_exports, {
|
|
8213
|
+
stripeCheck: () => stripeCheck
|
|
8214
|
+
});
|
|
8215
|
+
function readEnvValue(envPath, varName) {
|
|
8216
|
+
if (!pathExists(envPath)) return null;
|
|
8217
|
+
const content = readSync(envPath, { format: "text" });
|
|
8218
|
+
if (typeof content !== "string") return null;
|
|
8219
|
+
for (const line of content.split(/\r?\n/)) {
|
|
8220
|
+
const trimmed = line.trim();
|
|
8221
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
8222
|
+
if (trimmed.startsWith(`${varName}=`)) {
|
|
8223
|
+
let val = trimmed.substring(`${varName}=`.length).trim();
|
|
8224
|
+
if (val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'")) {
|
|
8225
|
+
val = val.slice(1, -1);
|
|
8226
|
+
}
|
|
8227
|
+
return val || null;
|
|
8228
|
+
}
|
|
8229
|
+
}
|
|
8230
|
+
return null;
|
|
8231
|
+
}
|
|
8232
|
+
function findFunctionsEnv(ctx) {
|
|
8233
|
+
const candidates = [
|
|
8234
|
+
joinPath(ctx.appDir, "supabase", "functions", ".env"),
|
|
8235
|
+
joinPath(ctx.appDir, "functions", ".env")
|
|
8236
|
+
];
|
|
8237
|
+
return candidates.find((p2) => pathExists(p2)) ?? null;
|
|
8238
|
+
}
|
|
8239
|
+
var stripeCheck;
|
|
8240
|
+
var init_check_stripe = __esm({
|
|
8241
|
+
"packages/tooling/src/cli/doctor/check-stripe.ts"() {
|
|
8242
|
+
"use strict";
|
|
8243
|
+
init_utils();
|
|
8244
|
+
init_pathResolver();
|
|
8245
|
+
stripeCheck = {
|
|
8246
|
+
id: "stripe",
|
|
8247
|
+
name: "Stripe",
|
|
8248
|
+
isRelevant(ctx) {
|
|
8249
|
+
const pkgPath = joinPath(ctx.appDir, "package.json");
|
|
8250
|
+
if (pathExists(pkgPath)) {
|
|
8251
|
+
const pkg = readSync(pkgPath, { format: "json" });
|
|
8252
|
+
if (pkg && typeof pkg === "object") {
|
|
8253
|
+
const deps = pkg.dependencies;
|
|
8254
|
+
if (deps?.["@donotdev/billing"]) return true;
|
|
8255
|
+
}
|
|
8256
|
+
}
|
|
8257
|
+
const envPath = joinPath(ctx.appDir, ".env");
|
|
8258
|
+
if (pathExists(envPath)) {
|
|
8259
|
+
const content = readSync(envPath, { format: "text" });
|
|
8260
|
+
if (typeof content === "string" && content.includes("STRIPE_PUBLISHABLE_KEY")) return true;
|
|
8261
|
+
}
|
|
8262
|
+
return false;
|
|
8263
|
+
},
|
|
8264
|
+
async run(ctx) {
|
|
8265
|
+
const results = [];
|
|
8266
|
+
const framework = ctx.app?.framework ?? "vite";
|
|
8267
|
+
const prefix = framework === "nextjs" ? "NEXT_PUBLIC_" : "VITE_";
|
|
8268
|
+
const envPath = joinPath(ctx.appDir, ".env");
|
|
8269
|
+
const functionsEnvPath = findFunctionsEnv(ctx);
|
|
8270
|
+
const pk = readEnvValue(envPath, `${prefix}STRIPE_PUBLISHABLE_KEY`);
|
|
8271
|
+
let pkMode = null;
|
|
8272
|
+
if (pk) {
|
|
8273
|
+
if (pk.startsWith("pk_test_") || pk.startsWith("pk_live_")) {
|
|
8274
|
+
pkMode = pk.startsWith("pk_test_") ? "test" : "live";
|
|
8275
|
+
results.push({ name: "Publishable key", status: "pass", message: `Valid (${pkMode} mode)` });
|
|
8276
|
+
} else {
|
|
8277
|
+
results.push({ name: "Publishable key", status: "fail", message: "Invalid format \u2014 must start with pk_test_ or pk_live_" });
|
|
8278
|
+
}
|
|
8279
|
+
} else {
|
|
8280
|
+
results.push({ name: "Publishable key", status: "fail", message: "Missing in .env" });
|
|
8281
|
+
}
|
|
8282
|
+
let skMode = null;
|
|
8283
|
+
if (functionsEnvPath) {
|
|
8284
|
+
const sk = readEnvValue(functionsEnvPath, "STRIPE_SECRET_KEY");
|
|
8285
|
+
if (sk) {
|
|
8286
|
+
if (sk.startsWith("sk_test_") || sk.startsWith("sk_live_") || sk.startsWith("rk_test_") || sk.startsWith("rk_live_")) {
|
|
8287
|
+
skMode = sk.includes("_test_") ? "test" : "live";
|
|
8288
|
+
results.push({ name: "Secret key", status: "pass", message: `Valid (${skMode} mode)` });
|
|
8289
|
+
} else {
|
|
8290
|
+
results.push({ name: "Secret key", status: "fail", message: "STRIPE_SECRET_KEY has invalid format" });
|
|
8291
|
+
}
|
|
8292
|
+
} else {
|
|
8293
|
+
results.push({ name: "Secret key", status: "warn", message: "Not found in functions/.env" });
|
|
8294
|
+
}
|
|
8295
|
+
} else {
|
|
8296
|
+
results.push({ name: "Secret key", status: "warn", message: "No functions/.env found" });
|
|
8297
|
+
}
|
|
8298
|
+
if (functionsEnvPath) {
|
|
8299
|
+
const wh = readEnvValue(functionsEnvPath, "STRIPE_WEBHOOK_SECRET");
|
|
8300
|
+
if (wh) {
|
|
8301
|
+
if (wh.startsWith("whsec_")) {
|
|
8302
|
+
results.push({ name: "Webhook secret", status: "pass", message: "Valid format" });
|
|
8303
|
+
} else {
|
|
8304
|
+
results.push({ name: "Webhook secret", status: "fail", message: "STRIPE_WEBHOOK_SECRET has invalid format" });
|
|
8305
|
+
}
|
|
8306
|
+
} else {
|
|
8307
|
+
results.push({ name: "Webhook secret", status: "warn", message: "Not found \u2014 webhooks won't verify" });
|
|
8308
|
+
}
|
|
8309
|
+
}
|
|
8310
|
+
if (pkMode && skMode) {
|
|
8311
|
+
if (pkMode !== skMode) {
|
|
8312
|
+
results.push({ name: "Key mode", status: "warn", message: `Publishable key is ${pkMode} but secret key is ${skMode}` });
|
|
8313
|
+
} else {
|
|
8314
|
+
results.push({ name: "Key mode", status: "pass", message: `Both keys are ${pkMode}` });
|
|
8315
|
+
}
|
|
8316
|
+
}
|
|
8317
|
+
return results;
|
|
7471
8318
|
}
|
|
7472
|
-
}
|
|
7473
|
-
|
|
7474
|
-
|
|
8319
|
+
};
|
|
8320
|
+
}
|
|
8321
|
+
});
|
|
8322
|
+
|
|
8323
|
+
// packages/tooling/src/cli/doctor/check-auth.ts
|
|
8324
|
+
var check_auth_exports = {};
|
|
8325
|
+
__export(check_auth_exports, {
|
|
8326
|
+
authCheck: () => authCheck
|
|
8327
|
+
});
|
|
8328
|
+
var authCheck;
|
|
8329
|
+
var init_check_auth = __esm({
|
|
8330
|
+
"packages/tooling/src/cli/doctor/check-auth.ts"() {
|
|
8331
|
+
"use strict";
|
|
8332
|
+
init_utils();
|
|
8333
|
+
init_pathResolver();
|
|
8334
|
+
authCheck = {
|
|
8335
|
+
id: "auth",
|
|
8336
|
+
name: "Authentication",
|
|
8337
|
+
isRelevant(ctx) {
|
|
8338
|
+
const pkgPath = joinPath(ctx.appDir, "package.json");
|
|
8339
|
+
if (pathExists(pkgPath)) {
|
|
8340
|
+
const content = readSync(pkgPath, { format: "text" });
|
|
8341
|
+
if (typeof content === "string" && content.includes("@donotdev/auth")) return true;
|
|
8342
|
+
}
|
|
8343
|
+
return false;
|
|
8344
|
+
},
|
|
8345
|
+
async run(ctx) {
|
|
8346
|
+
const results = [];
|
|
8347
|
+
results.push({ name: "@donotdev/auth", status: "pass", message: "Installed" });
|
|
8348
|
+
const candidates = [
|
|
8349
|
+
joinPath(ctx.appDir, "src", "providers.ts"),
|
|
8350
|
+
joinPath(ctx.appDir, "src", "providers.tsx"),
|
|
8351
|
+
joinPath(ctx.appDir, "src", "config", "providers.ts"),
|
|
8352
|
+
joinPath(ctx.appDir, "src", "lib", "providers.ts")
|
|
8353
|
+
];
|
|
8354
|
+
const providerFile = candidates.find((c) => pathExists(c));
|
|
8355
|
+
if (providerFile) {
|
|
8356
|
+
results.push({
|
|
8357
|
+
name: "Providers config",
|
|
8358
|
+
status: "pass",
|
|
8359
|
+
message: `Found: ${providerFile.split("/").slice(-2).join("/")}`
|
|
8360
|
+
});
|
|
8361
|
+
const content = readSync(providerFile, { format: "text" });
|
|
8362
|
+
if (typeof content === "string") {
|
|
8363
|
+
const providers = [];
|
|
8364
|
+
if (content.includes("email") || content.includes("Email")) providers.push("email");
|
|
8365
|
+
if (content.includes("google") || content.includes("Google")) providers.push("google");
|
|
8366
|
+
if (content.includes("github") || content.includes("GitHub")) providers.push("github");
|
|
8367
|
+
if (content.includes("apple") || content.includes("Apple")) providers.push("apple");
|
|
8368
|
+
if (providers.length > 0) {
|
|
8369
|
+
results.push({
|
|
8370
|
+
name: "Auth providers",
|
|
8371
|
+
status: "pass",
|
|
8372
|
+
message: `Configured: ${providers.join(", ")}`
|
|
8373
|
+
});
|
|
8374
|
+
}
|
|
8375
|
+
}
|
|
8376
|
+
} else {
|
|
8377
|
+
results.push({ name: "Providers config", status: "warn", message: "No providers.ts found \u2014 auth may not work" });
|
|
8378
|
+
}
|
|
8379
|
+
const hasFirebase = pathExists(joinPath(ctx.projectRoot, ".firebaserc"));
|
|
8380
|
+
const hasSupabase = pathExists(joinPath(ctx.appDir, "supabase"));
|
|
8381
|
+
if (hasFirebase) {
|
|
8382
|
+
results.push({
|
|
8383
|
+
name: "Backend",
|
|
8384
|
+
status: "pass",
|
|
8385
|
+
message: "Firebase Auth (verify providers are enabled in console)",
|
|
8386
|
+
detail: "Run dndev setup auth for setup coaching"
|
|
8387
|
+
});
|
|
8388
|
+
} else if (hasSupabase) {
|
|
8389
|
+
results.push({
|
|
8390
|
+
name: "Backend",
|
|
8391
|
+
status: "pass",
|
|
8392
|
+
message: "Supabase Auth (verify providers are enabled in dashboard)",
|
|
8393
|
+
detail: "Run dndev setup auth for setup coaching"
|
|
8394
|
+
});
|
|
8395
|
+
} else {
|
|
8396
|
+
results.push({ name: "Backend", status: "warn", message: "No backend detected for auth" });
|
|
8397
|
+
}
|
|
8398
|
+
return results;
|
|
8399
|
+
}
|
|
8400
|
+
};
|
|
8401
|
+
}
|
|
8402
|
+
});
|
|
8403
|
+
|
|
8404
|
+
// packages/tooling/src/cli/doctor/doctor.ts
|
|
8405
|
+
function renderResults(allResults, verbose) {
|
|
8406
|
+
const lines = [];
|
|
8407
|
+
for (const { checkName, results } of allResults) {
|
|
8408
|
+
lines.push(checkName);
|
|
8409
|
+
for (const result of results) {
|
|
8410
|
+
const icon = STATUS_ICONS[result.status];
|
|
8411
|
+
lines.push(` ${icon} ${result.name}: ${result.message}`);
|
|
8412
|
+
if (verbose && result.detail) {
|
|
8413
|
+
lines.push(` ${result.detail}`);
|
|
7475
8414
|
}
|
|
7476
8415
|
}
|
|
7477
|
-
|
|
7478
|
-
}
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
8416
|
+
lines.push("");
|
|
8417
|
+
}
|
|
8418
|
+
Me(lines.join("\n"), "Health Check Results");
|
|
8419
|
+
}
|
|
8420
|
+
async function main(options = {}) {
|
|
8421
|
+
Ie("DoNotDev Doctor");
|
|
8422
|
+
const projectRoot = process.cwd();
|
|
8423
|
+
let appDir = projectRoot;
|
|
8424
|
+
let app = null;
|
|
8425
|
+
const appsDir = joinPath(projectRoot, "apps");
|
|
8426
|
+
if (pathExists(appsDir)) {
|
|
8427
|
+
try {
|
|
8428
|
+
app = await selectApp(projectRoot, options.app);
|
|
8429
|
+
if (app) {
|
|
8430
|
+
appDir = app.path;
|
|
8431
|
+
}
|
|
8432
|
+
} catch {
|
|
8433
|
+
}
|
|
8434
|
+
}
|
|
8435
|
+
const ctx = {
|
|
8436
|
+
projectRoot,
|
|
8437
|
+
appDir,
|
|
8438
|
+
app,
|
|
8439
|
+
verbose: options.verbose
|
|
8440
|
+
};
|
|
8441
|
+
const allResults = [];
|
|
8442
|
+
let hasFail = false;
|
|
8443
|
+
const registry = options.check ? CHECK_REGISTRY.filter((e2) => e2.id === options.check) : CHECK_REGISTRY;
|
|
8444
|
+
if (options.check && registry.length === 0) {
|
|
8445
|
+
log.error(`Unknown check: ${options.check}. Available: ${CHECK_REGISTRY.map((e2) => e2.id).join(", ")}`);
|
|
8446
|
+
Se("Doctor aborted.");
|
|
8447
|
+
return 1;
|
|
8448
|
+
}
|
|
8449
|
+
for (const entry of registry) {
|
|
8450
|
+
const check = await entry.load();
|
|
8451
|
+
if (!check.isRelevant(ctx)) continue;
|
|
8452
|
+
const results = await check.run(ctx);
|
|
8453
|
+
allResults.push({ checkName: check.name, results });
|
|
8454
|
+
if (results.some((r2) => r2.status === "fail")) {
|
|
8455
|
+
hasFail = true;
|
|
8456
|
+
}
|
|
7484
8457
|
}
|
|
8458
|
+
if (allResults.length === 0) {
|
|
8459
|
+
log.warn("No checks were relevant for this project.");
|
|
8460
|
+
Se("Nothing to check.");
|
|
8461
|
+
return 0;
|
|
8462
|
+
}
|
|
8463
|
+
renderResults(allResults, options.verbose ?? false);
|
|
8464
|
+
let passes = 0;
|
|
8465
|
+
let warnings = 0;
|
|
8466
|
+
let fails = 0;
|
|
8467
|
+
for (const { results } of allResults) {
|
|
8468
|
+
for (const r2 of results) {
|
|
8469
|
+
if (r2.status === "pass") passes++;
|
|
8470
|
+
else if (r2.status === "warn") warnings++;
|
|
8471
|
+
else if (r2.status === "fail") fails++;
|
|
8472
|
+
}
|
|
8473
|
+
}
|
|
8474
|
+
const totalChecks = passes + warnings + fails;
|
|
8475
|
+
const summaryParts = [`${passes}/${totalChecks} passed`];
|
|
8476
|
+
if (warnings > 0) summaryParts.push(`${warnings} warning(s)`);
|
|
8477
|
+
if (fails > 0) summaryParts.push(`${fails} failure(s)`);
|
|
8478
|
+
const exitCode = hasFail ? 1 : 0;
|
|
8479
|
+
Se(hasFail ? `Health check failed: ${summaryParts.join(", ")}` : `All clear: ${summaryParts.join(", ")}`);
|
|
8480
|
+
return exitCode;
|
|
7485
8481
|
}
|
|
8482
|
+
var CHECK_REGISTRY, STATUS_ICONS;
|
|
8483
|
+
var init_doctor = __esm({
|
|
8484
|
+
"packages/tooling/src/cli/doctor/doctor.ts"() {
|
|
8485
|
+
"use strict";
|
|
8486
|
+
init_utils();
|
|
8487
|
+
init_cli_output();
|
|
8488
|
+
init_app_selector();
|
|
8489
|
+
init_pathResolver();
|
|
8490
|
+
CHECK_REGISTRY = [
|
|
8491
|
+
{ id: "env", load: async () => (await Promise.resolve().then(() => (init_check_env(), check_env_exports))).envCheck },
|
|
8492
|
+
{ id: "firebase", load: async () => (await Promise.resolve().then(() => (init_check_firebase(), check_firebase_exports))).firebaseCheck },
|
|
8493
|
+
{ id: "supabase", load: async () => (await Promise.resolve().then(() => (init_check_supabase(), check_supabase_exports))).supabaseCheck },
|
|
8494
|
+
{ id: "stripe", load: async () => (await Promise.resolve().then(() => (init_check_stripe(), check_stripe_exports))).stripeCheck },
|
|
8495
|
+
{ id: "auth", load: async () => (await Promise.resolve().then(() => (init_check_auth(), check_auth_exports))).authCheck }
|
|
8496
|
+
];
|
|
8497
|
+
STATUS_ICONS = {
|
|
8498
|
+
pass: "\u2705",
|
|
8499
|
+
// green check
|
|
8500
|
+
warn: "\u26A0\uFE0F",
|
|
8501
|
+
// warning
|
|
8502
|
+
fail: "\u274C"
|
|
8503
|
+
// red x
|
|
8504
|
+
};
|
|
8505
|
+
}
|
|
8506
|
+
});
|
|
8507
|
+
|
|
8508
|
+
// packages/cli/src/bin/commands/doctor.ts
|
|
8509
|
+
init_utils();
|
|
8510
|
+
|
|
8511
|
+
// packages/tooling/src/index.ts
|
|
8512
|
+
init_utils();
|
|
8513
|
+
|
|
8514
|
+
// packages/tooling/src/cli/index.ts
|
|
8515
|
+
init_utils();
|
|
8516
|
+
init_doctor();
|
|
7486
8517
|
export {
|
|
7487
8518
|
main
|
|
7488
8519
|
};
|