@donotdev/cli 0.0.18 → 0.0.19
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 +55 -156
- package/dist/bin/commands/coach.js +8177 -0
- package/dist/bin/commands/create-app.js +5 -5
- package/dist/bin/commands/create-project.js +10 -7
- package/dist/bin/commands/deploy.js +81 -59
- package/dist/bin/commands/doctor.js +243 -698
- package/dist/bin/commands/emu.js +2 -2
- package/dist/bin/commands/format.js +4 -1
- package/dist/bin/commands/get-demo.js +8351 -0
- package/dist/bin/commands/make-admin.js +773 -152
- package/dist/bin/commands/setup.js +519 -1711
- package/dist/bin/commands/staging.js +17852 -0
- package/dist/bin/commands/sync-secrets.js +2 -11
- package/dist/bin/commands/type-check.js +7733 -1713
- package/dist/bin/dndev.js +913 -185
- package/dist/bin/donotdev.js +913 -185
- package/dist/index.js +96 -65
- package/package.json +1 -1
- package/templates/app-demo/index.html.example +147 -10
- package/templates/app-demo/src/App.tsx.example +7 -13
- package/templates/app-demo/src/config/app.ts.example +12 -48
- package/templates/app-demo/src/entities/product.ts.example +38 -0
- package/templates/app-demo/src/globals.css.example +5 -1
- package/templates/app-demo/src/main.tsx.example +13 -7
- package/templates/app-demo/src/pages/ChangelogPage.tsx.example +14 -0
- package/templates/app-demo/src/pages/DashboardPage.tsx.example +15 -0
- package/templates/app-demo/src/pages/HomePage.tsx.example +3 -77
- package/templates/app-demo/src/pages/PricingPage.tsx.example +14 -0
- package/templates/app-demo/src/pages/ProductsPage.tsx.example +17 -0
- package/templates/app-demo/src/pages/ProfilePage.tsx.example +16 -0
- package/templates/app-demo/src/pages/SettingsPage.tsx.example +15 -0
- package/templates/app-demo/src/pages/ShowcaseDetailPage.tsx.example +112 -0
- package/templates/app-demo/src/pages/ShowcasePage.tsx.example +91 -0
- package/templates/app-demo/src/pages/legal/LegalPage.tsx.example +14 -0
- package/templates/app-demo/src/pages/legal/PrivacyPage.tsx.example +14 -0
- package/templates/app-demo/src/pages/legal/TermsPage.tsx.example +14 -0
- package/templates/app-demo/tsconfig.json.example +1 -1
- package/templates/app-demo/vite.config.ts.example +23 -48
- package/templates/app-expo/README.md.example +1 -1
- package/templates/app-expo/app/index.tsx.example +1 -1
- package/templates/app-vite/src/pages/HomePage.tsx.example +8 -10
- 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 +1 -1
- package/templates/overlay-supabase/env.fragment.expo.example +1 -1
- package/templates/overlay-supabase/env.fragment.nextjs.example +1 -1
- 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 +4 -3
- package/templates/root-consumer/guides/dndev/AGENT_START_HERE.md.example +21 -6
- package/templates/root-consumer/guides/dndev/COMPONENTS_ADV.md.example +16 -179
- package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +19 -21
- package/templates/root-consumer/guides/dndev/GOTCHAS.md.example +14 -3
- 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_BLOG.md.example +19 -2
- package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +35 -1
- package/templates/root-consumer/guides/dndev/SETUP_FIREBASE.md.example +17 -12
- package/templates/root-consumer/guides/dndev/SETUP_LAYOUTS.md.example +32 -0
- package/templates/root-consumer/guides/dndev/SETUP_OAUTH_PROVIDERS.md.example +1 -1
- package/templates/root-consumer/guides/dndev/SETUP_PAGES.md.example +19 -15
- package/templates/root-consumer/guides/dndev/SETUP_STRIPE.md.example +2 -2
- package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +17 -12
- package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +37 -16
- package/templates/root-consumer/guides/dndev/USE_ROUTING.md.example +18 -18
- package/templates/root-consumer/guides/dndev/essences_reference.css.example +119 -2
- package/templates/root-consumer/guides/wai-way/blueprints/1_scaffold.md.example +14 -0
- package/templates/root-consumer/guides/wai-way/blueprints/2_entities.md.example +6 -0
- package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +14 -0
- package/templates/root-consumer/guides/wai-way/entity_patterns.md.example +4 -5
- package/templates/root-consumer/guides/wai-way/page_patterns.md.example +2 -2
- package/dist/bin/commands/agent-setup.d.ts +0 -6
- package/dist/bin/commands/agent-setup.d.ts.map +0 -1
- package/dist/bin/commands/agent-setup.js.map +0 -1
- package/dist/bin/commands/build.d.ts +0 -11
- package/dist/bin/commands/build.d.ts.map +0 -1
- package/dist/bin/commands/build.js.map +0 -1
- package/dist/bin/commands/bump.d.ts +0 -11
- package/dist/bin/commands/bump.d.ts.map +0 -1
- package/dist/bin/commands/bump.js.map +0 -1
- package/dist/bin/commands/cacheout.d.ts +0 -11
- package/dist/bin/commands/cacheout.d.ts.map +0 -1
- package/dist/bin/commands/cacheout.js.map +0 -1
- package/dist/bin/commands/create-app.d.ts +0 -11
- package/dist/bin/commands/create-app.d.ts.map +0 -1
- package/dist/bin/commands/create-app.js.map +0 -1
- package/dist/bin/commands/create-project.d.ts +0 -11
- package/dist/bin/commands/create-project.d.ts.map +0 -1
- package/dist/bin/commands/create-project.js.map +0 -1
- package/dist/bin/commands/deploy.d.ts +0 -11
- package/dist/bin/commands/deploy.d.ts.map +0 -1
- package/dist/bin/commands/deploy.js.map +0 -1
- package/dist/bin/commands/dev.d.ts +0 -11
- package/dist/bin/commands/dev.d.ts.map +0 -1
- package/dist/bin/commands/dev.js.map +0 -1
- package/dist/bin/commands/doctor.d.ts +0 -6
- package/dist/bin/commands/doctor.d.ts.map +0 -1
- package/dist/bin/commands/doctor.js.map +0 -1
- package/dist/bin/commands/emu.d.ts +0 -11
- package/dist/bin/commands/emu.d.ts.map +0 -1
- package/dist/bin/commands/emu.js.map +0 -1
- package/dist/bin/commands/format.d.ts +0 -11
- package/dist/bin/commands/format.d.ts.map +0 -1
- package/dist/bin/commands/format.js.map +0 -1
- package/dist/bin/commands/make-admin.d.ts +0 -11
- package/dist/bin/commands/make-admin.d.ts.map +0 -1
- package/dist/bin/commands/make-admin.js.map +0 -1
- package/dist/bin/commands/preview.d.ts +0 -11
- package/dist/bin/commands/preview.d.ts.map +0 -1
- package/dist/bin/commands/preview.js.map +0 -1
- package/dist/bin/commands/setup.d.ts +0 -6
- package/dist/bin/commands/setup.d.ts.map +0 -1
- package/dist/bin/commands/setup.js.map +0 -1
- package/dist/bin/commands/sync-secrets.d.ts +0 -11
- package/dist/bin/commands/sync-secrets.d.ts.map +0 -1
- package/dist/bin/commands/sync-secrets.js.map +0 -1
- package/dist/bin/commands/type-check.d.ts +0 -14
- package/dist/bin/commands/type-check.d.ts.map +0 -1
- package/dist/bin/commands/type-check.js.map +0 -1
- package/dist/bin/commands/wai.d.ts +0 -11
- package/dist/bin/commands/wai.d.ts.map +0 -1
- package/dist/bin/commands/wai.js.map +0 -1
- package/dist/index.d.ts +0 -8
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/templates/app-demo/src/components/ThemeToggle.tsx.example +0 -48
- package/templates/app-demo/src/pages/DetailPage.tsx.example +0 -103
- package/templates/app-demo/src/pages/FullPage.tsx.example +0 -142
- package/templates/app-demo/src/pages/components/DemoLayout.tsx.example +0 -266
- package/templates/app-demo/src/pages/components/LayoutRoute.tsx.example +0 -20
|
@@ -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__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b2) => (typeof require !== "undefined" ? require : a)[b2]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
10
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
-
throw Error('Dynamic require of "' +
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" 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;
|
|
@@ -46,16 +46,16 @@ var require_src = __commonJS({
|
|
|
46
46
|
var CSI = `${ESC}[`;
|
|
47
47
|
var beep = "\x07";
|
|
48
48
|
var cursor = {
|
|
49
|
-
to(
|
|
50
|
-
if (!
|
|
51
|
-
return `${CSI}${
|
|
49
|
+
to(x, y2) {
|
|
50
|
+
if (!y2) return `${CSI}${x + 1}G`;
|
|
51
|
+
return `${CSI}${y2 + 1};${x + 1}H`;
|
|
52
52
|
},
|
|
53
|
-
move(
|
|
53
|
+
move(x, y2) {
|
|
54
54
|
let ret = "";
|
|
55
|
-
if (
|
|
56
|
-
else if (
|
|
57
|
-
if (
|
|
58
|
-
else if (
|
|
55
|
+
if (x < 0) ret += `${CSI}${-x}D`;
|
|
56
|
+
else if (x > 0) ret += `${CSI}${x}C`;
|
|
57
|
+
if (y2 < 0) ret += `${CSI}${-y2}A`;
|
|
58
|
+
else if (y2 > 0) ret += `${CSI}${y2}B`;
|
|
59
59
|
return ret;
|
|
60
60
|
},
|
|
61
61
|
up: (count = 1) => `${CSI}${count}A`,
|
|
@@ -98,10 +98,10 @@ var require_src = __commonJS({
|
|
|
98
98
|
var require_picocolors = __commonJS({
|
|
99
99
|
"node_modules/.bun/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
|
|
100
100
|
init_utils();
|
|
101
|
-
var
|
|
102
|
-
var argv =
|
|
103
|
-
var env =
|
|
104
|
-
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") ||
|
|
101
|
+
var p = process || {};
|
|
102
|
+
var argv = p.argv || [];
|
|
103
|
+
var env = p.env || {};
|
|
104
|
+
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
105
105
|
var formatter = (open, close, replace = open) => (input) => {
|
|
106
106
|
let string = "" + input, index = string.indexOf(close, open.length);
|
|
107
107
|
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
@@ -169,41 +169,14 @@ var require_picocolors = __commonJS({
|
|
|
169
169
|
|
|
170
170
|
// node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/node_modules/@clack/core/dist/index.mjs
|
|
171
171
|
import { stdin as j, stdout as M } from "node:process";
|
|
172
|
-
import O from "node:readline";
|
|
173
172
|
import { Writable as X } from "node:stream";
|
|
174
173
|
function DD({ onlyFirst: e2 = false } = {}) {
|
|
175
174
|
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("|");
|
|
176
175
|
return new RegExp(t, e2 ? void 0 : "g");
|
|
177
176
|
}
|
|
178
|
-
function P(e2) {
|
|
179
|
-
if (typeof e2 != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof e2}\``);
|
|
180
|
-
return e2.replace(uD, "");
|
|
181
|
-
}
|
|
182
177
|
function L(e2) {
|
|
183
178
|
return e2 && e2.__esModule && Object.prototype.hasOwnProperty.call(e2, "default") ? e2.default : e2;
|
|
184
179
|
}
|
|
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
|
-
}
|
|
207
180
|
function rD() {
|
|
208
181
|
const e2 = /* @__PURE__ */ new Map();
|
|
209
182
|
for (const [u2, t] of Object.entries(r)) {
|
|
@@ -233,30 +206,7 @@ function rD() {
|
|
|
233
206
|
return i === 2 && (D2 += 60), D2;
|
|
234
207
|
}, 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;
|
|
235
208
|
}
|
|
236
|
-
|
|
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;
|
|
209
|
+
var import_sisteransi, uD, W, tD, eD, FD, sD, w, N, I, R, r, iD, CD, ED, nD, _, xD, B, AD, A;
|
|
260
210
|
var init_dist = __esm({
|
|
261
211
|
"node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/node_modules/@clack/core/dist/index.mjs"() {
|
|
262
212
|
init_utils();
|
|
@@ -305,213 +255,22 @@ var init_dist = __esm({
|
|
|
305
255
|
CD = Object.keys(r.bgColor);
|
|
306
256
|
[...iD, ...CD];
|
|
307
257
|
ED = rD();
|
|
308
|
-
d = /* @__PURE__ */ new Set(["\x1B", "\x9B"]);
|
|
309
|
-
oD = 39;
|
|
310
|
-
y = "\x07";
|
|
311
|
-
V = "[";
|
|
312
258
|
nD = "]";
|
|
313
|
-
G = "m";
|
|
314
259
|
_ = `${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
|
-
};
|
|
381
260
|
xD = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
382
261
|
B = { actions: new Set(xD), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]) };
|
|
383
262
|
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
|
-
};
|
|
478
263
|
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
|
-
};
|
|
505
264
|
}
|
|
506
265
|
});
|
|
507
266
|
|
|
508
267
|
// node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs
|
|
509
|
-
import { stripVTControlCharacters as
|
|
510
|
-
import
|
|
268
|
+
import { stripVTControlCharacters as S } from "node:util";
|
|
269
|
+
import y from "node:process";
|
|
511
270
|
function ce() {
|
|
512
|
-
return
|
|
271
|
+
return y.platform !== "win32" ? y.env.TERM !== "linux" : !!y.env.CI || !!y.env.WT_SESSION || !!y.env.TERMINUS_SUBLIME || y.env.ConEmuTask === "{cmd::Cmder}" || y.env.TERM_PROGRAM === "Terminus-Sublime" || y.env.TERM_PROGRAM === "vscode" || y.env.TERM === "xterm-256color" || y.env.TERM === "alacritty" || y.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
513
272
|
}
|
|
514
|
-
var import_picocolors, import_sisteransi2,
|
|
273
|
+
var import_picocolors, import_sisteransi2, V, u, le, L2, W2, C, ue, o, d, k, P, A2, T, F, $e, _2, me, de, pe, q, D, U, K, Me, Ie, Se, M2, J;
|
|
515
274
|
var init_dist2 = __esm({
|
|
516
275
|
"node_modules/.bun/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs"() {
|
|
517
276
|
init_utils();
|
|
@@ -519,17 +278,17 @@ var init_dist2 = __esm({
|
|
|
519
278
|
init_dist();
|
|
520
279
|
import_picocolors = __toESM(require_picocolors(), 1);
|
|
521
280
|
import_sisteransi2 = __toESM(require_src(), 1);
|
|
522
|
-
|
|
523
|
-
u = (t, n) =>
|
|
281
|
+
V = ce();
|
|
282
|
+
u = (t, n) => V ? t : n;
|
|
524
283
|
le = u("\u25C6", "*");
|
|
525
284
|
L2 = u("\u25A0", "x");
|
|
526
285
|
W2 = u("\u25B2", "x");
|
|
527
286
|
C = u("\u25C7", "o");
|
|
528
287
|
ue = u("\u250C", "T");
|
|
529
288
|
o = u("\u2502", "|");
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
289
|
+
d = u("\u2514", "\u2014");
|
|
290
|
+
k = u("\u25CF", ">");
|
|
291
|
+
P = u("\u25CB", " ");
|
|
533
292
|
A2 = u("\u25FB", "[\u2022]");
|
|
534
293
|
T = u("\u25FC", "[+]");
|
|
535
294
|
F = u("\u25FB", "[ ]");
|
|
@@ -541,70 +300,15 @@ var init_dist2 = __esm({
|
|
|
541
300
|
q = u("\u25CF", "\u2022");
|
|
542
301
|
D = u("\u25C6", "*");
|
|
543
302
|
U = u("\u25B2", "!");
|
|
544
|
-
|
|
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
|
-
};
|
|
303
|
+
K = u("\u25A0", "x");
|
|
600
304
|
Me = (t = "", n = "") => {
|
|
601
305
|
const r2 = `
|
|
602
306
|
${t}
|
|
603
307
|
`.split(`
|
|
604
|
-
`), i =
|
|
605
|
-
const $
|
|
606
|
-
return
|
|
607
|
-
}, 0), i) + 2, c = r2.map((a) => `${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(a)}${" ".repeat(s -
|
|
308
|
+
`), i = S(n).length, s = Math.max(r2.reduce((a, l2) => {
|
|
309
|
+
const $ = S(l2);
|
|
310
|
+
return $.length > a ? $.length : a;
|
|
311
|
+
}, 0), i) + 2, c = r2.map((a) => `${import_picocolors.default.gray(o)} ${import_picocolors.default.dim(a)}${" ".repeat(s - S(a).length)}${import_picocolors.default.gray(o)}`).join(`
|
|
608
312
|
`);
|
|
609
313
|
process.stdout.write(`${import_picocolors.default.gray(o)}
|
|
610
314
|
${import_picocolors.default.green(C)} ${import_picocolors.default.reset(n)} ${import_picocolors.default.gray(_2.repeat(Math.max(s - i - 1, 1)) + me)}
|
|
@@ -618,7 +322,7 @@ ${import_picocolors.default.gray(de + _2.repeat(s + 2) + pe)}
|
|
|
618
322
|
};
|
|
619
323
|
Se = (t = "") => {
|
|
620
324
|
process.stdout.write(`${import_picocolors.default.gray(o)}
|
|
621
|
-
${import_picocolors.default.gray(
|
|
325
|
+
${import_picocolors.default.gray(d)} ${t}
|
|
622
326
|
|
|
623
327
|
`);
|
|
624
328
|
};
|
|
@@ -643,9 +347,9 @@ ${import_picocolors.default.gray(d2)} ${t}
|
|
|
643
347
|
}, warning: (t) => {
|
|
644
348
|
M2.warn(t);
|
|
645
349
|
}, error: (t) => {
|
|
646
|
-
M2.message(t, { symbol: import_picocolors.default.red(
|
|
350
|
+
M2.message(t, { symbol: import_picocolors.default.red(K) });
|
|
647
351
|
} };
|
|
648
|
-
|
|
352
|
+
J = `${import_picocolors.default.gray(o)} `;
|
|
649
353
|
}
|
|
650
354
|
});
|
|
651
355
|
|
|
@@ -1259,8 +963,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1259
963
|
return toRegexRange.cache[cacheKey].result;
|
|
1260
964
|
}
|
|
1261
965
|
let a = Math.min(min, max);
|
|
1262
|
-
let
|
|
1263
|
-
if (Math.abs(a -
|
|
966
|
+
let b2 = Math.max(min, max);
|
|
967
|
+
if (Math.abs(a - b2) === 1) {
|
|
1264
968
|
let result = min + "|" + max;
|
|
1265
969
|
if (opts.capture) {
|
|
1266
970
|
return `(${result})`;
|
|
@@ -1271,7 +975,7 @@ var require_to_regex_range = __commonJS({
|
|
|
1271
975
|
return `(?:${result})`;
|
|
1272
976
|
}
|
|
1273
977
|
let isPadded = hasPadding(min) || hasPadding(max);
|
|
1274
|
-
let state = { min, max, a, b:
|
|
978
|
+
let state = { min, max, a, b: b2 };
|
|
1275
979
|
let positives = [];
|
|
1276
980
|
let negatives = [];
|
|
1277
981
|
if (isPadded) {
|
|
@@ -1279,12 +983,12 @@ var require_to_regex_range = __commonJS({
|
|
|
1279
983
|
state.maxLen = String(state.max).length;
|
|
1280
984
|
}
|
|
1281
985
|
if (a < 0) {
|
|
1282
|
-
let newMin =
|
|
986
|
+
let newMin = b2 < 0 ? Math.abs(b2) : 1;
|
|
1283
987
|
negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
|
|
1284
988
|
a = state.a = 0;
|
|
1285
989
|
}
|
|
1286
|
-
if (
|
|
1287
|
-
positives = splitToPatterns(a,
|
|
990
|
+
if (b2 >= 0) {
|
|
991
|
+
positives = splitToPatterns(a, b2, state, opts);
|
|
1288
992
|
}
|
|
1289
993
|
state.negatives = negatives;
|
|
1290
994
|
state.positives = positives;
|
|
@@ -1388,13 +1092,13 @@ var require_to_regex_range = __commonJS({
|
|
|
1388
1092
|
}
|
|
1389
1093
|
return result;
|
|
1390
1094
|
}
|
|
1391
|
-
function zip(a,
|
|
1095
|
+
function zip(a, b2) {
|
|
1392
1096
|
let arr = [];
|
|
1393
|
-
for (let i = 0; i < a.length; i++) arr.push([a[i],
|
|
1097
|
+
for (let i = 0; i < a.length; i++) arr.push([a[i], b2[i]]);
|
|
1394
1098
|
return arr;
|
|
1395
1099
|
}
|
|
1396
|
-
function compare(a,
|
|
1397
|
-
return a >
|
|
1100
|
+
function compare(a, b2) {
|
|
1101
|
+
return a > b2 ? 1 : b2 > a ? -1 : 0;
|
|
1398
1102
|
}
|
|
1399
1103
|
function contains(arr, key, val) {
|
|
1400
1104
|
return arr.some((ele) => ele[key] === val);
|
|
@@ -1412,8 +1116,8 @@ var require_to_regex_range = __commonJS({
|
|
|
1412
1116
|
}
|
|
1413
1117
|
return "";
|
|
1414
1118
|
}
|
|
1415
|
-
function toCharacterClass(a,
|
|
1416
|
-
return `[${a}${
|
|
1119
|
+
function toCharacterClass(a, b2, options) {
|
|
1120
|
+
return `[${a}${b2 - a === 1 ? "" : "-"}${b2}]`;
|
|
1417
1121
|
}
|
|
1418
1122
|
function hasPadding(str) {
|
|
1419
1123
|
return /^-?(0+)\d/.test(str);
|
|
@@ -1492,8 +1196,8 @@ var require_fill_range = __commonJS({
|
|
|
1492
1196
|
return negative ? "-" + input : input;
|
|
1493
1197
|
};
|
|
1494
1198
|
var toSequence = (parts, options, maxLen) => {
|
|
1495
|
-
parts.negatives.sort((a,
|
|
1496
|
-
parts.positives.sort((a,
|
|
1199
|
+
parts.negatives.sort((a, b2) => a < b2 ? -1 : a > b2 ? 1 : 0);
|
|
1200
|
+
parts.positives.sort((a, b2) => a < b2 ? -1 : a > b2 ? 1 : 0);
|
|
1497
1201
|
let prefix = options.capture ? "" : "?:";
|
|
1498
1202
|
let positives = "";
|
|
1499
1203
|
let negatives = "";
|
|
@@ -1514,13 +1218,13 @@ var require_fill_range = __commonJS({
|
|
|
1514
1218
|
}
|
|
1515
1219
|
return result;
|
|
1516
1220
|
};
|
|
1517
|
-
var toRange = (a,
|
|
1221
|
+
var toRange = (a, b2, isNumbers, options) => {
|
|
1518
1222
|
if (isNumbers) {
|
|
1519
|
-
return toRegexRange(a,
|
|
1223
|
+
return toRegexRange(a, b2, { wrap: false, ...options });
|
|
1520
1224
|
}
|
|
1521
1225
|
let start = String.fromCharCode(a);
|
|
1522
|
-
if (a ===
|
|
1523
|
-
let stop = String.fromCharCode(
|
|
1226
|
+
if (a === b2) return start;
|
|
1227
|
+
let stop = String.fromCharCode(b2);
|
|
1524
1228
|
return `[${start}-${stop}]`;
|
|
1525
1229
|
};
|
|
1526
1230
|
var toRegex = (start, end, options) => {
|
|
@@ -1546,14 +1250,14 @@ var require_fill_range = __commonJS({
|
|
|
1546
1250
|
};
|
|
1547
1251
|
var fillNumbers = (start, end, step = 1, options = {}) => {
|
|
1548
1252
|
let a = Number(start);
|
|
1549
|
-
let
|
|
1550
|
-
if (!Number.isInteger(a) || !Number.isInteger(
|
|
1253
|
+
let b2 = Number(end);
|
|
1254
|
+
if (!Number.isInteger(a) || !Number.isInteger(b2)) {
|
|
1551
1255
|
if (options.strictRanges === true) throw rangeError([start, end]);
|
|
1552
1256
|
return [];
|
|
1553
1257
|
}
|
|
1554
1258
|
if (a === 0) a = 0;
|
|
1555
|
-
if (
|
|
1556
|
-
let descending = a >
|
|
1259
|
+
if (b2 === 0) b2 = 0;
|
|
1260
|
+
let descending = a > b2;
|
|
1557
1261
|
let startString = String(start);
|
|
1558
1262
|
let endString = String(end);
|
|
1559
1263
|
let stepString = String(step);
|
|
@@ -1569,7 +1273,7 @@ var require_fill_range = __commonJS({
|
|
|
1569
1273
|
let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
|
|
1570
1274
|
let range = [];
|
|
1571
1275
|
let index = 0;
|
|
1572
|
-
while (descending ? a >=
|
|
1276
|
+
while (descending ? a >= b2 : a <= b2) {
|
|
1573
1277
|
if (options.toRegex === true && step > 1) {
|
|
1574
1278
|
push(a);
|
|
1575
1279
|
} else {
|
|
@@ -1589,16 +1293,16 @@ var require_fill_range = __commonJS({
|
|
|
1589
1293
|
}
|
|
1590
1294
|
let format = options.transform || ((val) => String.fromCharCode(val));
|
|
1591
1295
|
let a = `${start}`.charCodeAt(0);
|
|
1592
|
-
let
|
|
1593
|
-
let descending = a >
|
|
1594
|
-
let min = Math.min(a,
|
|
1595
|
-
let max = Math.max(a,
|
|
1296
|
+
let b2 = `${end}`.charCodeAt(0);
|
|
1297
|
+
let descending = a > b2;
|
|
1298
|
+
let min = Math.min(a, b2);
|
|
1299
|
+
let max = Math.max(a, b2);
|
|
1596
1300
|
if (options.toRegex && step === 1) {
|
|
1597
1301
|
return toRange(min, max, false, options);
|
|
1598
1302
|
}
|
|
1599
1303
|
let range = [];
|
|
1600
1304
|
let index = 0;
|
|
1601
|
-
while (descending ? a >=
|
|
1305
|
+
while (descending ? a >= b2 : a <= b2) {
|
|
1602
1306
|
range.push(format(a, index));
|
|
1603
1307
|
a = descending ? a - step : a + step;
|
|
1604
1308
|
index++;
|
|
@@ -1723,11 +1427,11 @@ var require_expand = __commonJS({
|
|
|
1723
1427
|
const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
|
1724
1428
|
const walk = (node, parent = {}) => {
|
|
1725
1429
|
node.queue = [];
|
|
1726
|
-
let
|
|
1430
|
+
let p = parent;
|
|
1727
1431
|
let q2 = parent.queue;
|
|
1728
|
-
while (
|
|
1729
|
-
|
|
1730
|
-
q2 =
|
|
1432
|
+
while (p.type !== "brace" && p.type !== "root" && p.parent) {
|
|
1433
|
+
p = p.parent;
|
|
1434
|
+
q2 = p.queue;
|
|
1731
1435
|
}
|
|
1732
1436
|
if (node.invalid || node.dollar) {
|
|
1733
1437
|
q2.push(append(q2.pop(), stringify2(node, options)));
|
|
@@ -2971,10 +2675,10 @@ var require_parse2 = __commonJS({
|
|
|
2971
2675
|
};
|
|
2972
2676
|
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
2973
2677
|
let backslashes = false;
|
|
2974
|
-
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (
|
|
2678
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
|
2975
2679
|
if (first === "\\") {
|
|
2976
2680
|
backslashes = true;
|
|
2977
|
-
return
|
|
2681
|
+
return m;
|
|
2978
2682
|
}
|
|
2979
2683
|
if (first === "?") {
|
|
2980
2684
|
if (esc) {
|
|
@@ -2994,14 +2698,14 @@ var require_parse2 = __commonJS({
|
|
|
2994
2698
|
}
|
|
2995
2699
|
return star;
|
|
2996
2700
|
}
|
|
2997
|
-
return esc ?
|
|
2701
|
+
return esc ? m : `\\${m}`;
|
|
2998
2702
|
});
|
|
2999
2703
|
if (backslashes === true) {
|
|
3000
2704
|
if (opts.unescape === true) {
|
|
3001
2705
|
output = output.replace(/\\/g, "");
|
|
3002
2706
|
} else {
|
|
3003
|
-
output = output.replace(/\\+/g, (
|
|
3004
|
-
return
|
|
2707
|
+
output = output.replace(/\\+/g, (m) => {
|
|
2708
|
+
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
3005
2709
|
});
|
|
3006
2710
|
}
|
|
3007
2711
|
}
|
|
@@ -3648,7 +3352,7 @@ var require_picomatch = __commonJS({
|
|
|
3648
3352
|
};
|
|
3649
3353
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
3650
3354
|
picomatch.parse = (pattern, options) => {
|
|
3651
|
-
if (Array.isArray(pattern)) return pattern.map((
|
|
3355
|
+
if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
|
|
3652
3356
|
return parse2(pattern, { ...options, fastpaths: false });
|
|
3653
3357
|
};
|
|
3654
3358
|
picomatch.scan = (input, options) => scan(input, options);
|
|
@@ -3755,7 +3459,7 @@ var require_micromatch = __commonJS({
|
|
|
3755
3459
|
throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
|
3756
3460
|
}
|
|
3757
3461
|
if (options.nonull === true || options.nullglob === true) {
|
|
3758
|
-
return options.unescape ? patterns.map((
|
|
3462
|
+
return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
|
|
3759
3463
|
}
|
|
3760
3464
|
}
|
|
3761
3465
|
return matches;
|
|
@@ -3785,7 +3489,7 @@ var require_micromatch = __commonJS({
|
|
|
3785
3489
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
3786
3490
|
}
|
|
3787
3491
|
if (Array.isArray(pattern)) {
|
|
3788
|
-
return pattern.some((
|
|
3492
|
+
return pattern.some((p) => micromatch.contains(str, p, options));
|
|
3789
3493
|
}
|
|
3790
3494
|
if (typeof pattern === "string") {
|
|
3791
3495
|
if (isEmptyString(str) || isEmptyString(pattern)) {
|
|
@@ -3830,7 +3534,7 @@ var require_micromatch = __commonJS({
|
|
|
3830
3534
|
if (typeof str !== "string") {
|
|
3831
3535
|
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
3832
3536
|
}
|
|
3833
|
-
return [].concat(patterns).every((
|
|
3537
|
+
return [].concat(patterns).every((p) => picomatch(p, options)(str));
|
|
3834
3538
|
};
|
|
3835
3539
|
micromatch.capture = (glob, input, options) => {
|
|
3836
3540
|
let posix = utils.isWindows(options);
|
|
@@ -3981,7 +3685,7 @@ var require_pattern = __commonJS({
|
|
|
3981
3685
|
exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
|
|
3982
3686
|
function expandBraceExpansion(pattern) {
|
|
3983
3687
|
const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });
|
|
3984
|
-
patterns.sort((a,
|
|
3688
|
+
patterns.sort((a, b2) => a.length - b2.length);
|
|
3985
3689
|
return patterns.filter((pattern2) => pattern2 !== "");
|
|
3986
3690
|
}
|
|
3987
3691
|
exports.expandBraceExpansion = expandBraceExpansion;
|
|
@@ -4596,11 +4300,11 @@ var require_common = __commonJS({
|
|
|
4596
4300
|
init_utils();
|
|
4597
4301
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4598
4302
|
exports.joinPathSegments = void 0;
|
|
4599
|
-
function joinPathSegments(a,
|
|
4303
|
+
function joinPathSegments(a, b2, separator) {
|
|
4600
4304
|
if (a.endsWith(separator)) {
|
|
4601
|
-
return a +
|
|
4305
|
+
return a + b2;
|
|
4602
4306
|
}
|
|
4603
|
-
return a + separator +
|
|
4307
|
+
return a + separator + b2;
|
|
4604
4308
|
}
|
|
4605
4309
|
exports.joinPathSegments = joinPathSegments;
|
|
4606
4310
|
}
|
|
@@ -5136,7 +4840,7 @@ var require_queue = __commonJS({
|
|
|
5136
4840
|
queue.drained = drained;
|
|
5137
4841
|
return queue;
|
|
5138
4842
|
function push(value) {
|
|
5139
|
-
var
|
|
4843
|
+
var p = new Promise(function(resolve4, reject) {
|
|
5140
4844
|
pushCb(value, function(err, result) {
|
|
5141
4845
|
if (err) {
|
|
5142
4846
|
reject(err);
|
|
@@ -5145,11 +4849,11 @@ var require_queue = __commonJS({
|
|
|
5145
4849
|
resolve4(result);
|
|
5146
4850
|
});
|
|
5147
4851
|
});
|
|
5148
|
-
|
|
5149
|
-
return
|
|
4852
|
+
p.catch(noop);
|
|
4853
|
+
return p;
|
|
5150
4854
|
}
|
|
5151
4855
|
function unshift(value) {
|
|
5152
|
-
var
|
|
4856
|
+
var p = new Promise(function(resolve4, reject) {
|
|
5153
4857
|
unshiftCb(value, function(err, result) {
|
|
5154
4858
|
if (err) {
|
|
5155
4859
|
reject(err);
|
|
@@ -5158,11 +4862,11 @@ var require_queue = __commonJS({
|
|
|
5158
4862
|
resolve4(result);
|
|
5159
4863
|
});
|
|
5160
4864
|
});
|
|
5161
|
-
|
|
5162
|
-
return
|
|
4865
|
+
p.catch(noop);
|
|
4866
|
+
return p;
|
|
5163
4867
|
}
|
|
5164
4868
|
function drained() {
|
|
5165
|
-
var
|
|
4869
|
+
var p = new Promise(function(resolve4) {
|
|
5166
4870
|
process.nextTick(function() {
|
|
5167
4871
|
if (queue.idle()) {
|
|
5168
4872
|
resolve4();
|
|
@@ -5176,7 +4880,7 @@ var require_queue = __commonJS({
|
|
|
5176
4880
|
}
|
|
5177
4881
|
});
|
|
5178
4882
|
});
|
|
5179
|
-
return
|
|
4883
|
+
return p;
|
|
5180
4884
|
}
|
|
5181
4885
|
}
|
|
5182
4886
|
module.exports = fastqueue;
|
|
@@ -5206,14 +4910,14 @@ var require_common2 = __commonJS({
|
|
|
5206
4910
|
return filepath.split(/[/\\]/).join(separator);
|
|
5207
4911
|
}
|
|
5208
4912
|
exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
|
|
5209
|
-
function joinPathSegments(a,
|
|
4913
|
+
function joinPathSegments(a, b2, separator) {
|
|
5210
4914
|
if (a === "") {
|
|
5211
|
-
return
|
|
4915
|
+
return b2;
|
|
5212
4916
|
}
|
|
5213
4917
|
if (a.endsWith(separator)) {
|
|
5214
|
-
return a +
|
|
4918
|
+
return a + b2;
|
|
5215
4919
|
}
|
|
5216
|
-
return a + separator +
|
|
4920
|
+
return a + separator + b2;
|
|
5217
4921
|
}
|
|
5218
4922
|
exports.joinPathSegments = joinPathSegments;
|
|
5219
4923
|
}
|
|
@@ -7868,47 +7572,64 @@ var init_app_detection = __esm({
|
|
|
7868
7572
|
}
|
|
7869
7573
|
});
|
|
7870
7574
|
|
|
7871
|
-
// packages/tooling/src/utils/app-
|
|
7872
|
-
|
|
7873
|
-
const
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
if (
|
|
7882
|
-
|
|
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;
|
|
7575
|
+
// packages/tooling/src/utils/cross-app-detection.ts
|
|
7576
|
+
function detectBackendFromProviders(appDir) {
|
|
7577
|
+
for (const candidate of PROVIDERS_CANDIDATES) {
|
|
7578
|
+
const filePath = joinPath(appDir, candidate);
|
|
7579
|
+
if (!pathExists(filePath)) continue;
|
|
7580
|
+
const content = readSync(filePath, { format: "text" });
|
|
7581
|
+
if (typeof content !== "string") continue;
|
|
7582
|
+
if (content.includes("@donotdev/firebase") || content.includes("FirebaseAuth") || content.includes("firebaseAuth")) {
|
|
7583
|
+
return "firebase";
|
|
7584
|
+
}
|
|
7585
|
+
if (content.includes("@donotdev/supabase") || content.includes("SupabaseAuth") || content.includes("supabaseAuth")) {
|
|
7586
|
+
return "supabase";
|
|
7888
7587
|
}
|
|
7588
|
+
break;
|
|
7889
7589
|
}
|
|
7890
|
-
|
|
7891
|
-
|
|
7590
|
+
return null;
|
|
7591
|
+
}
|
|
7592
|
+
function analyzeProjectTopology(projectRoot) {
|
|
7593
|
+
const apps = detectApps(projectRoot);
|
|
7594
|
+
const appBackends = /* @__PURE__ */ new Map();
|
|
7595
|
+
const backendOwners = /* @__PURE__ */ new Map();
|
|
7596
|
+
for (const app of apps) {
|
|
7597
|
+
let backend = app.platform === "firebase" || app.platform === "supabase" ? app.platform : null;
|
|
7598
|
+
if (!backend) {
|
|
7599
|
+
backend = detectBackendFromProviders(app.path);
|
|
7600
|
+
}
|
|
7601
|
+
appBackends.set(app.name, backend);
|
|
7602
|
+
if (pathExists(joinPath(app.path, "supabase", "config.toml"))) {
|
|
7603
|
+
backendOwners.set("supabase", app);
|
|
7604
|
+
}
|
|
7605
|
+
if (pathExists(joinPath(app.path, "firebase.json")) || pathExists(joinPath(app.path, "functions", "firebase.json"))) {
|
|
7606
|
+
backendOwners.set("firebase", app);
|
|
7607
|
+
}
|
|
7892
7608
|
}
|
|
7893
|
-
|
|
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;
|
|
7609
|
+
if (!backendOwners.has("firebase") && (pathExists(joinPath(projectRoot, "firebase.json")) || pathExists(joinPath(projectRoot, ".firebaserc")))) {
|
|
7902
7610
|
}
|
|
7903
|
-
return apps
|
|
7611
|
+
return { apps, appBackends, backendOwners };
|
|
7612
|
+
}
|
|
7613
|
+
function findBackendApp(topology, appName) {
|
|
7614
|
+
const backend = topology.appBackends.get(appName);
|
|
7615
|
+
if (!backend) return void 0;
|
|
7616
|
+
return topology.backendOwners.get(backend);
|
|
7904
7617
|
}
|
|
7905
|
-
var
|
|
7906
|
-
|
|
7618
|
+
var PROVIDERS_CANDIDATES;
|
|
7619
|
+
var init_cross_app_detection = __esm({
|
|
7620
|
+
"packages/tooling/src/utils/cross-app-detection.ts"() {
|
|
7907
7621
|
"use strict";
|
|
7908
7622
|
init_utils();
|
|
7909
|
-
init_dist2();
|
|
7910
7623
|
init_app_detection();
|
|
7911
|
-
|
|
7624
|
+
init_pathResolver();
|
|
7625
|
+
PROVIDERS_CANDIDATES = [
|
|
7626
|
+
"src/config/providers.ts",
|
|
7627
|
+
"src/config/providers.tsx",
|
|
7628
|
+
"src/providers.ts",
|
|
7629
|
+
"src/providers.tsx",
|
|
7630
|
+
"src/lib/providers.ts",
|
|
7631
|
+
"src/lib/providers.tsx"
|
|
7632
|
+
];
|
|
7912
7633
|
}
|
|
7913
7634
|
});
|
|
7914
7635
|
|
|
@@ -8035,11 +7756,12 @@ var init_check_firebase = __esm({
|
|
|
8035
7756
|
"use strict";
|
|
8036
7757
|
init_utils();
|
|
8037
7758
|
init_pathResolver();
|
|
7759
|
+
init_cross_app_detection();
|
|
8038
7760
|
firebaseCheck = {
|
|
8039
7761
|
id: "firebase",
|
|
8040
7762
|
name: "Firebase",
|
|
8041
7763
|
isRelevant(ctx) {
|
|
8042
|
-
return pathExists(joinPath(ctx.appDir, "firebase.json")) || pathExists(joinPath(ctx.projectRoot, "firebase.json")) || pathExists(joinPath(ctx.projectRoot, ".firebaserc"));
|
|
7764
|
+
return pathExists(joinPath(ctx.appDir, "firebase.json")) || pathExists(joinPath(ctx.projectRoot, "firebase.json")) || pathExists(joinPath(ctx.projectRoot, ".firebaserc")) || detectBackendFromProviders(ctx.appDir) === "firebase";
|
|
8043
7765
|
},
|
|
8044
7766
|
async run(ctx) {
|
|
8045
7767
|
const results = [];
|
|
@@ -8143,7 +7865,7 @@ var init_check_firebase = __esm({
|
|
|
8143
7865
|
joinPath(ctx.appDir, "service-account-key.json"),
|
|
8144
7866
|
joinPath(ctx.projectRoot, "service-account-key.json")
|
|
8145
7867
|
];
|
|
8146
|
-
const saFound = saKeyPaths.some((
|
|
7868
|
+
const saFound = saKeyPaths.some((p) => pathExists(p));
|
|
8147
7869
|
if (saFound) {
|
|
8148
7870
|
results.push({
|
|
8149
7871
|
name: "Service account key",
|
|
@@ -8188,50 +7910,30 @@ var check_supabase_exports = {};
|
|
|
8188
7910
|
__export(check_supabase_exports, {
|
|
8189
7911
|
supabaseCheck: () => supabaseCheck
|
|
8190
7912
|
});
|
|
8191
|
-
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
8192
7913
|
var supabaseCheck;
|
|
8193
7914
|
var init_check_supabase = __esm({
|
|
8194
7915
|
"packages/tooling/src/cli/doctor/check-supabase.ts"() {
|
|
8195
7916
|
"use strict";
|
|
8196
7917
|
init_utils();
|
|
8197
7918
|
init_pathResolver();
|
|
7919
|
+
init_cross_app_detection();
|
|
8198
7920
|
init_supabase();
|
|
8199
7921
|
supabaseCheck = {
|
|
8200
7922
|
id: "supabase",
|
|
8201
7923
|
name: "Supabase",
|
|
8202
7924
|
isRelevant(ctx) {
|
|
8203
|
-
|
|
7925
|
+
if (pathExists(joinPath(ctx.appDir, "supabase"))) return true;
|
|
7926
|
+
if (pathExists(joinPath(ctx.appDir, "supabase", "config.toml")))
|
|
7927
|
+
return true;
|
|
7928
|
+
if (detectBackendFromProviders(ctx.appDir) === "supabase") return true;
|
|
7929
|
+
if (ctx.backendApp && pathExists(joinPath(ctx.backendApp.path, "supabase")))
|
|
7930
|
+
return true;
|
|
7931
|
+
return false;
|
|
8204
7932
|
},
|
|
8205
7933
|
async run(ctx) {
|
|
8206
7934
|
const results = [];
|
|
8207
7935
|
const framework = ctx.app?.framework === "nextjs" ? "nextjs" : "vite";
|
|
8208
7936
|
const prefix = framework === "nextjs" ? "NEXT_PUBLIC_" : "VITE_";
|
|
8209
|
-
try {
|
|
8210
|
-
const result = spawnSync2("supabase", ["--version"], {
|
|
8211
|
-
stdio: "pipe",
|
|
8212
|
-
encoding: "utf-8",
|
|
8213
|
-
timeout: 1e4
|
|
8214
|
-
});
|
|
8215
|
-
if (result.status === 0) {
|
|
8216
|
-
results.push({
|
|
8217
|
-
name: "Supabase CLI",
|
|
8218
|
-
status: "pass",
|
|
8219
|
-
message: result.stdout.trim()
|
|
8220
|
-
});
|
|
8221
|
-
} else {
|
|
8222
|
-
results.push({
|
|
8223
|
-
name: "Supabase CLI",
|
|
8224
|
-
status: "warn",
|
|
8225
|
-
message: "Not installed (needed for migrations)"
|
|
8226
|
-
});
|
|
8227
|
-
}
|
|
8228
|
-
} catch {
|
|
8229
|
-
results.push({
|
|
8230
|
-
name: "Supabase CLI",
|
|
8231
|
-
status: "warn",
|
|
8232
|
-
message: "Not installed"
|
|
8233
|
-
});
|
|
8234
|
-
}
|
|
8235
7937
|
const configPath = joinPath(ctx.appDir, "supabase", "config.toml");
|
|
8236
7938
|
if (pathExists(configPath)) {
|
|
8237
7939
|
results.push({ name: "config.toml", status: "pass", message: "Found" });
|
|
@@ -8295,188 +7997,29 @@ var init_check_supabase = __esm({
|
|
|
8295
7997
|
joinPath(ctx.appDir, "functions", ".env")
|
|
8296
7998
|
];
|
|
8297
7999
|
let secretFound = false;
|
|
8000
|
+
let dbUrlFound = false;
|
|
8298
8001
|
for (const fenvPath of functionsEnvCandidates) {
|
|
8299
8002
|
if (!pathExists(fenvPath)) continue;
|
|
8300
8003
|
const content = readSync(fenvPath, { format: "text" });
|
|
8301
|
-
if (typeof content
|
|
8004
|
+
if (typeof content !== "string") continue;
|
|
8005
|
+
if (content.match(/SUPABASE_(?:SECRET|SERVICE_ROLE)_KEY=.+/)) {
|
|
8302
8006
|
secretFound = true;
|
|
8303
|
-
results.push({
|
|
8304
|
-
name: "Secret key",
|
|
8305
|
-
status: "pass",
|
|
8306
|
-
message: `Found in ${fenvPath.split("/").pop()}`
|
|
8307
|
-
});
|
|
8308
|
-
break;
|
|
8309
8007
|
}
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
results.push({
|
|
8313
|
-
name: "Secret key",
|
|
8314
|
-
status: "warn",
|
|
8315
|
-
message: "Not found (needed for migrations + deploy)"
|
|
8316
|
-
});
|
|
8317
|
-
}
|
|
8318
|
-
return results;
|
|
8319
|
-
}
|
|
8320
|
-
};
|
|
8321
|
-
}
|
|
8322
|
-
});
|
|
8323
|
-
|
|
8324
|
-
// packages/tooling/src/cli/doctor/check-stripe.ts
|
|
8325
|
-
var check_stripe_exports = {};
|
|
8326
|
-
__export(check_stripe_exports, {
|
|
8327
|
-
stripeCheck: () => stripeCheck
|
|
8328
|
-
});
|
|
8329
|
-
function readEnvValue(envPath, varName) {
|
|
8330
|
-
if (!pathExists(envPath)) return null;
|
|
8331
|
-
const content = readSync(envPath, { format: "text" });
|
|
8332
|
-
if (typeof content !== "string") return null;
|
|
8333
|
-
for (const line of content.split(/\r?\n/)) {
|
|
8334
|
-
const trimmed = line.trim();
|
|
8335
|
-
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
8336
|
-
if (trimmed.startsWith(`${varName}=`)) {
|
|
8337
|
-
let val = trimmed.substring(`${varName}=`.length).trim();
|
|
8338
|
-
if (val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'")) {
|
|
8339
|
-
val = val.slice(1, -1);
|
|
8340
|
-
}
|
|
8341
|
-
return val || null;
|
|
8342
|
-
}
|
|
8343
|
-
}
|
|
8344
|
-
return null;
|
|
8345
|
-
}
|
|
8346
|
-
function findFunctionsEnv(ctx) {
|
|
8347
|
-
const candidates = [
|
|
8348
|
-
joinPath(ctx.appDir, "supabase", "functions", ".env"),
|
|
8349
|
-
joinPath(ctx.appDir, "functions", ".env")
|
|
8350
|
-
];
|
|
8351
|
-
return candidates.find((p2) => pathExists(p2)) ?? null;
|
|
8352
|
-
}
|
|
8353
|
-
var stripeCheck;
|
|
8354
|
-
var init_check_stripe = __esm({
|
|
8355
|
-
"packages/tooling/src/cli/doctor/check-stripe.ts"() {
|
|
8356
|
-
"use strict";
|
|
8357
|
-
init_utils();
|
|
8358
|
-
init_pathResolver();
|
|
8359
|
-
stripeCheck = {
|
|
8360
|
-
id: "stripe",
|
|
8361
|
-
name: "Stripe",
|
|
8362
|
-
isRelevant(ctx) {
|
|
8363
|
-
const pkgPath = joinPath(ctx.appDir, "package.json");
|
|
8364
|
-
if (pathExists(pkgPath)) {
|
|
8365
|
-
const pkg = readSync(pkgPath, { format: "json" });
|
|
8366
|
-
if (pkg && typeof pkg === "object") {
|
|
8367
|
-
const deps = pkg.dependencies;
|
|
8368
|
-
if (deps?.["@donotdev/billing"]) return true;
|
|
8369
|
-
}
|
|
8370
|
-
}
|
|
8371
|
-
const envPath = joinPath(ctx.appDir, ".env");
|
|
8372
|
-
if (pathExists(envPath)) {
|
|
8373
|
-
const content = readSync(envPath, { format: "text" });
|
|
8374
|
-
if (typeof content === "string" && content.includes("STRIPE_PUBLISHABLE_KEY"))
|
|
8375
|
-
return true;
|
|
8376
|
-
}
|
|
8377
|
-
return false;
|
|
8378
|
-
},
|
|
8379
|
-
async run(ctx) {
|
|
8380
|
-
const results = [];
|
|
8381
|
-
const framework = ctx.app?.framework ?? "vite";
|
|
8382
|
-
const prefix = framework === "nextjs" ? "NEXT_PUBLIC_" : "VITE_";
|
|
8383
|
-
const envPath = joinPath(ctx.appDir, ".env");
|
|
8384
|
-
const functionsEnvPath = findFunctionsEnv(ctx);
|
|
8385
|
-
const pk = readEnvValue(envPath, `${prefix}STRIPE_PUBLISHABLE_KEY`);
|
|
8386
|
-
let pkMode = null;
|
|
8387
|
-
if (pk) {
|
|
8388
|
-
if (pk.startsWith("pk_test_") || pk.startsWith("pk_live_")) {
|
|
8389
|
-
pkMode = pk.startsWith("pk_test_") ? "test" : "live";
|
|
8390
|
-
results.push({
|
|
8391
|
-
name: "Publishable key",
|
|
8392
|
-
status: "pass",
|
|
8393
|
-
message: `Valid (${pkMode} mode)`
|
|
8394
|
-
});
|
|
8395
|
-
} else {
|
|
8396
|
-
results.push({
|
|
8397
|
-
name: "Publishable key",
|
|
8398
|
-
status: "fail",
|
|
8399
|
-
message: "Invalid format \u2014 must start with pk_test_ or pk_live_"
|
|
8400
|
-
});
|
|
8401
|
-
}
|
|
8402
|
-
} else {
|
|
8403
|
-
results.push({
|
|
8404
|
-
name: "Publishable key",
|
|
8405
|
-
status: "fail",
|
|
8406
|
-
message: "Missing in .env"
|
|
8407
|
-
});
|
|
8408
|
-
}
|
|
8409
|
-
let skMode = null;
|
|
8410
|
-
if (functionsEnvPath) {
|
|
8411
|
-
const sk = readEnvValue(functionsEnvPath, "STRIPE_SECRET_KEY");
|
|
8412
|
-
if (sk) {
|
|
8413
|
-
if (sk.startsWith("sk_test_") || sk.startsWith("sk_live_") || sk.startsWith("rk_test_") || sk.startsWith("rk_live_")) {
|
|
8414
|
-
skMode = sk.includes("_test_") ? "test" : "live";
|
|
8415
|
-
results.push({
|
|
8416
|
-
name: "Secret key",
|
|
8417
|
-
status: "pass",
|
|
8418
|
-
message: `Valid (${skMode} mode)`
|
|
8419
|
-
});
|
|
8420
|
-
} else {
|
|
8421
|
-
results.push({
|
|
8422
|
-
name: "Secret key",
|
|
8423
|
-
status: "fail",
|
|
8424
|
-
message: "STRIPE_SECRET_KEY has invalid format"
|
|
8425
|
-
});
|
|
8426
|
-
}
|
|
8427
|
-
} else {
|
|
8428
|
-
results.push({
|
|
8429
|
-
name: "Secret key",
|
|
8430
|
-
status: "warn",
|
|
8431
|
-
message: "Not found in functions/.env"
|
|
8432
|
-
});
|
|
8433
|
-
}
|
|
8434
|
-
} else {
|
|
8435
|
-
results.push({
|
|
8436
|
-
name: "Secret key",
|
|
8437
|
-
status: "warn",
|
|
8438
|
-
message: "No functions/.env found"
|
|
8439
|
-
});
|
|
8440
|
-
}
|
|
8441
|
-
if (functionsEnvPath) {
|
|
8442
|
-
const wh = readEnvValue(functionsEnvPath, "STRIPE_WEBHOOK_SECRET");
|
|
8443
|
-
if (wh) {
|
|
8444
|
-
if (wh.startsWith("whsec_")) {
|
|
8445
|
-
results.push({
|
|
8446
|
-
name: "Webhook secret",
|
|
8447
|
-
status: "pass",
|
|
8448
|
-
message: "Valid format"
|
|
8449
|
-
});
|
|
8450
|
-
} else {
|
|
8451
|
-
results.push({
|
|
8452
|
-
name: "Webhook secret",
|
|
8453
|
-
status: "fail",
|
|
8454
|
-
message: "STRIPE_WEBHOOK_SECRET has invalid format"
|
|
8455
|
-
});
|
|
8456
|
-
}
|
|
8457
|
-
} else {
|
|
8458
|
-
results.push({
|
|
8459
|
-
name: "Webhook secret",
|
|
8460
|
-
status: "warn",
|
|
8461
|
-
message: "Not found \u2014 webhooks won't verify"
|
|
8462
|
-
});
|
|
8463
|
-
}
|
|
8464
|
-
}
|
|
8465
|
-
if (pkMode && skMode) {
|
|
8466
|
-
if (pkMode !== skMode) {
|
|
8467
|
-
results.push({
|
|
8468
|
-
name: "Key mode",
|
|
8469
|
-
status: "warn",
|
|
8470
|
-
message: `Publishable key is ${pkMode} but secret key is ${skMode}`
|
|
8471
|
-
});
|
|
8472
|
-
} else {
|
|
8473
|
-
results.push({
|
|
8474
|
-
name: "Key mode",
|
|
8475
|
-
status: "pass",
|
|
8476
|
-
message: `Both keys are ${pkMode}`
|
|
8477
|
-
});
|
|
8008
|
+
if (content.match(/SUPABASE_DB_URL=.+/)) {
|
|
8009
|
+
dbUrlFound = true;
|
|
8478
8010
|
}
|
|
8011
|
+
if (secretFound || dbUrlFound) break;
|
|
8479
8012
|
}
|
|
8013
|
+
results.push({
|
|
8014
|
+
name: "Secret key",
|
|
8015
|
+
status: secretFound ? "pass" : "fail",
|
|
8016
|
+
message: secretFound ? "Found in functions/.env" : "Missing SUPABASE_SECRET_KEY"
|
|
8017
|
+
});
|
|
8018
|
+
results.push({
|
|
8019
|
+
name: "DB URL",
|
|
8020
|
+
status: dbUrlFound ? "pass" : "fail",
|
|
8021
|
+
message: dbUrlFound ? "Found in functions/.env" : "Missing SUPABASE_DB_URL"
|
|
8022
|
+
});
|
|
8480
8023
|
return results;
|
|
8481
8024
|
}
|
|
8482
8025
|
};
|
|
@@ -8553,7 +8096,7 @@ var init_check_auth = __esm({
|
|
|
8553
8096
|
});
|
|
8554
8097
|
}
|
|
8555
8098
|
const hasFirebase = pathExists(joinPath(ctx.projectRoot, ".firebaserc"));
|
|
8556
|
-
const hasSupabase = pathExists(joinPath(ctx.appDir, "supabase"));
|
|
8099
|
+
const hasSupabase = pathExists(joinPath(ctx.appDir, "supabase")) || ctx.backendApp && pathExists(joinPath(ctx.backendApp.path, "supabase"));
|
|
8557
8100
|
if (hasFirebase) {
|
|
8558
8101
|
results.push({
|
|
8559
8102
|
name: "Backend",
|
|
@@ -8581,10 +8124,45 @@ var init_check_auth = __esm({
|
|
|
8581
8124
|
}
|
|
8582
8125
|
});
|
|
8583
8126
|
|
|
8127
|
+
// packages/cli/src/bin/commands/doctor.ts
|
|
8128
|
+
init_utils();
|
|
8129
|
+
|
|
8130
|
+
// packages/tooling/src/index.ts
|
|
8131
|
+
init_utils();
|
|
8132
|
+
|
|
8133
|
+
// packages/tooling/src/cli/index.ts
|
|
8134
|
+
init_utils();
|
|
8135
|
+
|
|
8584
8136
|
// packages/tooling/src/cli/doctor/doctor.ts
|
|
8585
|
-
|
|
8137
|
+
init_utils();
|
|
8138
|
+
init_cli_output();
|
|
8139
|
+
init_pathResolver();
|
|
8140
|
+
init_cross_app_detection();
|
|
8141
|
+
var CHECK_REGISTRY = [
|
|
8142
|
+
{ id: "env", load: async () => (await Promise.resolve().then(() => (init_check_env(), check_env_exports))).envCheck },
|
|
8143
|
+
{
|
|
8144
|
+
id: "firebase",
|
|
8145
|
+
load: async () => (await Promise.resolve().then(() => (init_check_firebase(), check_firebase_exports))).firebaseCheck
|
|
8146
|
+
},
|
|
8147
|
+
{
|
|
8148
|
+
id: "supabase",
|
|
8149
|
+
load: async () => (await Promise.resolve().then(() => (init_check_supabase(), check_supabase_exports))).supabaseCheck
|
|
8150
|
+
},
|
|
8151
|
+
{ id: "auth", load: async () => (await Promise.resolve().then(() => (init_check_auth(), check_auth_exports))).authCheck }
|
|
8152
|
+
];
|
|
8153
|
+
var STATUS_ICONS = {
|
|
8154
|
+
pass: "\u2705",
|
|
8155
|
+
warn: "\u26A0\uFE0F",
|
|
8156
|
+
fail: "\u274C"
|
|
8157
|
+
};
|
|
8158
|
+
function renderResults(allResults, verbose, multiApp) {
|
|
8586
8159
|
const lines = [];
|
|
8587
|
-
|
|
8160
|
+
let currentApp = "";
|
|
8161
|
+
for (const { appName, checkName, results } of allResults) {
|
|
8162
|
+
if (multiApp && appName !== currentApp) {
|
|
8163
|
+
currentApp = appName;
|
|
8164
|
+
lines.push(`\u2500\u2500 ${appName} \u2500\u2500`);
|
|
8165
|
+
}
|
|
8588
8166
|
lines.push(checkName);
|
|
8589
8167
|
for (const result of results) {
|
|
8590
8168
|
const icon = STATUS_ICONS[result.status];
|
|
@@ -8597,29 +8175,35 @@ function renderResults(allResults, verbose) {
|
|
|
8597
8175
|
}
|
|
8598
8176
|
Me(lines.join("\n"), "Health Check Results");
|
|
8599
8177
|
}
|
|
8178
|
+
function buildDoctorContext(app, projectRoot, topology, options) {
|
|
8179
|
+
const backendApp = findBackendApp(topology, app.name);
|
|
8180
|
+
return {
|
|
8181
|
+
projectRoot,
|
|
8182
|
+
appDir: app.path,
|
|
8183
|
+
app,
|
|
8184
|
+
verbose: options.verbose,
|
|
8185
|
+
allApps: topology.apps,
|
|
8186
|
+
backendApp
|
|
8187
|
+
};
|
|
8188
|
+
}
|
|
8600
8189
|
async function main(options = {}) {
|
|
8601
8190
|
Ie("DoNotDev Doctor");
|
|
8602
8191
|
const projectRoot = process.cwd();
|
|
8603
|
-
|
|
8604
|
-
let
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8192
|
+
const topology = analyzeProjectTopology(projectRoot);
|
|
8193
|
+
let apps = topology.apps;
|
|
8194
|
+
if (apps.length === 0) {
|
|
8195
|
+
apps = [
|
|
8196
|
+
{
|
|
8197
|
+
name: "root",
|
|
8198
|
+
packageName: "root",
|
|
8199
|
+
path: projectRoot,
|
|
8200
|
+
packageJsonPath: joinPath(projectRoot, "package.json"),
|
|
8201
|
+
framework: "vite",
|
|
8202
|
+
hasFunctions: false
|
|
8611
8203
|
}
|
|
8612
|
-
|
|
8613
|
-
}
|
|
8204
|
+
];
|
|
8614
8205
|
}
|
|
8615
|
-
const
|
|
8616
|
-
projectRoot,
|
|
8617
|
-
appDir,
|
|
8618
|
-
app,
|
|
8619
|
-
verbose: options.verbose
|
|
8620
|
-
};
|
|
8621
|
-
const allResults = [];
|
|
8622
|
-
let hasFail = false;
|
|
8206
|
+
const multiApp = apps.length > 1;
|
|
8623
8207
|
const registry = options.check ? CHECK_REGISTRY.filter((e2) => e2.id === options.check) : CHECK_REGISTRY;
|
|
8624
8208
|
if (options.check && registry.length === 0) {
|
|
8625
8209
|
log.error(
|
|
@@ -8628,13 +8212,18 @@ async function main(options = {}) {
|
|
|
8628
8212
|
Se("Doctor aborted.");
|
|
8629
8213
|
return 1;
|
|
8630
8214
|
}
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
const
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8215
|
+
const allResults = [];
|
|
8216
|
+
let hasFail = false;
|
|
8217
|
+
for (const app of apps) {
|
|
8218
|
+
const ctx = buildDoctorContext(app, projectRoot, topology, options);
|
|
8219
|
+
for (const entry of registry) {
|
|
8220
|
+
const check = await entry.load();
|
|
8221
|
+
if (!check.isRelevant(ctx)) continue;
|
|
8222
|
+
const results = await check.run(ctx);
|
|
8223
|
+
allResults.push({ appName: app.name, checkName: check.name, results });
|
|
8224
|
+
if (results.some((r2) => r2.status === "fail")) {
|
|
8225
|
+
hasFail = true;
|
|
8226
|
+
}
|
|
8638
8227
|
}
|
|
8639
8228
|
}
|
|
8640
8229
|
if (allResults.length === 0) {
|
|
@@ -8642,7 +8231,7 @@ async function main(options = {}) {
|
|
|
8642
8231
|
Se("Nothing to check.");
|
|
8643
8232
|
return 0;
|
|
8644
8233
|
}
|
|
8645
|
-
renderResults(allResults, options.verbose ?? false);
|
|
8234
|
+
renderResults(allResults, options.verbose ?? false, multiApp);
|
|
8646
8235
|
let passes = 0;
|
|
8647
8236
|
let warnings = 0;
|
|
8648
8237
|
let fails = 0;
|
|
@@ -8663,50 +8252,6 @@ async function main(options = {}) {
|
|
|
8663
8252
|
);
|
|
8664
8253
|
return exitCode;
|
|
8665
8254
|
}
|
|
8666
|
-
var CHECK_REGISTRY, STATUS_ICONS;
|
|
8667
|
-
var init_doctor = __esm({
|
|
8668
|
-
"packages/tooling/src/cli/doctor/doctor.ts"() {
|
|
8669
|
-
"use strict";
|
|
8670
|
-
init_utils();
|
|
8671
|
-
init_cli_output();
|
|
8672
|
-
init_app_selector();
|
|
8673
|
-
init_pathResolver();
|
|
8674
|
-
CHECK_REGISTRY = [
|
|
8675
|
-
{ id: "env", load: async () => (await Promise.resolve().then(() => (init_check_env(), check_env_exports))).envCheck },
|
|
8676
|
-
{
|
|
8677
|
-
id: "firebase",
|
|
8678
|
-
load: async () => (await Promise.resolve().then(() => (init_check_firebase(), check_firebase_exports))).firebaseCheck
|
|
8679
|
-
},
|
|
8680
|
-
{
|
|
8681
|
-
id: "supabase",
|
|
8682
|
-
load: async () => (await Promise.resolve().then(() => (init_check_supabase(), check_supabase_exports))).supabaseCheck
|
|
8683
|
-
},
|
|
8684
|
-
{
|
|
8685
|
-
id: "stripe",
|
|
8686
|
-
load: async () => (await Promise.resolve().then(() => (init_check_stripe(), check_stripe_exports))).stripeCheck
|
|
8687
|
-
},
|
|
8688
|
-
{ id: "auth", load: async () => (await Promise.resolve().then(() => (init_check_auth(), check_auth_exports))).authCheck }
|
|
8689
|
-
];
|
|
8690
|
-
STATUS_ICONS = {
|
|
8691
|
-
pass: "\u2705",
|
|
8692
|
-
// green check
|
|
8693
|
-
warn: "\u26A0\uFE0F",
|
|
8694
|
-
// warning
|
|
8695
|
-
fail: "\u274C"
|
|
8696
|
-
// red x
|
|
8697
|
-
};
|
|
8698
|
-
}
|
|
8699
|
-
});
|
|
8700
|
-
|
|
8701
|
-
// packages/cli/src/bin/commands/doctor.ts
|
|
8702
|
-
init_utils();
|
|
8703
|
-
|
|
8704
|
-
// packages/tooling/src/index.ts
|
|
8705
|
-
init_utils();
|
|
8706
|
-
|
|
8707
|
-
// packages/tooling/src/cli/index.ts
|
|
8708
|
-
init_utils();
|
|
8709
|
-
init_doctor();
|
|
8710
8255
|
export {
|
|
8711
8256
|
main
|
|
8712
8257
|
};
|