@hype-stack/cli 0.5.10 → 0.5.11
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/dist/{cli-BoOxL4ry.js → cli-DROj2oQA.js} +534 -491
- package/dist/config/bin.js +1 -1
- package/dist/core/codemods.d.ts +12 -0
- package/dist/core/codemods.d.ts.map +1 -1
- package/dist/core/installer.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/types/types.d.ts +2 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ import { Prompt as O } from "@clack/core";
|
|
|
13
13
|
import { styleText as k } from "node:util";
|
|
14
14
|
import { downloadTemplate as ee } from "giget";
|
|
15
15
|
//#region src/constants/constants.ts
|
|
16
|
-
var A = "0.5.
|
|
16
|
+
var A = "0.5.11", j = "gh:BetterTyped/hype-stack", te = "stack.json", ne = "/schema/stack.json", M = "https://api.hype-stack.dev", N = "HYPE_STACK_API_URL", P = "https://www.hype-stack.dev", re = /^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/, F = [
|
|
17
17
|
{
|
|
18
18
|
value: "cursor",
|
|
19
19
|
label: "Cursor",
|
|
@@ -335,11 +335,11 @@ var Se = Object.create, Ce = Object.defineProperty, we = Object.getOwnPropertyDe
|
|
|
335
335
|
isFocused;
|
|
336
336
|
constructor(e) {
|
|
337
337
|
this.options = e, this.emitter?.setMaxListeners(1e3);
|
|
338
|
-
let { initiallyFocused: t =
|
|
338
|
+
let { initiallyFocused: t = H.initiallyFocused, initiallyOnline: n = H.initiallyOnline } = this.options || H;
|
|
339
339
|
this.setInitialFocus(t), this.setInitialOnline(n), this.isBrowser = Le();
|
|
340
340
|
}
|
|
341
341
|
initialize = () => {
|
|
342
|
-
let { focusEvent: e =
|
|
342
|
+
let { focusEvent: e = H.focusEvent, onlineEvent: t = H.onlineEvent } = this.options || H;
|
|
343
343
|
e(this.setFocused), t(this.setOnline);
|
|
344
344
|
};
|
|
345
345
|
setInitialFocus = async (e) => {
|
|
@@ -387,7 +387,7 @@ var Se = Object.create, Ce = Object.defineProperty, we = Object.getOwnPropertyDe
|
|
|
387
387
|
onOffline: (t) => (e.on(V.OFFLINE, t), () => e.removeListener(V.OFFLINE, t))
|
|
388
388
|
}), V = /* @__PURE__ */ function(e) {
|
|
389
389
|
return e.FOCUS = "focus", e.BLUR = "blur", e.ONLINE = "online", e.OFFLINE = "offline", e;
|
|
390
|
-
}({}),
|
|
390
|
+
}({}), H = {
|
|
391
391
|
initiallyFocused: !0,
|
|
392
392
|
initiallyOnline: !0,
|
|
393
393
|
focusEvent: (e) => {
|
|
@@ -396,9 +396,9 @@ var Se = Object.create, Ce = Object.defineProperty, we = Object.getOwnPropertyDe
|
|
|
396
396
|
onlineEvent: (e) => {
|
|
397
397
|
Re("online", () => e(!0)), Re("offline", () => e(!1));
|
|
398
398
|
}
|
|
399
|
-
},
|
|
399
|
+
}, Ve = class {
|
|
400
400
|
emitter = new Pe();
|
|
401
|
-
events =
|
|
401
|
+
events = _t(this.emitter);
|
|
402
402
|
constructor() {
|
|
403
403
|
this.emitter?.setMaxListeners(1e3);
|
|
404
404
|
}
|
|
@@ -435,71 +435,71 @@ var Se = Object.create, Ce = Object.defineProperty, we = Object.getOwnPropertyDe
|
|
|
435
435
|
});
|
|
436
436
|
});
|
|
437
437
|
};
|
|
438
|
-
},
|
|
438
|
+
}, He = () => "loading-event-any", Ue = (e) => `${e}-loading-event`, We = (e) => `${e}-loading-cache-event`, Ge = (e) => `${e}-loading-event-by-id`, Ke = () => "remove-event-any", qe = (e) => `${e}-remove-event`, Je = (e) => `${e}-remove-event-by-id`, Ye = () => "request-abort-any", Xe = (e) => `${e}-request-abort`, Ze = (e) => `${e}-request-abort-by-id`, Qe = () => "response-any", $e = (e) => `${e}-response`, et = (e) => `${e}-response-by-id`, tt = () => "request-start-any", nt = (e) => `${e}-request-start`, rt = (e) => `${e}-request-start-by-id`, it = () => "response-start-any", at = (e) => `${e}-response-start`, ot = (e) => `${e}-response-start-by-id`, st = () => "request-progress-any", ct = (e) => `${e}-request-progress`, lt = (e) => `${e}-request-progress-by-id`, ut = () => "response-progress-any", dt = (e) => `${e}-response-progress`, ft = (e) => `${e}-response-progress-by-id`, pt = () => "request-deduplicated-any", mt = (e) => `${e}-query-request-deduplicated`, ht = (e) => `${e}-cache-request-deduplicated`, gt = (e) => `${e}-request-deduplicated-by-id`, _t = (e) => ({
|
|
439
439
|
emitDeduplicated: (t, n = !1) => {
|
|
440
|
-
e.emit(
|
|
440
|
+
e.emit(pt(), t, n), e.emit(gt(t.requestId), t, n), e.emit(ht(t.request.cacheKey), t, n), e.emit(mt(t.request.queryKey), t, n);
|
|
441
441
|
},
|
|
442
442
|
emitLoading: (t, n = !1) => {
|
|
443
|
-
e.emit(
|
|
443
|
+
e.emit(He(), t, n), e.emit(Ge(t.requestId), t, n), e.emit(We(t.request.cacheKey), t, n), e.emit(Ue(t.request.queryKey), t, n);
|
|
444
444
|
},
|
|
445
445
|
emitRequestStart: (t, n = !1) => {
|
|
446
|
-
e.emit(
|
|
446
|
+
e.emit(tt(), t, n), e.emit(rt(t.requestId), t, n), e.emit(nt(t.request.queryKey), t, n);
|
|
447
447
|
},
|
|
448
448
|
emitResponseStart: (t, n = !1) => {
|
|
449
|
-
e.emit(
|
|
449
|
+
e.emit(it(), t, n), e.emit(ot(t.requestId), t, n), e.emit(at(t.request.queryKey), t, n);
|
|
450
450
|
},
|
|
451
451
|
emitUploadProgress: (t, n = !1) => {
|
|
452
|
-
e.emit(
|
|
452
|
+
e.emit(st(), t, n), e.emit(lt(t.requestId), t, n), e.emit(ct(t.request.queryKey), t, n);
|
|
453
453
|
},
|
|
454
454
|
emitDownloadProgress: (t, n = !1) => {
|
|
455
|
-
e.emit(
|
|
455
|
+
e.emit(ut(), t, n), e.emit(ft(t.requestId), t, n), e.emit(dt(t.request.queryKey), t, n);
|
|
456
456
|
},
|
|
457
457
|
emitResponse: (t, n = !1) => {
|
|
458
|
-
e.emit(
|
|
458
|
+
e.emit(Qe(), t, n), e.emit(et(t.requestId), t, n), e.emit($e(t.request.cacheKey), t, n);
|
|
459
459
|
},
|
|
460
460
|
emitAbort: (t, n = !1) => {
|
|
461
|
-
e.emit(
|
|
461
|
+
e.emit(Ye(), t, n), e.emit(Ze(t.requestId), t, n), e.emit(Xe(t.request.abortKey), t, n);
|
|
462
462
|
},
|
|
463
463
|
emitRemove: (t, n = !1) => {
|
|
464
|
-
e.emit(
|
|
464
|
+
e.emit(Ke(), t, n), e.emit(Je(t.requestId), t, n), e.emit(qe(t.request.queryKey), t, n);
|
|
465
465
|
},
|
|
466
|
-
onDeduplicated: (t) => (e.on(
|
|
467
|
-
onDeduplicatedByQueue: (t, n) => (e.on(
|
|
468
|
-
onDeduplicatedByCache: (t, n) => (e.on(
|
|
469
|
-
onDeduplicatedById: (t, n) => (e.on(
|
|
470
|
-
onLoading: (t) => (e.on(
|
|
471
|
-
onLoadingByQueue: (t, n) => (e.on(
|
|
472
|
-
onLoadingByCache: (t, n) => (e.on(
|
|
473
|
-
onLoadingById: (t, n) => (e.on(
|
|
474
|
-
onRequestStart: (t) => (e.on(
|
|
475
|
-
onRequestStartByQueue: (t, n) => (e.on(
|
|
476
|
-
onRequestStartById: (t, n) => (e.on(
|
|
477
|
-
onResponseStart: (t) => (e.on(
|
|
478
|
-
onResponseStartByQueue: (t, n) => (e.on(
|
|
479
|
-
onResponseStartById: (t, n) => (e.on(
|
|
480
|
-
onUploadProgress: (t) => (e.on(
|
|
481
|
-
onUploadProgressByQueue: (t, n) => (e.on(
|
|
482
|
-
onUploadProgressById: (t, n) => (e.on(
|
|
483
|
-
onDownloadProgress: (t) => (e.on(
|
|
484
|
-
onDownloadProgressByQueue: (t, n) => (e.on(
|
|
485
|
-
onDownloadProgressById: (t, n) => (e.on(
|
|
486
|
-
onResponse: (t) => (e.on(
|
|
487
|
-
onResponseByCache: (t, n) => (e.on(
|
|
488
|
-
onResponseById: (t, n) => (e.on(
|
|
489
|
-
onAbort: (t) => (e.on(
|
|
490
|
-
onAbortByKey: (t, n) => (e.on(
|
|
491
|
-
onAbortById: (t, n) => (e.on(
|
|
492
|
-
onRemove: (t) => (e.on(
|
|
493
|
-
onRemoveByQueue: (t, n) => (e.on(
|
|
494
|
-
onRemoveById: (t, n) => (e.on(
|
|
495
|
-
}),
|
|
466
|
+
onDeduplicated: (t) => (e.on(pt(), t), () => e.removeListener(pt(), t)),
|
|
467
|
+
onDeduplicatedByQueue: (t, n) => (e.on(mt(t), n), () => e.removeListener(mt(t), n)),
|
|
468
|
+
onDeduplicatedByCache: (t, n) => (e.on(ht(t), n), () => e.removeListener(ht(t), n)),
|
|
469
|
+
onDeduplicatedById: (t, n) => (e.on(gt(t), n), () => e.removeListener(gt(t), n)),
|
|
470
|
+
onLoading: (t) => (e.on(He(), t), () => e.removeListener(He(), t)),
|
|
471
|
+
onLoadingByQueue: (t, n) => (e.on(Ue(t), n), () => e.removeListener(Ue(t), n)),
|
|
472
|
+
onLoadingByCache: (t, n) => (e.on(We(t), n), () => e.removeListener(We(t), n)),
|
|
473
|
+
onLoadingById: (t, n) => (e.on(Ge(t), n), () => e.removeListener(Ge(t), n)),
|
|
474
|
+
onRequestStart: (t) => (e.on(tt(), t), () => e.removeListener(tt(), t)),
|
|
475
|
+
onRequestStartByQueue: (t, n) => (e.on(nt(t), n), () => e.removeListener(nt(t), n)),
|
|
476
|
+
onRequestStartById: (t, n) => (e.on(rt(t), n), () => e.removeListener(rt(t), n)),
|
|
477
|
+
onResponseStart: (t) => (e.on(it(), t), () => e.removeListener(it(), t)),
|
|
478
|
+
onResponseStartByQueue: (t, n) => (e.on(at(t), n), () => e.removeListener(at(t), n)),
|
|
479
|
+
onResponseStartById: (t, n) => (e.on(ot(t), n), () => e.removeListener(ot(t), n)),
|
|
480
|
+
onUploadProgress: (t) => (e.on(st(), t), () => e.removeListener(st(), t)),
|
|
481
|
+
onUploadProgressByQueue: (t, n) => (e.on(ct(t), n), () => e.removeListener(ct(t), n)),
|
|
482
|
+
onUploadProgressById: (t, n) => (e.on(lt(t), n), () => e.removeListener(lt(t), n)),
|
|
483
|
+
onDownloadProgress: (t) => (e.on(ut(), t), () => e.removeListener(ut(), t)),
|
|
484
|
+
onDownloadProgressByQueue: (t, n) => (e.on(dt(t), n), () => e.removeListener(dt(t), n)),
|
|
485
|
+
onDownloadProgressById: (t, n) => (e.on(ft(t), n), () => e.removeListener(ft(t), n)),
|
|
486
|
+
onResponse: (t) => (e.on(Qe(), t), () => e.removeListener(Qe(), t)),
|
|
487
|
+
onResponseByCache: (t, n) => (e.on($e(t), n), () => e.removeListener($e(t), n)),
|
|
488
|
+
onResponseById: (t, n) => (e.on(et(t), n), () => e.removeListener(et(t), n)),
|
|
489
|
+
onAbort: (t) => (e.on(Ye(), t), () => e.removeListener(Ye(), t)),
|
|
490
|
+
onAbortByKey: (t, n) => (e.on(Xe(t), n), () => e.removeListener(Xe(t), n)),
|
|
491
|
+
onAbortById: (t, n) => (e.on(Ze(t), n), () => e.removeListener(Ze(t), n)),
|
|
492
|
+
onRemove: (t) => (e.on(Ke(), t), () => e.removeListener(Ke(), t)),
|
|
493
|
+
onRemoveByQueue: (t, n) => (e.on(qe(t), n), () => e.removeListener(qe(t), n)),
|
|
494
|
+
onRemoveById: (t, n) => (e.on(Je(t), n), () => e.removeListener(Je(t), n))
|
|
495
|
+
}), vt = class {
|
|
496
496
|
logger;
|
|
497
497
|
level;
|
|
498
498
|
modules;
|
|
499
499
|
emitter = new Me.default();
|
|
500
500
|
client;
|
|
501
501
|
constructor(e) {
|
|
502
|
-
this.options = e, this.emitter?.setMaxListeners(1e3), this.logger = this.options?.logger ||
|
|
502
|
+
this.options = e, this.emitter?.setMaxListeners(1e3), this.logger = this.options?.logger || xt, this.level = this.options?.level || "warning", this.modules = this.options?.modules;
|
|
503
503
|
}
|
|
504
504
|
setSeverity = (e) => {
|
|
505
505
|
this.level = e;
|
|
@@ -530,49 +530,49 @@ var Se = Object.create, Ce = Object.defineProperty, we = Object.getOwnPropertyDe
|
|
|
530
530
|
})
|
|
531
531
|
});
|
|
532
532
|
log = (e) => {
|
|
533
|
-
this.client.debug && (
|
|
533
|
+
this.client.debug && (St.indexOf(this.level) <= St.indexOf(e.level) || this.modules && !this.modules.includes(e.module) || this.logger(e));
|
|
534
534
|
};
|
|
535
|
-
},
|
|
536
|
-
let t =
|
|
535
|
+
}, yt = () => `${(/* @__PURE__ */ new Date()).toLocaleTimeString()}`, bt = (e) => e.type === "request" || e.type === "response" ? `${e.extra.request.endpoint}` : `[${e.module}]`, xt = (e) => {
|
|
536
|
+
let t = wt[e.level], n = Tt[e.level], r = `%c[${yt()}]%c${e.title}%c${bt(e)}`, i = `${t}${n}font-weight:600;border-radius: 4px 0 0 4px;`, a = `${t}${n}font-weight:600;`, o = `${t}font-weight:normal;border-radius: 0 4px 4px 0;`;
|
|
537
537
|
e.extra && Object.keys(e.extra)?.length ? (console.groupCollapsed(r, i, a, o), console.log(e.extra), console.groupEnd()) : console.log(r, t);
|
|
538
|
-
},
|
|
538
|
+
}, St = [
|
|
539
539
|
"error",
|
|
540
540
|
"warning",
|
|
541
541
|
"info",
|
|
542
542
|
"debug"
|
|
543
|
-
],
|
|
544
|
-
error: `${
|
|
545
|
-
warning: `${
|
|
546
|
-
info: `${
|
|
547
|
-
debug: `${
|
|
548
|
-
},
|
|
543
|
+
], Ct = "padding:2px 5px;", wt = {
|
|
544
|
+
error: `${Ct};background:#db252520;`,
|
|
545
|
+
warning: `${Ct};background:#e1941e20;`,
|
|
546
|
+
info: `${Ct};background:#1e74e120;`,
|
|
547
|
+
debug: `${Ct};background:#00000020;`
|
|
548
|
+
}, Tt = {
|
|
549
549
|
error: "color:#ff3737;",
|
|
550
550
|
warning: "color:#ffc107;",
|
|
551
551
|
info: "color:#34a8ff;",
|
|
552
552
|
debug: "color:#cccccc;"
|
|
553
|
-
},
|
|
553
|
+
}, Et = class extends Error {
|
|
554
554
|
constructor() {
|
|
555
555
|
super("Request timeout"), this.name = "TimeoutError";
|
|
556
556
|
}
|
|
557
|
-
},
|
|
557
|
+
}, Dt = class extends Error {
|
|
558
558
|
constructor() {
|
|
559
559
|
super("Request aborted"), this.name = "AbortError";
|
|
560
560
|
}
|
|
561
|
-
},
|
|
561
|
+
}, Ot = class extends Error {
|
|
562
562
|
constructor() {
|
|
563
563
|
super("Request deleted"), this.name = "DeletedError";
|
|
564
564
|
}
|
|
565
|
-
},
|
|
565
|
+
}, kt = class extends Error {
|
|
566
566
|
description;
|
|
567
567
|
constructor(e) {
|
|
568
568
|
super("Request processing error"), this.description = e, this.name = "RequestProcessingError";
|
|
569
569
|
}
|
|
570
|
-
},
|
|
570
|
+
}, At = class extends Error {
|
|
571
571
|
description;
|
|
572
572
|
constructor(e) {
|
|
573
573
|
super("Unexpected error"), this.description = e, this.name = "UnexpectedError";
|
|
574
574
|
}
|
|
575
|
-
},
|
|
575
|
+
}, jt = (e) => e === "timeout" ? new Et() : e === "abort" ? new Dt() : e === "deleted" ? new Ot() : e === "processing" ? new kt() : new At(), Mt = (e) => {
|
|
576
576
|
try {
|
|
577
577
|
return JSON.stringify(e);
|
|
578
578
|
} catch {
|
|
@@ -748,7 +748,7 @@ var Lt = /* @__PURE__ */ function(e) {
|
|
|
748
748
|
data: null,
|
|
749
749
|
status: null,
|
|
750
750
|
success: !1,
|
|
751
|
-
error:
|
|
751
|
+
error: jt("deleted"),
|
|
752
752
|
extra: e.client.adapter.defaultExtra,
|
|
753
753
|
requestTimestamp: +/* @__PURE__ */ new Date(),
|
|
754
754
|
responseTimestamp: +/* @__PURE__ */ new Date()
|
|
@@ -1067,14 +1067,14 @@ var Lt = /* @__PURE__ */ function(e) {
|
|
|
1067
1067
|
requestId: t,
|
|
1068
1068
|
request: d
|
|
1069
1069
|
}), u;
|
|
1070
|
-
},
|
|
1070
|
+
}, j = (e) => {
|
|
1071
1071
|
u ||= +/* @__PURE__ */ new Date();
|
|
1072
1072
|
let t = +/* @__PURE__ */ new Date();
|
|
1073
1073
|
return p = w(p, e), E(u, t, {
|
|
1074
1074
|
total: e.total || p,
|
|
1075
1075
|
loaded: e.loaded || 0
|
|
1076
1076
|
}), t;
|
|
1077
|
-
},
|
|
1077
|
+
}, te = () => {
|
|
1078
1078
|
u ||= +/* @__PURE__ */ new Date();
|
|
1079
1079
|
let e = +/* @__PURE__ */ new Date();
|
|
1080
1080
|
return E(u, e, {
|
|
@@ -1120,7 +1120,7 @@ var Lt = /* @__PURE__ */ function(e) {
|
|
|
1120
1120
|
requestId: t
|
|
1121
1121
|
}
|
|
1122
1122
|
}), M({
|
|
1123
|
-
error: i(
|
|
1123
|
+
error: i(jt("abort")),
|
|
1124
1124
|
status: e,
|
|
1125
1125
|
extra: n
|
|
1126
1126
|
})), P = ({ status: e, extra: n }) => (c.error({
|
|
@@ -1131,7 +1131,7 @@ var Lt = /* @__PURE__ */ function(e) {
|
|
|
1131
1131
|
requestId: t
|
|
1132
1132
|
}
|
|
1133
1133
|
}), M({
|
|
1134
|
-
error:
|
|
1134
|
+
error: jt("timeout"),
|
|
1135
1135
|
status: e,
|
|
1136
1136
|
extra: n
|
|
1137
1137
|
})), re = ({ status: e, extra: n }) => (c.error({
|
|
@@ -1142,12 +1142,12 @@ var Lt = /* @__PURE__ */ function(e) {
|
|
|
1142
1142
|
requestId: t
|
|
1143
1143
|
}
|
|
1144
1144
|
}), M({
|
|
1145
|
-
error:
|
|
1145
|
+
error: jt(),
|
|
1146
1146
|
status: e,
|
|
1147
1147
|
extra: n
|
|
1148
1148
|
})), F = () => a.getAbortController(v, t), ie = ({ status: e, extra: n, onAbort: r = () => {} }) => {
|
|
1149
1149
|
let i = F();
|
|
1150
|
-
if (!i) throw new
|
|
1150
|
+
if (!i) throw new kt("Controller is not found");
|
|
1151
1151
|
let o = () => {
|
|
1152
1152
|
N({
|
|
1153
1153
|
status: e,
|
|
@@ -1189,8 +1189,8 @@ var Lt = /* @__PURE__ */ function(e) {
|
|
|
1189
1189
|
onRequestProgress: k,
|
|
1190
1190
|
onRequestEnd: ee,
|
|
1191
1191
|
onResponseStart: A,
|
|
1192
|
-
onResponseProgress:
|
|
1193
|
-
onResponseEnd:
|
|
1192
|
+
onResponseProgress: j,
|
|
1193
|
+
onResponseEnd: te,
|
|
1194
1194
|
onSuccess: ne,
|
|
1195
1195
|
onAbortError: N,
|
|
1196
1196
|
onTimeoutError: P,
|
|
@@ -1228,7 +1228,7 @@ function Xt({ request: e, requestId: t, startTime: n, resolve: r, logger: i }) {
|
|
|
1228
1228
|
};
|
|
1229
1229
|
}
|
|
1230
1230
|
var Zt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTimeoutError: i, onRequestEnd: a, createAbortListener: o, onResponseProgress: s, onRequestProgress: c, onResponseStart: l, onBeforeRequest: u, onRequestStart: d, onSuccess: f, onAbortError: p, adapter: m }) => {
|
|
1231
|
-
if (!e.unstable_mock) throw new
|
|
1231
|
+
if (!e.unstable_mock) throw new kt("Mock should be defined when calling mocker");
|
|
1232
1232
|
let h = !1, { requestTime: g = 20, responseTime: _ = 20, totalUploaded: v = 1e3, totalDownloaded: y = 1e3, timeout: b } = e.unstable_mock.config, { data: x, error: S, status: C, success: w = !0, extra: T = e.client.adapter.defaultExtra } = await e.unstable_mock.fn({
|
|
1233
1233
|
request: e,
|
|
1234
1234
|
requestId: t
|
|
@@ -1321,8 +1321,8 @@ var Zt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
|
|
|
1321
1321
|
async fetch(e, t) {
|
|
1322
1322
|
let n, r = async (r) => {
|
|
1323
1323
|
try {
|
|
1324
|
-
if (!this.initialized) throw new
|
|
1325
|
-
if (!this.unstable_fetcher) throw new
|
|
1324
|
+
if (!this.initialized) throw new kt(`Adapter ${this.options.name} is not initialized`);
|
|
1325
|
+
if (!this.unstable_fetcher) throw new kt(`Fetcher for ${this.options.name} adapter is not set`);
|
|
1326
1326
|
this.client.triggerPlugins("onAdapterFetch", {
|
|
1327
1327
|
adapter: this,
|
|
1328
1328
|
request: e,
|
|
@@ -1362,7 +1362,7 @@ var Zt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
|
|
|
1362
1362
|
} catch {
|
|
1363
1363
|
return e;
|
|
1364
1364
|
}
|
|
1365
|
-
}, tn = (e) => e ? en(e) :
|
|
1365
|
+
}, tn = (e) => e ? en(e) : jt(), nn = (e) => (t) => {
|
|
1366
1366
|
let { skipNull: n, skipEmptyString: r } = e;
|
|
1367
1367
|
return !(r && t === void 0 || r && t === "" || n && t === null);
|
|
1368
1368
|
}, W = (e, { encode: t, strict: n }) => t && n ? encodeURIComponent(e).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`) : t ? encodeURIComponent(e) : e, rn = (e, t, n) => {
|
|
@@ -1940,7 +1940,7 @@ var Zt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
|
|
|
1940
1940
|
}), this.incrementQueueRequestCount(l), f.addAbortController(u, n);
|
|
1941
1941
|
let b = await d.fetch(t, n);
|
|
1942
1942
|
e.resolved = !0, f.removeAbortController(u, n);
|
|
1943
|
-
let x = !m.isOnline, S =
|
|
1943
|
+
let x = !m.isOnline, S = jt("abort").message === b.error?.message, C = !this.hasRunningRequest(l, n) || S;
|
|
1944
1944
|
this.deleteRunningRequest(l, n);
|
|
1945
1945
|
let w = b.success || !h || !t.retryOnError || t.retryOnError(b), T = !b.success && h && w && !C && !x, E = {
|
|
1946
1946
|
isCanceled: C,
|
|
@@ -2082,8 +2082,8 @@ var Mn = async (e, t) => {
|
|
|
2082
2082
|
unstable_onResponseCallbacks = [];
|
|
2083
2083
|
unstable_onAuthCallbacks = [];
|
|
2084
2084
|
unstable_onRequestCallbacks = [];
|
|
2085
|
-
loggerManager = new
|
|
2086
|
-
requestManager = new
|
|
2085
|
+
loggerManager = new vt();
|
|
2086
|
+
requestManager = new Ve();
|
|
2087
2087
|
appManager;
|
|
2088
2088
|
adapter;
|
|
2089
2089
|
cache;
|
|
@@ -2623,13 +2623,13 @@ function Dr(e) {
|
|
|
2623
2623
|
//#endregion
|
|
2624
2624
|
//#region src/core/stack-config.ts
|
|
2625
2625
|
async function Or(e) {
|
|
2626
|
-
return sr(T.join(e,
|
|
2626
|
+
return sr(T.join(e, te));
|
|
2627
2627
|
}
|
|
2628
2628
|
async function kr(e) {
|
|
2629
|
-
return J(T.join(e,
|
|
2629
|
+
return J(T.join(e, te));
|
|
2630
2630
|
}
|
|
2631
2631
|
async function Ar(e, t) {
|
|
2632
|
-
await cr(T.join(e,
|
|
2632
|
+
await cr(T.join(e, te), t);
|
|
2633
2633
|
}
|
|
2634
2634
|
async function jr(e) {
|
|
2635
2635
|
let t = T.join(e, "apps"), n = T.join(e, "packages"), [r, i] = await Promise.all([lr(t), lr(n)]);
|
|
@@ -2895,13 +2895,56 @@ function ii(e, t) {
|
|
|
2895
2895
|
return i === -1 ? e : e.slice(0, i) + n + "\n" + e.slice(i);
|
|
2896
2896
|
}
|
|
2897
2897
|
async function ai(e, t, n) {
|
|
2898
|
-
let r = T.resolve(n, X("{{
|
|
2898
|
+
let r = T.resolve(n, X("{{backend.root}}", t), "src/context.ts");
|
|
2899
2899
|
if (!await J(r)) return;
|
|
2900
2900
|
let i = await y.readFile(r, "utf-8");
|
|
2901
|
-
for (let t of e) i
|
|
2901
|
+
for (let t of e) i = oi(i, t);
|
|
2902
2902
|
await y.writeFile(r, i, "utf-8");
|
|
2903
2903
|
}
|
|
2904
2904
|
function oi(e, t) {
|
|
2905
|
+
let n = si(t), r = RegExp(`^[ \\t]*export let ${n}[ \\t]*:[ \\t]*([^;\\n]+);[ \\t]*$`, "m"), i = e.match(r)?.[1] ?? "", a = e;
|
|
2906
|
+
a = ci(a, r), a = ci(a, RegExp(`^[ \\t]*${n}[ \\t]*:[ \\t]*[^;\\n]+;[ \\t]*$`, "m")), a = ci(a, RegExp(`^[ \\t]*${n}[ \\t]*=[ \\t]*[^;\\n]*;[ \\t]*$`, "m"));
|
|
2907
|
+
for (let e of li(i)) ui(a, e) || (a = di(a, e));
|
|
2908
|
+
return a;
|
|
2909
|
+
}
|
|
2910
|
+
function si(e) {
|
|
2911
|
+
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2912
|
+
}
|
|
2913
|
+
function ci(e, t) {
|
|
2914
|
+
let n = t.exec(e);
|
|
2915
|
+
if (!n || n.index === void 0) return e;
|
|
2916
|
+
let r = n.index, i = r + n[0].length;
|
|
2917
|
+
return e[i] === "\n" && (i += 1), e.slice(0, r) + e.slice(i);
|
|
2918
|
+
}
|
|
2919
|
+
function li(e) {
|
|
2920
|
+
let t = e.match(/[A-Za-z_$][A-Za-z0-9_$]*/g) ?? [];
|
|
2921
|
+
return [...new Set(t)];
|
|
2922
|
+
}
|
|
2923
|
+
function ui(e, t) {
|
|
2924
|
+
let n = RegExp(`\\b${si(t)}\\b`);
|
|
2925
|
+
return e.split("\n").filter((e) => !e.trimStart().startsWith("import ")).some((e) => n.test(e));
|
|
2926
|
+
}
|
|
2927
|
+
function di(e, t) {
|
|
2928
|
+
let n = RegExp(`\\b${si(t)}\\b`);
|
|
2929
|
+
return e.split("\n").flatMap((e) => {
|
|
2930
|
+
if (!e.trimStart().startsWith("import ") || !n.test(e)) return [e];
|
|
2931
|
+
let r = e.match(/^(\s*import\s+(?:type\s+)?)\{([^}]*)\}(\s+from\s+["'][^"']+["'];?\s*)$/);
|
|
2932
|
+
if (r) {
|
|
2933
|
+
let e = r[2].split(",").map((e) => e.trim()).filter(Boolean).filter((e) => e.replace(/^type\s+/, "") !== t);
|
|
2934
|
+
return e.length === 0 ? [] : [`${r[1]}{ ${e.join(", ")} }${r[3]}`];
|
|
2935
|
+
}
|
|
2936
|
+
let i = e.match(/^\s*import\s+(?:type\s+)?([A-Za-z0-9_$]+)\s+from\s+["'][^"']+["'];?\s*$/);
|
|
2937
|
+
return i && i[1] === t ? [] : [e];
|
|
2938
|
+
}).join("\n");
|
|
2939
|
+
}
|
|
2940
|
+
async function fi(e, t, n) {
|
|
2941
|
+
let r = T.resolve(n, X("{{enums.src}}", t), "index.ts");
|
|
2942
|
+
if (!await J(r)) return;
|
|
2943
|
+
let i = await y.readFile(r, "utf-8");
|
|
2944
|
+
for (let t of e) i.includes(`from "${t.from}"`) || (i = pi(i, t));
|
|
2945
|
+
await y.writeFile(r, i, "utf-8");
|
|
2946
|
+
}
|
|
2947
|
+
function pi(e, t) {
|
|
2905
2948
|
let n = `export * from "${t.from}";`, r = e.lastIndexOf("export * from");
|
|
2906
2949
|
if (r !== -1) {
|
|
2907
2950
|
let t = e.indexOf("\n", r);
|
|
@@ -2909,14 +2952,14 @@ function oi(e, t) {
|
|
|
2909
2952
|
}
|
|
2910
2953
|
return e.trim() === "" ? n + "\n" : e.trimEnd() + "\n" + n + "\n";
|
|
2911
2954
|
}
|
|
2912
|
-
async function
|
|
2955
|
+
async function mi(e, t, n) {
|
|
2913
2956
|
let r = X("{{backend.root}}", t), i = T.resolve(n, r, "src/sockets/index.ts");
|
|
2914
2957
|
if (!await J(i)) return;
|
|
2915
2958
|
let a = await y.readFile(i, "utf-8");
|
|
2916
|
-
for (let t of e) a.includes(`from "${t.from}"`) || (a =
|
|
2917
|
-
await J(T.resolve(n, r, "src/libs/websocket/ws-authenticate.ts")) && (a =
|
|
2959
|
+
for (let t of e) a.includes(`from "${t.from}"`) || (a = hi(a, t), a = gi(a, t));
|
|
2960
|
+
await J(T.resolve(n, r, "src/libs/websocket/ws-authenticate.ts")) && (a = _i(a)), await y.writeFile(i, a, "utf-8");
|
|
2918
2961
|
}
|
|
2919
|
-
function
|
|
2962
|
+
function hi(e, t) {
|
|
2920
2963
|
let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("from \"./");
|
|
2921
2964
|
if (r !== -1) {
|
|
2922
2965
|
let t = e.indexOf("\n", r);
|
|
@@ -2925,7 +2968,7 @@ function ci(e, t) {
|
|
|
2925
2968
|
let i = e.indexOf("const sockets");
|
|
2926
2969
|
return i === -1 ? e : e.slice(0, i) + n + "\n\n" + e.slice(i);
|
|
2927
2970
|
}
|
|
2928
|
-
function
|
|
2971
|
+
function gi(e, t) {
|
|
2929
2972
|
let n = `.socket("${t.prefix}", ${t.import})`, r = e.indexOf("const sockets");
|
|
2930
2973
|
if (r === -1) return e;
|
|
2931
2974
|
let i = e.indexOf("new SocketRouter", r);
|
|
@@ -2939,7 +2982,7 @@ function li(e, t) {
|
|
|
2939
2982
|
}
|
|
2940
2983
|
return e;
|
|
2941
2984
|
}
|
|
2942
|
-
function
|
|
2985
|
+
function _i(e) {
|
|
2943
2986
|
if (e.includes("wsAuthenticate")) return e;
|
|
2944
2987
|
let t = e.indexOf("from \"@backend/libs/websocket/socket-router\""), n = e;
|
|
2945
2988
|
if (t !== -1) {
|
|
@@ -2948,14 +2991,14 @@ function ui(e) {
|
|
|
2948
2991
|
}
|
|
2949
2992
|
return n.replace("new SocketRouter()", "new SocketRouter({ authenticate: wsAuthenticate })");
|
|
2950
2993
|
}
|
|
2951
|
-
async function
|
|
2994
|
+
async function vi(e, t, n) {
|
|
2952
2995
|
let r = X("{{frontend.root}}", t), i = T.resolve(n, r, "src/api/sdk.ts");
|
|
2953
2996
|
if (!await J(i)) return;
|
|
2954
2997
|
let a = await y.readFile(i, "utf-8");
|
|
2955
|
-
for (let t of e) a.includes(`.$configure(${t.import})`) || (a =
|
|
2998
|
+
for (let t of e) a.includes(`.$configure(${t.import})`) || (a = yi(a, t), a = bi(a, t));
|
|
2956
2999
|
await y.writeFile(i, a, "utf-8");
|
|
2957
3000
|
}
|
|
2958
|
-
function
|
|
3001
|
+
function yi(e, t) {
|
|
2959
3002
|
let n = `import { ${t.import} } from "${t.from}";`;
|
|
2960
3003
|
if (e.includes(n)) return e;
|
|
2961
3004
|
let r = e.lastIndexOf("from \"./");
|
|
@@ -2966,20 +3009,20 @@ function fi(e, t) {
|
|
|
2966
3009
|
let i = e.indexOf("export const sdk");
|
|
2967
3010
|
return i === -1 ? e : e.slice(0, i) + n + "\n\n" + e.slice(i);
|
|
2968
3011
|
}
|
|
2969
|
-
function
|
|
3012
|
+
function bi(e, t) {
|
|
2970
3013
|
let n = `.$configure(${t.import})`, r = e.indexOf("export const sdk");
|
|
2971
3014
|
if (r === -1) return e;
|
|
2972
3015
|
let i = e.indexOf(";", r);
|
|
2973
3016
|
return i === -1 ? e : e.slice(0, i) + "\n " + n + e.slice(i);
|
|
2974
3017
|
}
|
|
2975
|
-
async function
|
|
3018
|
+
async function xi(e, t, n) {
|
|
2976
3019
|
let r = T.resolve(n, X("{{backend.utils}}", t), "frontend-url/frontend-url.ts");
|
|
2977
3020
|
if (!await J(r)) return;
|
|
2978
3021
|
let i = await y.readFile(r, "utf-8");
|
|
2979
|
-
for (let t of e) i.includes(`"${t.path}"`) || (i =
|
|
3022
|
+
for (let t of e) i.includes(`"${t.path}"`) || (i = Si(i, t));
|
|
2980
3023
|
await y.writeFile(r, i, "utf-8");
|
|
2981
3024
|
}
|
|
2982
|
-
function
|
|
3025
|
+
function Si(e, t) {
|
|
2983
3026
|
let n = ` "${t.path}": ${t.search};`, r = e.indexOf("type RouteDefinitions = {");
|
|
2984
3027
|
if (r === -1) return e;
|
|
2985
3028
|
let i = e.indexOf("{", r);
|
|
@@ -2995,20 +3038,20 @@ function hi(e, t) {
|
|
|
2995
3038
|
}
|
|
2996
3039
|
return o === -1 ? e : e.slice(0, o) + n + "\n" + e.slice(o);
|
|
2997
3040
|
}
|
|
2998
|
-
var
|
|
3041
|
+
var Ci = "import { type LucideIcon } from \"lucide-react\";\n\n/* -------------------------------------------------------------------------------------------------\n * Types\n * -----------------------------------------------------------------------------------------------*/\n\nexport type NavItem = {\n label: string;\n icon: LucideIcon;\n to: string;\n params?: Record<string, string>;\n};\n\nexport type NavSection = {\n label: string;\n icon: LucideIcon;\n items: NavItem[];\n};\n\nexport type NavSectionLink = NavSection & { to: string; params?: Record<string, string> };\n\nexport type NavEntry = NavSection | NavSectionLink;\n\n/* -------------------------------------------------------------------------------------------------\n * Navigation\n * -----------------------------------------------------------------------------------------------*/\n\nexport const primaryNav: NavEntry[] = [];\n\nexport const secondaryNav: NavEntry[] = [];\n\nexport const tertiaryNav: NavEntry[] = [];\n\nexport const settingsNav: NavEntry[] = [];\n", wi = {
|
|
2999
3042
|
primary: "primaryNav",
|
|
3000
3043
|
secondary: "secondaryNav",
|
|
3001
3044
|
tertiary: "tertiaryNav",
|
|
3002
3045
|
settings: "settingsNav"
|
|
3003
3046
|
};
|
|
3004
|
-
async function
|
|
3047
|
+
async function Ti(e) {
|
|
3005
3048
|
let { entries: t, paths: n, projectRoot: r, slot: i = "frontend" } = e, a = Ur(i, n), o = T.resolve(r, a, "src/constants/nav.constants.ts"), s;
|
|
3006
|
-
await J(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s =
|
|
3007
|
-
for (let e of t) s.includes(`label: "${e.label}"`) || (s =
|
|
3008
|
-
for (let e of t.toReversed()) s.includes(`label: "${e.label}"`) || (s =
|
|
3049
|
+
await J(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s = Ci);
|
|
3050
|
+
for (let e of t) s.includes(`label: "${e.label}"`) || (s = Oi(s, e));
|
|
3051
|
+
for (let e of t.toReversed()) s.includes(`label: "${e.label}"`) || (s = Ai(s, e));
|
|
3009
3052
|
await y.writeFile(o, s, "utf-8");
|
|
3010
3053
|
}
|
|
3011
|
-
async function
|
|
3054
|
+
async function Ei(e) {
|
|
3012
3055
|
let { postLoginRedirect: t, paths: n, projectRoot: r, slot: i = "frontend" } = e, a = Ur(i, n), o = T.resolve(r, a, "src/features/auth/constants/auth.constants.ts");
|
|
3013
3056
|
if (!await J(o)) return;
|
|
3014
3057
|
let s = await y.readFile(o, "utf-8"), c = /export const POST_LOGIN_REDIRECT_PATH = "[^"]*";/;
|
|
@@ -3016,17 +3059,17 @@ async function yi(e) {
|
|
|
3016
3059
|
let l = s.replace(c, `export const POST_LOGIN_REDIRECT_PATH = "${t}";`);
|
|
3017
3060
|
await y.writeFile(o, l, "utf-8");
|
|
3018
3061
|
}
|
|
3019
|
-
function
|
|
3062
|
+
function Di(e) {
|
|
3020
3063
|
let t = [e.icon];
|
|
3021
3064
|
if (e.items) for (let n of e.items) t.includes(n.icon) || t.push(n.icon);
|
|
3022
3065
|
return t;
|
|
3023
3066
|
}
|
|
3024
|
-
function
|
|
3025
|
-
let n =
|
|
3026
|
-
for (let e of n) r =
|
|
3067
|
+
function Oi(e, t) {
|
|
3068
|
+
let n = Di(t), r = e;
|
|
3069
|
+
for (let e of n) r = ki(r, e);
|
|
3027
3070
|
return r;
|
|
3028
3071
|
}
|
|
3029
|
-
function
|
|
3072
|
+
function ki(e, t) {
|
|
3030
3073
|
let n = e.match(/import \{([^}]+)\} from "lucide-react";/);
|
|
3031
3074
|
if (!n) return e;
|
|
3032
3075
|
let r = n[1].split(",").map((e) => e.trim()).filter(Boolean);
|
|
@@ -3034,21 +3077,21 @@ function Si(e, t) {
|
|
|
3034
3077
|
let i = r.findIndex((e) => e.startsWith("type "));
|
|
3035
3078
|
return i === -1 ? r.push(t) : r.splice(i, 0, t), e.replace(n[0], `import { ${r.join(", ")} } from "lucide-react";`);
|
|
3036
3079
|
}
|
|
3037
|
-
function
|
|
3038
|
-
let n =
|
|
3080
|
+
function Ai(e, t) {
|
|
3081
|
+
let n = wi[t.group];
|
|
3039
3082
|
if (!n) return e;
|
|
3040
|
-
let r =
|
|
3083
|
+
let r = Mi(t), i = RegExp(`export const ${n}: NavEntry\\[\\] = \\[`), a = e.match(i);
|
|
3041
3084
|
if (!a) return e;
|
|
3042
|
-
let o = e.indexOf(a[0]) + a[0].length, s =
|
|
3085
|
+
let o = e.indexOf(a[0]) + a[0].length, s = ji(e, o - 1);
|
|
3043
3086
|
return s === -1 ? e : e.slice(o, s).trim() === "" ? e.slice(0, o) + "\n" + r + "\n" + e.slice(o) : e.slice(0, o) + "\n" + r + e.slice(o);
|
|
3044
3087
|
}
|
|
3045
|
-
function
|
|
3088
|
+
function ji(e, t) {
|
|
3046
3089
|
let n = 0;
|
|
3047
3090
|
for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
|
|
3048
3091
|
else if (e[r] === "]" && (n--, n === 0)) return r;
|
|
3049
3092
|
return -1;
|
|
3050
3093
|
}
|
|
3051
|
-
function
|
|
3094
|
+
function Mi(e) {
|
|
3052
3095
|
let t = [];
|
|
3053
3096
|
if (t.push(" {"), t.push(` label: "${e.label}",`), t.push(` icon: ${e.icon},`), e.to && t.push(` to: "${e.to}",`), e.params && t.push(` params: ${e.params},`), e.items && e.items.length > 0) {
|
|
3054
3097
|
t.push(" items: [");
|
|
@@ -3064,14 +3107,14 @@ function Ti(e) {
|
|
|
3064
3107
|
} else t.push(" items: [],");
|
|
3065
3108
|
return t.push(" },"), t.join("\n");
|
|
3066
3109
|
}
|
|
3067
|
-
async function
|
|
3110
|
+
async function Ni(e, t, n) {
|
|
3068
3111
|
let r = X("{{backend.features}}", t), i = T.resolve(n, r, "organizations/modules/setup-organization/steps/index.ts");
|
|
3069
3112
|
if (!await J(i)) return;
|
|
3070
3113
|
let a = await y.readFile(i, "utf-8");
|
|
3071
|
-
for (let t of e) a.includes(`from "${t.from}"`) || (a =
|
|
3114
|
+
for (let t of e) a.includes(`from "${t.from}"`) || (a = Pi(a, t), a = Fi(a, t));
|
|
3072
3115
|
await y.writeFile(i, a, "utf-8");
|
|
3073
3116
|
}
|
|
3074
|
-
function
|
|
3117
|
+
function Pi(e, t) {
|
|
3075
3118
|
let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("import ");
|
|
3076
3119
|
if (r !== -1) {
|
|
3077
3120
|
let t = e.indexOf("\n", e.indexOf(";", r));
|
|
@@ -3079,38 +3122,38 @@ function Di(e, t) {
|
|
|
3079
3122
|
}
|
|
3080
3123
|
return e.indexOf("type "), n + "\n\n" + e;
|
|
3081
3124
|
}
|
|
3082
|
-
function
|
|
3125
|
+
function Fi(e, t) {
|
|
3083
3126
|
let n = ` { id: "${t.id}", execute: (ctx) => ${t.import}(ctx) },`, r = e.match(/export const steps:\s*Step\[\]\s*=\s*\[/);
|
|
3084
3127
|
if (!r) return e;
|
|
3085
|
-
let i = e.indexOf(r[0]) + r[0].length, a =
|
|
3128
|
+
let i = e.indexOf(r[0]) + r[0].length, a = Ii(e, i - 1);
|
|
3086
3129
|
return a === -1 ? e : e.slice(i, a).trim() === "" ? e.slice(0, a) + "\n" + n + "\n" + e.slice(a) : e.slice(0, a) + n + "\n" + e.slice(a);
|
|
3087
3130
|
}
|
|
3088
|
-
function
|
|
3131
|
+
function Ii(e, t) {
|
|
3089
3132
|
let n = 0;
|
|
3090
3133
|
for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
|
|
3091
3134
|
else if (e[r] === "]" && (n--, n === 0)) return r;
|
|
3092
3135
|
return -1;
|
|
3093
3136
|
}
|
|
3094
|
-
var
|
|
3095
|
-
async function
|
|
3096
|
-
await
|
|
3137
|
+
var Li = "import { type ComponentType } from \"react\";\n\nexport type NavbarAction = {\n id: string;\n component: ComponentType;\n};\n\nexport const navbarActions: NavbarAction[] = [];\n\nexport const userMenuActions: NavbarAction[] = [];\n";
|
|
3138
|
+
async function Ri(e) {
|
|
3139
|
+
await Bi({
|
|
3097
3140
|
...e,
|
|
3098
3141
|
arrayName: "navbarActions"
|
|
3099
3142
|
});
|
|
3100
3143
|
}
|
|
3101
|
-
async function
|
|
3102
|
-
await
|
|
3144
|
+
async function zi(e) {
|
|
3145
|
+
await Bi({
|
|
3103
3146
|
...e,
|
|
3104
3147
|
arrayName: "userMenuActions"
|
|
3105
3148
|
});
|
|
3106
3149
|
}
|
|
3107
|
-
async function
|
|
3150
|
+
async function Bi({ actions: e, arrayName: t, paths: n, projectRoot: r, slot: i }) {
|
|
3108
3151
|
let a = Ur(i, n), o = T.resolve(r, a, "src/constants/navbar-actions.tsx"), s;
|
|
3109
|
-
await J(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s =
|
|
3110
|
-
for (let n of e) s =
|
|
3152
|
+
await J(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s = Li);
|
|
3153
|
+
for (let n of e) s = Vi(s, n), s = Hi(s, n, t);
|
|
3111
3154
|
await y.writeFile(o, s, "utf-8");
|
|
3112
3155
|
}
|
|
3113
|
-
function
|
|
3156
|
+
function Vi(e, t) {
|
|
3114
3157
|
let n = `import { ${t.import} } from "${t.from}";`;
|
|
3115
3158
|
if (e.includes(n)) return e;
|
|
3116
3159
|
let r = e.lastIndexOf("import ");
|
|
@@ -3118,38 +3161,38 @@ function Pi(e, t) {
|
|
|
3118
3161
|
let i = e.indexOf("\n", r);
|
|
3119
3162
|
return i === -1 ? e + "\n" + n : e.slice(0, i + 1) + n + "\n" + e.slice(i + 1);
|
|
3120
3163
|
}
|
|
3121
|
-
function
|
|
3164
|
+
function Hi(e, t, n) {
|
|
3122
3165
|
let r = e.match(RegExp(`export const ${n}:\\s*NavbarAction\\[\\]\\s*=\\s*\\[`));
|
|
3123
3166
|
if (!r) return e;
|
|
3124
|
-
let i = e.indexOf(r[0]) + r[0].length, a =
|
|
3167
|
+
let i = e.indexOf(r[0]) + r[0].length, a = Ui(e, i - 1);
|
|
3125
3168
|
if (a === -1) return e;
|
|
3126
3169
|
let o = e.slice(i, a);
|
|
3127
3170
|
if (o.includes(`id: "${t.id}"`)) return e;
|
|
3128
3171
|
let s = ` { id: "${t.id}", component: ${t.import} },`;
|
|
3129
3172
|
return o.trim() === "" ? e.slice(0, a) + "\n" + s + "\n" + e.slice(a) : e.slice(0, a) + s + "\n" + e.slice(a);
|
|
3130
3173
|
}
|
|
3131
|
-
function
|
|
3174
|
+
function Ui(e, t) {
|
|
3132
3175
|
let n = 0;
|
|
3133
3176
|
for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
|
|
3134
3177
|
else if (e[r] === "]" && (n--, n === 0)) return r;
|
|
3135
3178
|
return -1;
|
|
3136
3179
|
}
|
|
3137
|
-
var
|
|
3180
|
+
var Wi = new Set([
|
|
3138
3181
|
".ts",
|
|
3139
3182
|
".tsx",
|
|
3140
3183
|
".js",
|
|
3141
3184
|
".jsx"
|
|
3142
3185
|
]);
|
|
3143
|
-
async function
|
|
3186
|
+
async function Gi(e) {
|
|
3144
3187
|
let { files: t, paths: n, projectRoot: r, projectName: i } = e;
|
|
3145
3188
|
if (i === "hype-stack") return;
|
|
3146
3189
|
let a = `@${i}/`;
|
|
3147
3190
|
await Promise.all(t.map(async (e) => {
|
|
3148
3191
|
let t = Lr(e.target, n, r), i = await y.stat(t).catch(() => null);
|
|
3149
|
-
i?.isDirectory() ? await
|
|
3192
|
+
i?.isDirectory() ? await Ji(t, a) : i?.isFile() && Wi.has(T.extname(t)) && await Yi(t, a);
|
|
3150
3193
|
}));
|
|
3151
3194
|
}
|
|
3152
|
-
var
|
|
3195
|
+
var Ki = new Set([
|
|
3153
3196
|
".git",
|
|
3154
3197
|
"node_modules",
|
|
3155
3198
|
"dist",
|
|
@@ -3158,20 +3201,20 @@ var zi = new Set([
|
|
|
3158
3201
|
".next",
|
|
3159
3202
|
"coverage"
|
|
3160
3203
|
]);
|
|
3161
|
-
async function
|
|
3162
|
-
t !== "hype-stack" && await
|
|
3204
|
+
async function qi(e, t) {
|
|
3205
|
+
t !== "hype-stack" && await Ji(e, `@${t}/`);
|
|
3163
3206
|
}
|
|
3164
|
-
async function
|
|
3207
|
+
async function Ji(e, t) {
|
|
3165
3208
|
let n = await y.readdir(e, { withFileTypes: !0 });
|
|
3166
3209
|
await Promise.all(n.map(async (n) => {
|
|
3167
3210
|
let r = T.join(e, n.name);
|
|
3168
3211
|
if (n.isDirectory()) {
|
|
3169
|
-
if (
|
|
3170
|
-
await
|
|
3171
|
-
} else n.isFile() &&
|
|
3212
|
+
if (Ki.has(n.name)) return;
|
|
3213
|
+
await Ji(r, t);
|
|
3214
|
+
} else n.isFile() && Wi.has(T.extname(n.name)) && await Yi(r, t);
|
|
3172
3215
|
}));
|
|
3173
3216
|
}
|
|
3174
|
-
async function
|
|
3217
|
+
async function Yi(e, t) {
|
|
3175
3218
|
let n = await y.readFile(e, "utf-8");
|
|
3176
3219
|
if (!n.includes(Hr)) return;
|
|
3177
3220
|
let r = n.replaceAll(Hr, t);
|
|
@@ -3179,22 +3222,22 @@ async function Hi(e, t) {
|
|
|
3179
3222
|
}
|
|
3180
3223
|
//#endregion
|
|
3181
3224
|
//#region src/core/installer.ts
|
|
3182
|
-
function
|
|
3225
|
+
function Xi(e, t) {
|
|
3183
3226
|
return e.slot ? t ? t.includes(e.slot) : e.slot === "frontend" : !0;
|
|
3184
3227
|
}
|
|
3185
|
-
async function
|
|
3228
|
+
async function Zi(e, t) {
|
|
3186
3229
|
if ((await y.stat(e)).isDirectory()) {
|
|
3187
3230
|
await y.mkdir(t, { recursive: !0 });
|
|
3188
3231
|
let n = await y.readdir(e, { withFileTypes: !0 });
|
|
3189
|
-
for (let r of n) await
|
|
3232
|
+
for (let r of n) await Zi(T.join(e, r.name), T.join(t, r.name));
|
|
3190
3233
|
} else await y.mkdir(T.dirname(t), { recursive: !0 }), await y.copyFile(e, t);
|
|
3191
3234
|
}
|
|
3192
|
-
async function
|
|
3235
|
+
async function Qi(e) {
|
|
3193
3236
|
let { src: t, dest: n, projectRoot: r, skip: i } = e;
|
|
3194
3237
|
if ((await y.stat(t)).isDirectory()) {
|
|
3195
3238
|
await y.mkdir(n, { recursive: !0 });
|
|
3196
3239
|
let e = await y.readdir(t, { withFileTypes: !0 });
|
|
3197
|
-
return (await Promise.all(e.map((e) =>
|
|
3240
|
+
return (await Promise.all(e.map((e) => Qi({
|
|
3198
3241
|
src: T.join(t, e.name),
|
|
3199
3242
|
dest: T.join(n, e.name),
|
|
3200
3243
|
projectRoot: r,
|
|
@@ -3203,7 +3246,7 @@ async function Gi(e) {
|
|
|
3203
3246
|
}
|
|
3204
3247
|
return i.has(t) ? [] : (await y.mkdir(T.dirname(n), { recursive: !0 }), await y.copyFile(t, n), [T.relative(r, n)]);
|
|
3205
3248
|
}
|
|
3206
|
-
async function
|
|
3249
|
+
async function $i(e) {
|
|
3207
3250
|
let { file: t, packDir: n, paths: r, projectRoot: i } = e, a = Rr(t.source, n), o = Lr(t.target, r, i);
|
|
3208
3251
|
return {
|
|
3209
3252
|
sourcePath: a,
|
|
@@ -3212,8 +3255,8 @@ async function Ki(e) {
|
|
|
3212
3255
|
targetExists: await J(o) || await ar(o)
|
|
3213
3256
|
};
|
|
3214
3257
|
}
|
|
3215
|
-
async function
|
|
3216
|
-
let { file: t, packDir: n, paths: r, projectRoot: i } = e, { sourcePath: a, targetPath: o, sourceExists: s, targetExists: c } = await
|
|
3258
|
+
async function ea(e) {
|
|
3259
|
+
let { file: t, packDir: n, paths: r, projectRoot: i } = e, { sourcePath: a, targetPath: o, sourceExists: s, targetExists: c } = await $i({
|
|
3217
3260
|
file: t,
|
|
3218
3261
|
packDir: n,
|
|
3219
3262
|
paths: r,
|
|
@@ -3228,8 +3271,8 @@ async function qi(e) {
|
|
|
3228
3271
|
default: return `${t.target}: Unknown strategy: ${String(t.strategy)}`;
|
|
3229
3272
|
}
|
|
3230
3273
|
}
|
|
3231
|
-
async function
|
|
3232
|
-
let { file: t, packDir: n, paths: r, projectRoot: i, force: a, overwrite: o } = e, { sourcePath: s, targetPath: c, sourceExists: l, targetExists: u } = await
|
|
3274
|
+
async function ta(e) {
|
|
3275
|
+
let { file: t, packDir: n, paths: r, projectRoot: i, force: a, overwrite: o } = e, { sourcePath: s, targetPath: c, sourceExists: l, targetExists: u } = await $i({
|
|
3233
3276
|
file: t,
|
|
3234
3277
|
packDir: n,
|
|
3235
3278
|
paths: r,
|
|
@@ -3247,7 +3290,7 @@ async function Ji(e) {
|
|
|
3247
3290
|
status: "skipped",
|
|
3248
3291
|
path: t.target,
|
|
3249
3292
|
reason: "Already exists"
|
|
3250
|
-
} : (await
|
|
3293
|
+
} : (await Zi(s, c), {
|
|
3251
3294
|
status: "installed",
|
|
3252
3295
|
path: t.target
|
|
3253
3296
|
});
|
|
@@ -3256,16 +3299,16 @@ async function Ji(e) {
|
|
|
3256
3299
|
status: "skipped",
|
|
3257
3300
|
path: t.target,
|
|
3258
3301
|
reason: "Already exists (skip-if-exists)"
|
|
3259
|
-
} : (await
|
|
3302
|
+
} : (await Zi(s, c), {
|
|
3260
3303
|
status: "installed",
|
|
3261
3304
|
path: t.target
|
|
3262
3305
|
});
|
|
3263
|
-
case "override": return await
|
|
3306
|
+
case "override": return await Zi(s, c), {
|
|
3264
3307
|
status: "installed",
|
|
3265
3308
|
path: t.target
|
|
3266
3309
|
};
|
|
3267
3310
|
case "merge": {
|
|
3268
|
-
if (!u) return await
|
|
3311
|
+
if (!u) return await Zi(s, c), {
|
|
3269
3312
|
status: "installed",
|
|
3270
3313
|
path: t.target
|
|
3271
3314
|
};
|
|
@@ -3295,15 +3338,15 @@ async function Ji(e) {
|
|
|
3295
3338
|
};
|
|
3296
3339
|
}
|
|
3297
3340
|
}
|
|
3298
|
-
async function
|
|
3341
|
+
async function na(e) {
|
|
3299
3342
|
let { packs: t, config: n, projectRoot: r, slotsByPack: i } = e, a = n.paths;
|
|
3300
3343
|
if (!a) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
|
|
3301
3344
|
let o = [], s = /* @__PURE__ */ new Set();
|
|
3302
3345
|
for (let e of t) {
|
|
3303
3346
|
let t = i?.get(e.manifest.name);
|
|
3304
3347
|
for (let n of e.manifest.files) {
|
|
3305
|
-
if (n.strategy !== "create" || !
|
|
3306
|
-
let { targetPath: i, targetExists: c } = await
|
|
3348
|
+
if (n.strategy !== "create" || !Xi(n, t)) continue;
|
|
3349
|
+
let { targetPath: i, targetExists: c } = await $i({
|
|
3307
3350
|
file: n,
|
|
3308
3351
|
packDir: e.packDir,
|
|
3309
3352
|
paths: a,
|
|
@@ -3318,13 +3361,13 @@ async function Yi(e) {
|
|
|
3318
3361
|
}
|
|
3319
3362
|
return o;
|
|
3320
3363
|
}
|
|
3321
|
-
async function
|
|
3364
|
+
async function ra(e) {
|
|
3322
3365
|
let { manifest: t, config: n, projectRoot: r, force: i, packDir: a, slots: o } = e, s = n.paths;
|
|
3323
3366
|
if (!s) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
|
|
3324
3367
|
let c = [];
|
|
3325
3368
|
for (let e of t.files) {
|
|
3326
|
-
if (!
|
|
3327
|
-
let t = await
|
|
3369
|
+
if (!Xi(e, o)) continue;
|
|
3370
|
+
let t = await ea({
|
|
3328
3371
|
file: e,
|
|
3329
3372
|
packDir: a,
|
|
3330
3373
|
paths: s,
|
|
@@ -3335,16 +3378,16 @@ async function Xi(e) {
|
|
|
3335
3378
|
}
|
|
3336
3379
|
return c;
|
|
3337
3380
|
}
|
|
3338
|
-
async function
|
|
3381
|
+
async function ia(e) {
|
|
3339
3382
|
let { manifest: t, config: n, projectRoot: r, force: i, overwrite: a, packDir: o, slots: s } = e, c = n.paths;
|
|
3340
3383
|
if (!c) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
|
|
3341
3384
|
let l = {
|
|
3342
3385
|
installed: [],
|
|
3343
3386
|
skipped: [],
|
|
3344
3387
|
errors: []
|
|
3345
|
-
}, u = t.files.filter((e) =>
|
|
3388
|
+
}, u = t.files.filter((e) => Xi(e, s));
|
|
3346
3389
|
for (let e of u) {
|
|
3347
|
-
let t = await
|
|
3390
|
+
let t = await ta({
|
|
3348
3391
|
file: e,
|
|
3349
3392
|
packDir: o,
|
|
3350
3393
|
paths: c,
|
|
@@ -3364,40 +3407,40 @@ async function Zi(e) {
|
|
|
3364
3407
|
break;
|
|
3365
3408
|
}
|
|
3366
3409
|
}
|
|
3367
|
-
await
|
|
3410
|
+
await Gi({
|
|
3368
3411
|
files: u,
|
|
3369
3412
|
paths: c,
|
|
3370
3413
|
projectRoot: r,
|
|
3371
3414
|
projectName: n.name
|
|
3372
|
-
}), t.env && t.env.length > 0 && await Wr(t.env, c, r), t.routes && t.routes.length > 0 && await Xr(t.routes, c, r), t.context && t.context.length > 0 && await $r(t.context, c, r), t.sockets && t.sockets.length > 0 && await
|
|
3415
|
+
}), t.env && t.env.length > 0 && await Wr(t.env, c, r), t.routes && t.routes.length > 0 && await Xr(t.routes, c, r), t.context && t.context.length > 0 && await $r(t.context, c, r), t.contextRemove && t.contextRemove.length > 0 && await ai(t.contextRemove, c, r), t.sockets && t.sockets.length > 0 && await mi(t.sockets, c, r), t.sdkConfigurations && t.sdkConfigurations.length > 0 && await vi(t.sdkConfigurations, c, r), t.enums && t.enums.length > 0 && await fi(t.enums, c, r), t.frontendRoutes && t.frontendRoutes.length > 0 && await xi(t.frontendRoutes, c, r);
|
|
3373
3416
|
let d = s && s.length > 0 ? s : ["frontend"];
|
|
3374
|
-
for (let e of d) t.nav && t.nav.length > 0 && await
|
|
3417
|
+
for (let e of d) t.nav && t.nav.length > 0 && await Ti({
|
|
3375
3418
|
entries: t.nav,
|
|
3376
3419
|
paths: c,
|
|
3377
3420
|
projectRoot: r,
|
|
3378
3421
|
slot: e
|
|
3379
|
-
}), t.navbarActions && t.navbarActions.length > 0 && await
|
|
3422
|
+
}), t.navbarActions && t.navbarActions.length > 0 && await Ri({
|
|
3380
3423
|
actions: t.navbarActions,
|
|
3381
3424
|
paths: c,
|
|
3382
3425
|
projectRoot: r,
|
|
3383
3426
|
slot: e
|
|
3384
|
-
}), t.userMenuActions && t.userMenuActions.length > 0 && await
|
|
3427
|
+
}), t.userMenuActions && t.userMenuActions.length > 0 && await zi({
|
|
3385
3428
|
actions: t.userMenuActions,
|
|
3386
3429
|
paths: c,
|
|
3387
3430
|
projectRoot: r,
|
|
3388
3431
|
slot: e
|
|
3389
3432
|
});
|
|
3390
|
-
return t.onboardingSteps && t.onboardingSteps.length > 0 && await
|
|
3433
|
+
return t.onboardingSteps && t.onboardingSteps.length > 0 && await Ni(t.onboardingSteps, c, r), t.postLoginRedirect && await Ei({
|
|
3391
3434
|
postLoginRedirect: t.postLoginRedirect,
|
|
3392
3435
|
paths: c,
|
|
3393
3436
|
projectRoot: r,
|
|
3394
3437
|
slot: d[0]
|
|
3395
3438
|
}), l;
|
|
3396
3439
|
}
|
|
3397
|
-
async function
|
|
3440
|
+
async function aa(e) {
|
|
3398
3441
|
let { packs: t, config: n, projectRoot: r, force: i, overwrite: a, slotsByPack: o } = e, s = [];
|
|
3399
3442
|
for (let e of t) {
|
|
3400
|
-
let t = o?.get(e.manifest.name), a = await
|
|
3443
|
+
let t = o?.get(e.manifest.name), a = await ra({
|
|
3401
3444
|
manifest: e.manifest,
|
|
3402
3445
|
config: n,
|
|
3403
3446
|
projectRoot: r,
|
|
@@ -3417,7 +3460,7 @@ async function Qi(e) {
|
|
|
3417
3460
|
};
|
|
3418
3461
|
let c = [], l = [], u = [], d = [], f = n;
|
|
3419
3462
|
for (let e of t) {
|
|
3420
|
-
let t = o?.get(e.manifest.name), n = await
|
|
3463
|
+
let t = o?.get(e.manifest.name), n = await ia({
|
|
3421
3464
|
manifest: e.manifest,
|
|
3422
3465
|
config: f,
|
|
3423
3466
|
projectRoot: r,
|
|
@@ -3426,7 +3469,7 @@ async function Qi(e) {
|
|
|
3426
3469
|
packDir: e.packDir,
|
|
3427
3470
|
slots: t
|
|
3428
3471
|
});
|
|
3429
|
-
c.push(...n.installed), l.push(...n.skipped), u.push(...n.errors), f = await
|
|
3472
|
+
c.push(...n.installed), l.push(...n.skipped), u.push(...n.errors), f = await oa(f, e.manifest, r), d.push(e.manifest.name);
|
|
3430
3473
|
}
|
|
3431
3474
|
return {
|
|
3432
3475
|
installed: c,
|
|
@@ -3437,7 +3480,7 @@ async function Qi(e) {
|
|
|
3437
3480
|
config: f
|
|
3438
3481
|
};
|
|
3439
3482
|
}
|
|
3440
|
-
async function
|
|
3483
|
+
async function oa(e, t, n) {
|
|
3441
3484
|
let r = typeof t == "string" ? t : t.name, i = typeof t == "string" ? [] : wr(t.env), a = Tr([...e.onboarding?.envSections ?? [], ...i]), o = {
|
|
3442
3485
|
...e,
|
|
3443
3486
|
installedPacks: [...e.installedPacks ?? [], r],
|
|
@@ -3448,7 +3491,7 @@ async function $i(e, t, n) {
|
|
|
3448
3491
|
};
|
|
3449
3492
|
return await Ar(n, o), o;
|
|
3450
3493
|
}
|
|
3451
|
-
async function
|
|
3494
|
+
async function sa(e) {
|
|
3452
3495
|
let { manifest: t, config: n, projectRoot: r, templateDir: i } = e, a = n.paths;
|
|
3453
3496
|
if (!a) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
|
|
3454
3497
|
let o = [], s = [], c = t.files.filter((e) => e.strategy === "merge"), l = new Set(c.map((e) => Rr(e.source, i))), u = T.join(i, "files");
|
|
@@ -3458,7 +3501,7 @@ async function ea(e) {
|
|
|
3458
3501
|
if (!t.isDirectory()) continue;
|
|
3459
3502
|
let e = a[t.name]?.root;
|
|
3460
3503
|
if (!e) continue;
|
|
3461
|
-
let n = await
|
|
3504
|
+
let n = await Qi({
|
|
3462
3505
|
src: T.join(u, t.name),
|
|
3463
3506
|
dest: T.resolve(r, e),
|
|
3464
3507
|
projectRoot: r,
|
|
@@ -3468,7 +3511,7 @@ async function ea(e) {
|
|
|
3468
3511
|
}
|
|
3469
3512
|
}
|
|
3470
3513
|
for (let e of c) {
|
|
3471
|
-
let t = await
|
|
3514
|
+
let t = await ta({
|
|
3472
3515
|
file: e,
|
|
3473
3516
|
packDir: i,
|
|
3474
3517
|
paths: a,
|
|
@@ -3479,11 +3522,11 @@ async function ea(e) {
|
|
|
3479
3522
|
t.status === "installed" ? o.push(t.path) : t.status === "error" && s.push(`${t.path}: ${t.reason}`);
|
|
3480
3523
|
}
|
|
3481
3524
|
let d = T.join(Lr("{{frontend.root}}", a, r), "src", "routes"), f = T.join(d, "(public)", "index.tsx"), p = T.join(d, "(private)", "index.tsx");
|
|
3482
|
-
return await J(f) && await J(p) && await y.rm(p, { force: !0 }), t.frontendRoutes && t.frontendRoutes.length > 0 && await
|
|
3525
|
+
return await J(f) && await J(p) && await y.rm(p, { force: !0 }), t.frontendRoutes && t.frontendRoutes.length > 0 && await xi(t.frontendRoutes, a, r), t.nav && t.nav.length > 0 && await Ti({
|
|
3483
3526
|
entries: t.nav,
|
|
3484
3527
|
paths: a,
|
|
3485
3528
|
projectRoot: r
|
|
3486
|
-
}), t.postLoginRedirect && await
|
|
3529
|
+
}), t.postLoginRedirect && await Ei({
|
|
3487
3530
|
postLoginRedirect: t.postLoginRedirect,
|
|
3488
3531
|
paths: a,
|
|
3489
3532
|
projectRoot: r
|
|
@@ -3494,32 +3537,32 @@ async function ea(e) {
|
|
|
3494
3537
|
}
|
|
3495
3538
|
//#endregion
|
|
3496
3539
|
//#region src/core/pack-categories.ts
|
|
3497
|
-
var
|
|
3540
|
+
var ca = [
|
|
3498
3541
|
"starter",
|
|
3499
3542
|
"layout",
|
|
3500
3543
|
"feature"
|
|
3501
|
-
],
|
|
3544
|
+
], la = {
|
|
3502
3545
|
starter: "Starter",
|
|
3503
3546
|
layout: "Layout",
|
|
3504
3547
|
feature: "Features"
|
|
3505
|
-
},
|
|
3506
|
-
function
|
|
3548
|
+
}, ua = new Set(["starter", "layout"]), da = "starter-saas-betterauth", fa = "layout-basic";
|
|
3549
|
+
function pa(e, t = {}) {
|
|
3507
3550
|
let n = [];
|
|
3508
|
-
for (let r of
|
|
3551
|
+
for (let r of ca) {
|
|
3509
3552
|
let i = e.filter((e) => e.category === r);
|
|
3510
3553
|
if (i.length === 0) continue;
|
|
3511
|
-
let a =
|
|
3554
|
+
let a = ua.has(r) ? "single" : "multiple";
|
|
3512
3555
|
if (r === "layout") {
|
|
3513
|
-
n.push(
|
|
3556
|
+
n.push(ha("frontend", i)), t.adminAvailable && n.push(ha("admin", i));
|
|
3514
3557
|
continue;
|
|
3515
3558
|
}
|
|
3516
3559
|
if (r === "starter") {
|
|
3517
|
-
n.push(
|
|
3560
|
+
n.push(ma(i));
|
|
3518
3561
|
continue;
|
|
3519
3562
|
}
|
|
3520
3563
|
n.push({
|
|
3521
3564
|
category: r,
|
|
3522
|
-
label:
|
|
3565
|
+
label: la[r],
|
|
3523
3566
|
mode: a,
|
|
3524
3567
|
packs: i,
|
|
3525
3568
|
preselect: null
|
|
@@ -3527,33 +3570,33 @@ function oa(e, t = {}) {
|
|
|
3527
3570
|
}
|
|
3528
3571
|
return n;
|
|
3529
3572
|
}
|
|
3530
|
-
function
|
|
3531
|
-
let t = e.some((e) => e.name ===
|
|
3573
|
+
function ma(e) {
|
|
3574
|
+
let t = e.some((e) => e.name === da);
|
|
3532
3575
|
return {
|
|
3533
3576
|
category: "starter",
|
|
3534
|
-
label:
|
|
3577
|
+
label: la.starter,
|
|
3535
3578
|
mode: "single",
|
|
3536
3579
|
packs: e,
|
|
3537
|
-
preselect: t ?
|
|
3580
|
+
preselect: t ? da : null
|
|
3538
3581
|
};
|
|
3539
3582
|
}
|
|
3540
|
-
function
|
|
3541
|
-
let n = t.some((e) => e.name ===
|
|
3583
|
+
function ha(e, t) {
|
|
3584
|
+
let n = t.some((e) => e.name === fa);
|
|
3542
3585
|
return {
|
|
3543
3586
|
category: "layout",
|
|
3544
3587
|
label: e === "admin" ? "Admin Layout" : "Layout",
|
|
3545
3588
|
mode: "single",
|
|
3546
3589
|
packs: t,
|
|
3547
|
-
preselect: n ?
|
|
3590
|
+
preselect: n ? fa : null,
|
|
3548
3591
|
slot: e
|
|
3549
3592
|
};
|
|
3550
3593
|
}
|
|
3551
3594
|
//#endregion
|
|
3552
3595
|
//#region src/ui/logger.ts
|
|
3553
|
-
var
|
|
3554
|
-
function
|
|
3596
|
+
var ga = [he.orangeBright, he.skyBlue];
|
|
3597
|
+
function _a(e) {
|
|
3555
3598
|
let t = e.map((e, t) => {
|
|
3556
|
-
let n =
|
|
3599
|
+
let n = ga[t % ga.length];
|
|
3557
3600
|
return `${z.bold(n(`${t + 1}.`))} ${z.bold(e)}`;
|
|
3558
3601
|
}).join("\n");
|
|
3559
3602
|
s.note(t, "Next steps");
|
|
@@ -3563,13 +3606,13 @@ function Z() {
|
|
|
3563
3606
|
}
|
|
3564
3607
|
//#endregion
|
|
3565
3608
|
//#region src/core/post-setup.ts
|
|
3566
|
-
async function
|
|
3609
|
+
async function va() {
|
|
3567
3610
|
return (await q("docker", ["info"], { cwd: process.cwd() })).exitCode === 0;
|
|
3568
3611
|
}
|
|
3569
|
-
async function
|
|
3612
|
+
async function ya(e) {
|
|
3570
3613
|
return J(`${e}/apps/backend/.env`);
|
|
3571
3614
|
}
|
|
3572
|
-
async function
|
|
3615
|
+
async function ba(e, t, n) {
|
|
3573
3616
|
let r = n ? `Start services with ${z.command("docker compose up -d")}?` : `Docker is not running. Start services with ${z.command("docker compose up -d")}?`, i = t ? !0 : await s.confirm({
|
|
3574
3617
|
message: r,
|
|
3575
3618
|
initialValue: !0
|
|
@@ -3582,13 +3625,13 @@ async function pa(e, t, n) {
|
|
|
3582
3625
|
"up",
|
|
3583
3626
|
"-d"
|
|
3584
3627
|
], { cwd: `${e}/apps/backend` });
|
|
3585
|
-
return o.exitCode === 0 ? (a.stop(z.success("Docker services started")), !0) : (a.error("Failed to start Docker services"),
|
|
3628
|
+
return o.exitCode === 0 ? (a.stop(z.success("Docker services started")), !0) : (a.error("Failed to start Docker services"), xa(o), !1);
|
|
3586
3629
|
}
|
|
3587
|
-
function
|
|
3630
|
+
function xa(e) {
|
|
3588
3631
|
let t = (e.stderr || e.stdout).trim();
|
|
3589
3632
|
t && s.log.warn(z.muted(t));
|
|
3590
3633
|
}
|
|
3591
|
-
async function
|
|
3634
|
+
async function Sa(e, t = 15, n = 2e3) {
|
|
3592
3635
|
for (let r = 0; r < t; r++) {
|
|
3593
3636
|
if ((await q("docker", [
|
|
3594
3637
|
"compose",
|
|
@@ -3603,8 +3646,8 @@ async function ha(e, t = 15, n = 2e3) {
|
|
|
3603
3646
|
}
|
|
3604
3647
|
return !1;
|
|
3605
3648
|
}
|
|
3606
|
-
var
|
|
3607
|
-
async function
|
|
3649
|
+
var Ca = "Database schema is up to date";
|
|
3650
|
+
async function wa(e) {
|
|
3608
3651
|
let t = await q("pnpm", [
|
|
3609
3652
|
"--filter",
|
|
3610
3653
|
"@internal/backend",
|
|
@@ -3613,9 +3656,9 @@ async function _a(e) {
|
|
|
3613
3656
|
"migrate",
|
|
3614
3657
|
"status"
|
|
3615
3658
|
], { cwd: e });
|
|
3616
|
-
return t.exitCode === 0 ? `${t.stdout}\n${t.stderr}`.includes(
|
|
3659
|
+
return t.exitCode === 0 ? `${t.stdout}\n${t.stderr}`.includes(Ca) : !1;
|
|
3617
3660
|
}
|
|
3618
|
-
async function
|
|
3661
|
+
async function Ta(e) {
|
|
3619
3662
|
let t = s.spinner();
|
|
3620
3663
|
t.start("Running database migrations...");
|
|
3621
3664
|
let n = await q("pnpm", [
|
|
@@ -3623,15 +3666,15 @@ async function va(e) {
|
|
|
3623
3666
|
"@internal/backend",
|
|
3624
3667
|
"migration:latest"
|
|
3625
3668
|
], { cwd: e });
|
|
3626
|
-
return n.exitCode === 0 ? (t.stop(z.success("Database migrations applied")), !0) : (t.error("Migrations failed"),
|
|
3669
|
+
return n.exitCode === 0 ? (t.stop(z.success("Database migrations applied")), !0) : (t.error("Migrations failed"), xa(n), s.log.warn(z.muted("Run `pnpm --filter @internal/backend migration:latest` manually to apply migrations.")), !1);
|
|
3627
3670
|
}
|
|
3628
|
-
async function
|
|
3629
|
-
if (!await
|
|
3671
|
+
async function Ea(e, t, n = {}) {
|
|
3672
|
+
if (!await ba(e, t, await va())) return !1;
|
|
3630
3673
|
let r = s.spinner();
|
|
3631
|
-
return r.start("Waiting for Postgres to be ready..."), await
|
|
3674
|
+
return r.start("Waiting for Postgres to be ready..."), await Sa(e, n.postgresMaxAttempts ?? 15, n.postgresCheckIntervalMs ?? 2e3) ? (r.stop(z.success("Postgres is ready")), !0) : (r.error("Postgres health check timed out"), s.log.warn(z.muted("Run migrations manually once Postgres is ready: pnpm --filter @internal/backend migration:latest")), !1);
|
|
3632
3675
|
}
|
|
3633
|
-
async function
|
|
3634
|
-
if (!await
|
|
3676
|
+
async function Da(e, t, n = {}) {
|
|
3677
|
+
if (!await Ea(e, t, n)) return;
|
|
3635
3678
|
let r = t ? !0 : await s.confirm({
|
|
3636
3679
|
message: `Run database migrations with ${z.command("prisma migrate deploy")}?`,
|
|
3637
3680
|
initialValue: !0
|
|
@@ -3640,21 +3683,21 @@ async function ba(e, t, n = {}) {
|
|
|
3640
3683
|
s.log.info(z.muted("Skipping database migrations."));
|
|
3641
3684
|
return;
|
|
3642
3685
|
}
|
|
3643
|
-
await
|
|
3686
|
+
await Ta(e);
|
|
3644
3687
|
}
|
|
3645
|
-
async function
|
|
3646
|
-
if (!await
|
|
3688
|
+
async function Oa(e, t, n = {}) {
|
|
3689
|
+
if (!await ya(e)) {
|
|
3647
3690
|
s.log.warn(`${z.path(".env")} not found in ${z.path("apps/backend")}. Skipping Docker and migrations - configure it first.`);
|
|
3648
3691
|
return;
|
|
3649
3692
|
}
|
|
3650
|
-
await
|
|
3693
|
+
await Da(e, t, n);
|
|
3651
3694
|
}
|
|
3652
|
-
async function
|
|
3653
|
-
return await
|
|
3695
|
+
async function ka(e, t, n = {}) {
|
|
3696
|
+
return await ya(e) ? Ea(e, t, n) : (s.log.warn(`${z.path(".env")} not found in ${z.path("apps/backend")}. Skipping Docker - configure it first.`), !1);
|
|
3654
3697
|
}
|
|
3655
3698
|
//#endregion
|
|
3656
3699
|
//#region src/core/resolve.ts
|
|
3657
|
-
function
|
|
3700
|
+
function Aa(e) {
|
|
3658
3701
|
let t = /* @__PURE__ */ new Map();
|
|
3659
3702
|
for (let n of e) t.set(n.name, {
|
|
3660
3703
|
name: n.name,
|
|
@@ -3662,7 +3705,7 @@ function Ca(e) {
|
|
|
3662
3705
|
});
|
|
3663
3706
|
return t;
|
|
3664
3707
|
}
|
|
3665
|
-
function
|
|
3708
|
+
function ja(e, t, n = /* @__PURE__ */ new Set()) {
|
|
3666
3709
|
let r = /* @__PURE__ */ new Set();
|
|
3667
3710
|
function i(e) {
|
|
3668
3711
|
if (n.has(e)) return [];
|
|
@@ -3676,10 +3719,10 @@ function wa(e, t, n = /* @__PURE__ */ new Set()) {
|
|
|
3676
3719
|
}
|
|
3677
3720
|
return i(e);
|
|
3678
3721
|
}
|
|
3679
|
-
function
|
|
3722
|
+
function Ma(e, t, n = []) {
|
|
3680
3723
|
let r = new Set(n), i = new Set(n), a = [];
|
|
3681
3724
|
for (let n of e) {
|
|
3682
|
-
let e =
|
|
3725
|
+
let e = ja(n, t, new Set(i));
|
|
3683
3726
|
for (let t of e) i.has(t) || (i.add(t), a.push(t));
|
|
3684
3727
|
}
|
|
3685
3728
|
return {
|
|
@@ -3687,7 +3730,7 @@ function Ta(e, t, n = []) {
|
|
|
3687
3730
|
alreadyInstalled: e.filter((e) => r.has(e))
|
|
3688
3731
|
};
|
|
3689
3732
|
}
|
|
3690
|
-
function
|
|
3733
|
+
function Na(e) {
|
|
3691
3734
|
let { order: t, graph: n, isLocked: r, installed: i = [] } = e, a = new Set(i), o = /* @__PURE__ */ new Set();
|
|
3692
3735
|
for (let e of t) {
|
|
3693
3736
|
let t = n.get(e)?.dependencies.some((e) => !a.has(e) && o.has(e)) ?? !1;
|
|
@@ -3700,7 +3743,7 @@ function Ea(e) {
|
|
|
3700
3743
|
}
|
|
3701
3744
|
//#endregion
|
|
3702
3745
|
//#region src/core/variants.ts
|
|
3703
|
-
function
|
|
3746
|
+
function Pa(e, t = {}) {
|
|
3704
3747
|
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
3705
3748
|
for (let i of e) {
|
|
3706
3749
|
let e = t[i.family] ?? i.default;
|
|
@@ -3712,14 +3755,14 @@ function Da(e, t = {}) {
|
|
|
3712
3755
|
familyOf: r
|
|
3713
3756
|
};
|
|
3714
3757
|
}
|
|
3715
|
-
function
|
|
3758
|
+
function Fa(e, t, n) {
|
|
3716
3759
|
return [...e.map((e) => n.chosen.get(e.family) ?? e.default), ...t];
|
|
3717
3760
|
}
|
|
3718
|
-
function
|
|
3761
|
+
function Ia(e, t) {
|
|
3719
3762
|
let n = t.familyOf.get(e);
|
|
3720
3763
|
return n ? t.chosen.get(n) ?? e : e;
|
|
3721
3764
|
}
|
|
3722
|
-
function
|
|
3765
|
+
function La(e, t) {
|
|
3723
3766
|
let n = /* @__PURE__ */ new Map();
|
|
3724
3767
|
for (let t of e) t.family && n.set(t.name, t.family);
|
|
3725
3768
|
let r = new Set(t), i = /* @__PURE__ */ new Map();
|
|
@@ -3735,65 +3778,65 @@ function Aa(e, t) {
|
|
|
3735
3778
|
familyOf: n
|
|
3736
3779
|
};
|
|
3737
3780
|
}
|
|
3738
|
-
function
|
|
3781
|
+
function Ra(e, t) {
|
|
3739
3782
|
return e.map((e) => ({
|
|
3740
3783
|
...e,
|
|
3741
|
-
dependencies: e.dependencies.map((e) =>
|
|
3784
|
+
dependencies: e.dependencies.map((e) => Ia(e, t))
|
|
3742
3785
|
}));
|
|
3743
3786
|
}
|
|
3744
3787
|
//#endregion
|
|
3745
3788
|
//#region src/ui/banner.ts
|
|
3746
|
-
var
|
|
3789
|
+
var za = [
|
|
3747
3790
|
" ██╗ ██╗ ██╗ ██╗ ██████╗ ███████╗",
|
|
3748
3791
|
" ██║ ██║ ╚██╗ ██╔╝ ██╔══██╗ ██╔════╝",
|
|
3749
3792
|
" ███████║ ╚████╔╝ ██████╔╝ █████╗ ",
|
|
3750
3793
|
" ██╔══██║ ╚██╔╝ ██╔═══╝ ██╔══╝ ",
|
|
3751
3794
|
" ██║ ██║ ██║ ██║ ███████╗",
|
|
3752
3795
|
" ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝"
|
|
3753
|
-
],
|
|
3796
|
+
], Ba = [
|
|
3754
3797
|
" ███████╗ ████████╗ █████╗ ██████╗ ██╗ ██╗",
|
|
3755
3798
|
" ██╔════╝ ╚══██╔══╝ ██╔══██╗ ██╔════╝ ██║ ██╔╝",
|
|
3756
3799
|
" ███████╗ ██║ ███████║ ██║ █████╔╝ ",
|
|
3757
3800
|
" ╚════██║ ██║ ██╔══██║ ██║ ██╔═██╗ ",
|
|
3758
3801
|
" ███████║ ██║ ██║ ██║ ╚██████╗ ██║ ██╗",
|
|
3759
3802
|
" ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝"
|
|
3760
|
-
],
|
|
3803
|
+
], Va = [
|
|
3761
3804
|
253,
|
|
3762
3805
|
176,
|
|
3763
3806
|
21
|
|
3764
|
-
],
|
|
3807
|
+
], Ha = [
|
|
3765
3808
|
245,
|
|
3766
3809
|
76,
|
|
3767
3810
|
2
|
|
3768
|
-
],
|
|
3811
|
+
], Ua = 5, Wa = [
|
|
3769
3812
|
17,
|
|
3770
3813
|
103,
|
|
3771
3814
|
248
|
|
3772
|
-
],
|
|
3815
|
+
], Ga = [
|
|
3773
3816
|
42,
|
|
3774
3817
|
160,
|
|
3775
3818
|
250
|
|
3776
|
-
],
|
|
3777
|
-
function
|
|
3819
|
+
], Ka = .2;
|
|
3820
|
+
function qa() {
|
|
3778
3821
|
console.log();
|
|
3779
|
-
for (let e of be(
|
|
3780
|
-
start:
|
|
3781
|
-
end:
|
|
3782
|
-
angle:
|
|
3822
|
+
for (let e of be(za, {
|
|
3823
|
+
start: Va,
|
|
3824
|
+
end: Ha,
|
|
3825
|
+
angle: Ua
|
|
3783
3826
|
})) console.log(b.bold(e));
|
|
3784
|
-
for (let e of be(
|
|
3785
|
-
start:
|
|
3786
|
-
end:
|
|
3787
|
-
angle:
|
|
3827
|
+
for (let e of be(Ba, {
|
|
3828
|
+
start: Wa,
|
|
3829
|
+
end: Ga,
|
|
3830
|
+
angle: Ka
|
|
3788
3831
|
})) console.log(b.bold(e));
|
|
3789
3832
|
console.log(), console.log(` ${B.spark} ${b.dim("v" + A)} ${b.dim("·")} ${ve("Ship web + desktop apps from one codebase")}`), console.log();
|
|
3790
3833
|
}
|
|
3791
|
-
function
|
|
3834
|
+
function Ja() {
|
|
3792
3835
|
console.log(), console.log(` ${B.bolt} ${he.orange("Hype")}${he.skyBlue("Stack")} ${b.dim("v" + A)}`), console.log();
|
|
3793
3836
|
}
|
|
3794
3837
|
//#endregion
|
|
3795
3838
|
//#region src/ui/pack-multiselect.ts
|
|
3796
|
-
var
|
|
3839
|
+
var Ya = class extends O {
|
|
3797
3840
|
options;
|
|
3798
3841
|
cursor = 0;
|
|
3799
3842
|
selected;
|
|
@@ -3897,44 +3940,44 @@ var Ha = class extends O {
|
|
|
3897
3940
|
}
|
|
3898
3941
|
}
|
|
3899
3942
|
};
|
|
3900
|
-
function
|
|
3901
|
-
return new
|
|
3943
|
+
function Xa(e) {
|
|
3944
|
+
return new Ya(e).prompt();
|
|
3902
3945
|
}
|
|
3903
3946
|
//#endregion
|
|
3904
3947
|
//#region src/utils/naming.ts
|
|
3905
|
-
function
|
|
3948
|
+
function Za(e) {
|
|
3906
3949
|
return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
3907
3950
|
}
|
|
3908
|
-
function
|
|
3951
|
+
function Qa(e) {
|
|
3909
3952
|
return e.split(/[-_]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
|
|
3910
3953
|
}
|
|
3911
3954
|
//#endregion
|
|
3912
3955
|
//#region src/utils/validate.ts
|
|
3913
|
-
function
|
|
3956
|
+
function $a(e) {
|
|
3914
3957
|
if (!e.trim()) return "Project name cannot be empty";
|
|
3915
3958
|
if (e.length > 214) return "Project name is too long (max 214 characters)";
|
|
3916
|
-
let t =
|
|
3959
|
+
let t = Za(e);
|
|
3917
3960
|
if (!re.test(t)) return "Project name must contain at least one letter or number";
|
|
3918
3961
|
}
|
|
3919
3962
|
//#endregion
|
|
3920
3963
|
//#region src/core/apply-mode.ts
|
|
3921
|
-
var
|
|
3922
|
-
function
|
|
3923
|
-
return e.replace(
|
|
3964
|
+
var eo = "src/hooks/use-theme.ts", to = /(\bexport\s+const\s+defaultTheme\s*=\s*)(["'])(?:light|dark)\2/;
|
|
3965
|
+
function no(e, t) {
|
|
3966
|
+
return e.replace(to, (e, n, r) => `${n}${r}${t}${r}`);
|
|
3924
3967
|
}
|
|
3925
|
-
async function
|
|
3926
|
-
let n = T.resolve(e,
|
|
3968
|
+
async function ro(e, t) {
|
|
3969
|
+
let n = T.resolve(e, eo), r;
|
|
3927
3970
|
try {
|
|
3928
3971
|
r = await y.readFile(n, "utf-8");
|
|
3929
3972
|
} catch {
|
|
3930
3973
|
return !1;
|
|
3931
3974
|
}
|
|
3932
|
-
let i =
|
|
3975
|
+
let i = no(r, t);
|
|
3933
3976
|
return i === r || await y.writeFile(n, i, "utf-8"), !0;
|
|
3934
3977
|
}
|
|
3935
3978
|
//#endregion
|
|
3936
3979
|
//#region src/core/apply-theme.ts
|
|
3937
|
-
function
|
|
3980
|
+
function io(e, t) {
|
|
3938
3981
|
let n = 0;
|
|
3939
3982
|
for (; n < e.length;) {
|
|
3940
3983
|
let r = e.indexOf(t, n);
|
|
@@ -3957,47 +4000,47 @@ function Za(e, t) {
|
|
|
3957
4000
|
}
|
|
3958
4001
|
return null;
|
|
3959
4002
|
}
|
|
3960
|
-
function
|
|
4003
|
+
function ao(e, t) {
|
|
3961
4004
|
let n = e;
|
|
3962
4005
|
for (let [e, r] of Object.entries(t)) {
|
|
3963
|
-
let t = RegExp(`(^[ \\t]*--${
|
|
4006
|
+
let t = RegExp(`(^[ \\t]*--${oo(e)}[ \\t]*:[ \\t]*)([^;\\n]*);`, "m");
|
|
3964
4007
|
n = n.replace(t, (e, t) => `${t}${r};`);
|
|
3965
4008
|
}
|
|
3966
4009
|
return n;
|
|
3967
4010
|
}
|
|
3968
|
-
function
|
|
4011
|
+
function oo(e) {
|
|
3969
4012
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3970
4013
|
}
|
|
3971
|
-
function
|
|
3972
|
-
let n =
|
|
4014
|
+
function so(e, t) {
|
|
4015
|
+
let n = io(e, ":root"), r = io(e, ".dark"), i = e;
|
|
3973
4016
|
if (n) {
|
|
3974
4017
|
let e = i.slice(0, n.bodyStart), r = i.slice(n.bodyStart, n.bodyEnd), a = i.slice(n.bodyEnd);
|
|
3975
|
-
i = e +
|
|
4018
|
+
i = e + ao(r, t.light) + a;
|
|
3976
4019
|
}
|
|
3977
4020
|
if (r) {
|
|
3978
|
-
let e =
|
|
4021
|
+
let e = io(i, ".dark");
|
|
3979
4022
|
if (e) {
|
|
3980
4023
|
let n = i.slice(0, e.bodyStart), r = i.slice(e.bodyStart, e.bodyEnd), a = i.slice(e.bodyEnd);
|
|
3981
|
-
i = n +
|
|
4024
|
+
i = n + ao(r, t.dark) + a;
|
|
3982
4025
|
}
|
|
3983
4026
|
}
|
|
3984
4027
|
return i;
|
|
3985
4028
|
}
|
|
3986
|
-
var
|
|
3987
|
-
async function
|
|
3988
|
-
let n = T.resolve(e,
|
|
4029
|
+
var co = "assets/styles.css";
|
|
4030
|
+
async function lo(e, t) {
|
|
4031
|
+
let n = T.resolve(e, co), r;
|
|
3989
4032
|
try {
|
|
3990
4033
|
r = await y.readFile(n, "utf-8");
|
|
3991
4034
|
} catch {
|
|
3992
4035
|
return !1;
|
|
3993
4036
|
}
|
|
3994
|
-
let i =
|
|
4037
|
+
let i = so(r, t);
|
|
3995
4038
|
return i === r || await y.writeFile(n, i, "utf-8"), !0;
|
|
3996
4039
|
}
|
|
3997
4040
|
//#endregion
|
|
3998
4041
|
//#region src/core/clone.ts
|
|
3999
|
-
async function
|
|
4000
|
-
let t = await ee(
|
|
4042
|
+
async function uo(e) {
|
|
4043
|
+
let t = await ee(j, {
|
|
4001
4044
|
dir: e,
|
|
4002
4045
|
force: !0
|
|
4003
4046
|
});
|
|
@@ -4008,7 +4051,7 @@ async function ro(e) {
|
|
|
4008
4051
|
}
|
|
4009
4052
|
//#endregion
|
|
4010
4053
|
//#region src/core/editor-config.ts
|
|
4011
|
-
function
|
|
4054
|
+
function fo(e) {
|
|
4012
4055
|
let t = {
|
|
4013
4056
|
globs: [],
|
|
4014
4057
|
alwaysApply: !1
|
|
@@ -4043,10 +4086,10 @@ function io(e) {
|
|
|
4043
4086
|
content: i
|
|
4044
4087
|
};
|
|
4045
4088
|
}
|
|
4046
|
-
function
|
|
4089
|
+
function po(e) {
|
|
4047
4090
|
return e.frontmatter.globs.length > 0 ? `---\npaths:\n${e.frontmatter.globs.map((e) => ` - "${e}"`).join("\n")}\n---\n\n${e.content}` : e.content;
|
|
4048
4091
|
}
|
|
4049
|
-
function
|
|
4092
|
+
function mo(e) {
|
|
4050
4093
|
let t;
|
|
4051
4094
|
t = e.frontmatter.alwaysApply ? "always_on" : e.frontmatter.globs.length > 0 ? "glob" : "model_decision";
|
|
4052
4095
|
let n = [`trigger: ${t}`];
|
|
@@ -4056,30 +4099,30 @@ function oo(e) {
|
|
|
4056
4099
|
}
|
|
4057
4100
|
return e.frontmatter.description && n.push(`description: ${e.frontmatter.description}`), `---\n${n.join("\n")}\n---\n\n${e.content}`;
|
|
4058
4101
|
}
|
|
4059
|
-
function
|
|
4102
|
+
function ho(e) {
|
|
4060
4103
|
return e.frontmatter.globs.length > 0 ? `---\napplyTo: "${e.frontmatter.globs.join(", ")}"\n---\n\n${e.content}` : e.content;
|
|
4061
4104
|
}
|
|
4062
|
-
var
|
|
4105
|
+
var go = {
|
|
4063
4106
|
claude: {
|
|
4064
4107
|
rulesDir: ".claude/rules",
|
|
4065
4108
|
extension: ".md",
|
|
4066
|
-
convert:
|
|
4109
|
+
convert: po
|
|
4067
4110
|
},
|
|
4068
4111
|
windsurf: {
|
|
4069
4112
|
rulesDir: ".windsurf/rules",
|
|
4070
4113
|
extension: ".md",
|
|
4071
|
-
convert:
|
|
4114
|
+
convert: mo
|
|
4072
4115
|
},
|
|
4073
4116
|
copilot: {
|
|
4074
4117
|
rulesDir: ".github/instructions",
|
|
4075
4118
|
extension: ".instructions.md",
|
|
4076
|
-
convert:
|
|
4119
|
+
convert: ho
|
|
4077
4120
|
}
|
|
4078
4121
|
};
|
|
4079
|
-
async function
|
|
4122
|
+
async function _o(e) {
|
|
4080
4123
|
let t = T.join(e, ae), n = (await y.readdir(t, { withFileTypes: !0 }).catch(() => [])).filter((e) => e.isFile() && e.name.endsWith(".mdc"));
|
|
4081
4124
|
return await Promise.all(n.map(async (e) => {
|
|
4082
|
-
let n = T.join(t, e.name), { frontmatter: r, content: i } =
|
|
4125
|
+
let n = T.join(t, e.name), { frontmatter: r, content: i } = fo(await y.readFile(n, "utf-8"));
|
|
4083
4126
|
return {
|
|
4084
4127
|
frontmatter: r,
|
|
4085
4128
|
content: i,
|
|
@@ -4087,9 +4130,9 @@ async function lo(e) {
|
|
|
4087
4130
|
};
|
|
4088
4131
|
}));
|
|
4089
4132
|
}
|
|
4090
|
-
async function
|
|
4133
|
+
async function vo(e, t) {
|
|
4091
4134
|
if (t === "cursor") return;
|
|
4092
|
-
let n =
|
|
4135
|
+
let n = go[t], r = await _o(e), i = T.join(e, n.rulesDir);
|
|
4093
4136
|
await y.mkdir(i, { recursive: !0 }), await Promise.all(r.map((e) => {
|
|
4094
4137
|
let t = n.convert(e), r = e.filename.replace(/\.mdc$/, n.extension);
|
|
4095
4138
|
return y.writeFile(T.join(i, r), t, "utf-8");
|
|
@@ -4097,21 +4140,21 @@ async function uo(e, t) {
|
|
|
4097
4140
|
}
|
|
4098
4141
|
//#endregion
|
|
4099
4142
|
//#region src/core/env-files.ts
|
|
4100
|
-
var
|
|
4143
|
+
var yo = [
|
|
4101
4144
|
"apps",
|
|
4102
4145
|
"packages",
|
|
4103
4146
|
"libs",
|
|
4104
4147
|
"shared"
|
|
4105
4148
|
];
|
|
4106
|
-
async function
|
|
4107
|
-
let t = await
|
|
4149
|
+
async function bo(e) {
|
|
4150
|
+
let t = await xo(e);
|
|
4108
4151
|
return (await Promise.all(t.map(async (t) => {
|
|
4109
4152
|
let n = T.join(T.dirname(t), ".env");
|
|
4110
4153
|
return await J(n) ? null : (await y.copyFile(t, n), T.relative(e, n));
|
|
4111
4154
|
}))).filter((e) => e !== null).sort();
|
|
4112
4155
|
}
|
|
4113
|
-
async function
|
|
4114
|
-
let t = [T.join(e, ".env.example")], n = await Promise.all(
|
|
4156
|
+
async function xo(e) {
|
|
4157
|
+
let t = [T.join(e, ".env.example")], n = await Promise.all(yo.map(async (t) => {
|
|
4115
4158
|
let n = T.join(e, t);
|
|
4116
4159
|
return (await y.readdir(n, { withFileTypes: !0 }).catch(() => [])).filter((e) => e.isDirectory()).map((e) => T.join(n, e.name, ".env.example"));
|
|
4117
4160
|
}));
|
|
@@ -4119,11 +4162,11 @@ async function mo(e) {
|
|
|
4119
4162
|
}
|
|
4120
4163
|
//#endregion
|
|
4121
4164
|
//#region src/core/post-clone.ts
|
|
4122
|
-
var Q = "@hype-stack/",
|
|
4123
|
-
async function
|
|
4165
|
+
var Q = "@hype-stack/", So = "hype-stack";
|
|
4166
|
+
async function Co(e) {
|
|
4124
4167
|
await ur(T.join(e, ".git"));
|
|
4125
4168
|
}
|
|
4126
|
-
async function
|
|
4169
|
+
async function wo(e) {
|
|
4127
4170
|
await q("git", ["init"], { cwd: e }), await q("git", ["add", "."], { cwd: e }), await q("git", [
|
|
4128
4171
|
"-c",
|
|
4129
4172
|
"user.name=Hype Stack CLI",
|
|
@@ -4134,22 +4177,22 @@ async function _o(e) {
|
|
|
4134
4177
|
"Initial commit from Hype Stack CLI"
|
|
4135
4178
|
], { cwd: e });
|
|
4136
4179
|
}
|
|
4137
|
-
async function
|
|
4138
|
-
let n = `@${t}/`, r = await
|
|
4180
|
+
async function To(e, t) {
|
|
4181
|
+
let n = `@${t}/`, r = await No(e);
|
|
4139
4182
|
for (let e of r) {
|
|
4140
4183
|
let t = await sr(e);
|
|
4141
4184
|
if (!t) continue;
|
|
4142
4185
|
let r = !1;
|
|
4143
|
-
t.name?.startsWith(Q) && (t.name = t.name.replace(Q, n), r = !0),
|
|
4186
|
+
t.name?.startsWith(Q) && (t.name = t.name.replace(Q, n), r = !0), Ao(t.dependencies, n) && (r = !0), Ao(t.devDependencies, n) && (r = !0), t.nx && jo(t.nx, n) && (r = !0);
|
|
4144
4187
|
let i = await y.readFile(e, "utf-8");
|
|
4145
4188
|
if (i.includes(Q)) {
|
|
4146
4189
|
let t = i.replaceAll(Q, n);
|
|
4147
4190
|
await y.writeFile(e, t, "utf-8");
|
|
4148
4191
|
} else r && await cr(e, t);
|
|
4149
4192
|
}
|
|
4150
|
-
await
|
|
4193
|
+
await qi(e, t), await Oo(e, t), await Mo(e, t);
|
|
4151
4194
|
}
|
|
4152
|
-
var
|
|
4195
|
+
var Eo = new Set([
|
|
4153
4196
|
".git",
|
|
4154
4197
|
"node_modules",
|
|
4155
4198
|
"dist",
|
|
@@ -4157,10 +4200,10 @@ var yo = new Set([
|
|
|
4157
4200
|
".nx",
|
|
4158
4201
|
".next",
|
|
4159
4202
|
"coverage"
|
|
4160
|
-
]),
|
|
4161
|
-
async function
|
|
4162
|
-
if (t ===
|
|
4163
|
-
let n = await
|
|
4203
|
+
]), Do = /^(docker-compose|compose)(\.[\w.-]+)?\.ya?ml$/;
|
|
4204
|
+
async function Oo(e, t) {
|
|
4205
|
+
if (t === So) return;
|
|
4206
|
+
let n = await ko(e);
|
|
4164
4207
|
await Promise.all(n.map(async (e) => {
|
|
4165
4208
|
let n = await y.readFile(e, "utf-8").catch(() => null);
|
|
4166
4209
|
if (!n || !/^name:[ \t]*hype-stack/m.test(n)) return;
|
|
@@ -4168,14 +4211,14 @@ async function xo(e, t) {
|
|
|
4168
4211
|
await y.writeFile(e, r, "utf-8");
|
|
4169
4212
|
}));
|
|
4170
4213
|
}
|
|
4171
|
-
async function
|
|
4214
|
+
async function ko(e) {
|
|
4172
4215
|
let t = await y.readdir(e, { withFileTypes: !0 }).catch(() => []);
|
|
4173
4216
|
return (await Promise.all(t.map(async (t) => {
|
|
4174
4217
|
let n = T.join(e, t.name);
|
|
4175
|
-
return t.isDirectory() ?
|
|
4218
|
+
return t.isDirectory() ? Eo.has(t.name) ? [] : ko(n) : t.isFile() && Do.test(t.name) ? [n] : [];
|
|
4176
4219
|
}))).flat();
|
|
4177
4220
|
}
|
|
4178
|
-
function
|
|
4221
|
+
function Ao(e, t) {
|
|
4179
4222
|
if (!e) return !1;
|
|
4180
4223
|
let n = !1;
|
|
4181
4224
|
for (let r of Object.keys(e)) if (r.startsWith(Q)) {
|
|
@@ -4184,7 +4227,7 @@ function Co(e, t) {
|
|
|
4184
4227
|
}
|
|
4185
4228
|
return n;
|
|
4186
4229
|
}
|
|
4187
|
-
function
|
|
4230
|
+
function jo(e, t) {
|
|
4188
4231
|
if (!e) return !1;
|
|
4189
4232
|
let n = !1;
|
|
4190
4233
|
if (e.implicitDependencies &&= e.implicitDependencies.map((e) => e.startsWith(Q) ? (n = !0, e.replace(Q, t)) : e), e.targets) {
|
|
@@ -4192,13 +4235,13 @@ function wo(e, t) {
|
|
|
4192
4235
|
}
|
|
4193
4236
|
return n;
|
|
4194
4237
|
}
|
|
4195
|
-
async function
|
|
4238
|
+
async function Mo(e, t) {
|
|
4196
4239
|
let n = T.join(e, "packages/enums/src/app/index.ts"), r = await y.readFile(n, "utf-8").catch(() => null);
|
|
4197
4240
|
if (!r) return;
|
|
4198
|
-
let i =
|
|
4241
|
+
let i = Qa(t), a = r.replaceAll(`id: "${So}"`, `id: "${t}"`).replaceAll(`name: "${So}"`, `name: "${t}"`).replace(/name: "Hype Stack"/, `name: "${i}"`).replace(/description: ".*?"/, `description: "${i} application"`);
|
|
4199
4242
|
await y.writeFile(n, a, "utf-8");
|
|
4200
4243
|
}
|
|
4201
|
-
async function
|
|
4244
|
+
async function No(e) {
|
|
4202
4245
|
let t = [], n = T.join(e, "package.json");
|
|
4203
4246
|
(await y.stat(n).catch(() => null))?.isFile() && t.push(n);
|
|
4204
4247
|
for (let n of [
|
|
@@ -4218,7 +4261,7 @@ async function Eo(e) {
|
|
|
4218
4261
|
}
|
|
4219
4262
|
//#endregion
|
|
4220
4263
|
//#region src/core/readme.ts
|
|
4221
|
-
var
|
|
4264
|
+
var Po = {
|
|
4222
4265
|
cursor: {
|
|
4223
4266
|
label: "Cursor",
|
|
4224
4267
|
rulesDir: ".cursor/rules"
|
|
@@ -4235,21 +4278,21 @@ var Do = {
|
|
|
4235
4278
|
label: "GitHub Copilot",
|
|
4236
4279
|
rulesDir: ".github/instructions"
|
|
4237
4280
|
}
|
|
4238
|
-
},
|
|
4281
|
+
}, Fo = {
|
|
4239
4282
|
backend: "Hono API server (Postgres, Prisma, Kysely, Valkey cache, WorkOS auth)",
|
|
4240
4283
|
frontend: "React + Vite app talking to the backend through the typed HyperFetch SDK"
|
|
4241
|
-
},
|
|
4284
|
+
}, Io = {
|
|
4242
4285
|
enums: "Shared enums and app config used across apps",
|
|
4243
4286
|
cli: "Project tooling and code generators"
|
|
4244
4287
|
};
|
|
4245
|
-
function
|
|
4288
|
+
function Lo(e, t) {
|
|
4246
4289
|
return Object.entries(e).toSorted(([e], [t]) => e.localeCompare(t)).map(([e, n]) => {
|
|
4247
4290
|
let r = t[e];
|
|
4248
4291
|
return r ? `- \`${n}\` - ${r}` : `- \`${n}\``;
|
|
4249
4292
|
});
|
|
4250
4293
|
}
|
|
4251
|
-
function
|
|
4252
|
-
let { projectName: t, editor: n, workspace: r } = e, i =
|
|
4294
|
+
function Ro(e) {
|
|
4295
|
+
let { projectName: t, editor: n, workspace: r } = e, i = Qa(t), a = Po[n], o = !!r.apps.backend, s = Lo(r.apps, Fo), c = Lo(r.packages, Io), l = [];
|
|
4253
4296
|
s.length > 0 && l.push(...s), c.length > 0 && l.push(...c), l.push("- `stack.json` - Hype Stack workspace config (apps, paths, installed packs)");
|
|
4254
4297
|
let u = [];
|
|
4255
4298
|
u.push(`# ${i}`), u.push([
|
|
@@ -4352,13 +4395,13 @@ function jo(e) {
|
|
|
4352
4395
|
"stays useful."
|
|
4353
4396
|
].join("\n")), u.join("\n\n") + "\n";
|
|
4354
4397
|
}
|
|
4355
|
-
async function
|
|
4398
|
+
async function zo(e, t) {
|
|
4356
4399
|
let n = T.join(e, "README.md");
|
|
4357
|
-
await y.writeFile(n,
|
|
4400
|
+
await y.writeFile(n, Ro(t), "utf-8");
|
|
4358
4401
|
}
|
|
4359
4402
|
//#endregion
|
|
4360
4403
|
//#region src/core/tracking.ts
|
|
4361
|
-
async function
|
|
4404
|
+
async function Bo(e) {
|
|
4362
4405
|
try {
|
|
4363
4406
|
let t = {
|
|
4364
4407
|
"X-Device-Id": Xn(),
|
|
@@ -4372,7 +4415,7 @@ async function No(e) {
|
|
|
4372
4415
|
}
|
|
4373
4416
|
//#endregion
|
|
4374
4417
|
//#region src/core/npm-deps.ts
|
|
4375
|
-
function
|
|
4418
|
+
function Vo(e, t) {
|
|
4376
4419
|
let n = [], r = [];
|
|
4377
4420
|
if (!e) return {
|
|
4378
4421
|
errors: n,
|
|
@@ -4403,7 +4446,7 @@ function Po(e, t) {
|
|
|
4403
4446
|
operations: r
|
|
4404
4447
|
};
|
|
4405
4448
|
}
|
|
4406
|
-
function
|
|
4449
|
+
function Ho(e) {
|
|
4407
4450
|
let t = {};
|
|
4408
4451
|
for (let n of e) if (n) for (let [e, r] of Object.entries(n)) t[e] = {
|
|
4409
4452
|
...t[e],
|
|
@@ -4411,7 +4454,7 @@ function Fo(e) {
|
|
|
4411
4454
|
};
|
|
4412
4455
|
return t;
|
|
4413
4456
|
}
|
|
4414
|
-
async function
|
|
4457
|
+
async function Uo(e, t, n = q) {
|
|
4415
4458
|
let r = [];
|
|
4416
4459
|
for (let i of e) {
|
|
4417
4460
|
let e = T.join(t, i.relativeDir);
|
|
@@ -4447,14 +4490,14 @@ async function Io(e, t, n = q) {
|
|
|
4447
4490
|
function $(e) {
|
|
4448
4491
|
return e instanceof Error ? e.message : String(e);
|
|
4449
4492
|
}
|
|
4450
|
-
async function
|
|
4493
|
+
async function Wo(e, t, n) {
|
|
4451
4494
|
let r = e.filter((e) => e.tier === "paid" && !t.has(e.name)).map((e) => e.name);
|
|
4452
4495
|
return r.length === 0 ? {} : Vr(r, n).catch(() => ({}));
|
|
4453
4496
|
}
|
|
4454
|
-
function
|
|
4497
|
+
function Go(e, t) {
|
|
4455
4498
|
return e === "free" ? z.success("free") : e === "owned" ? z.accent("owned") : `${z.highlight(`$${t}`)} ${z.muted("locked")}`;
|
|
4456
4499
|
}
|
|
4457
|
-
async function
|
|
4500
|
+
async function Ko(e, t, n) {
|
|
4458
4501
|
let r = e.filter((e) => t(e)), i = e.filter((e) => !t(e));
|
|
4459
4502
|
i.length > 0 && s.log.warning(`Skipping ${i.join(", ")} because ${i.length === 1 ? "it depends" : "they depend"} on a pack you don't own yet.`), await rr(r.map((e) => n.get(e)).filter((e) => e !== void 0).map((e) => ({
|
|
4460
4503
|
name: e.name,
|
|
@@ -4462,7 +4505,7 @@ async function zo(e, t, n) {
|
|
|
4462
4505
|
price: e.price
|
|
4463
4506
|
})));
|
|
4464
4507
|
}
|
|
4465
|
-
function
|
|
4508
|
+
function qo(e, t) {
|
|
4466
4509
|
let n = e.map((e, n) => {
|
|
4467
4510
|
let r = t.get(e), i = r ? r.displayName : e;
|
|
4468
4511
|
return ` ${z.muted(`${n + 1}.`)} ${z.brand(i)}`;
|
|
@@ -4473,7 +4516,7 @@ function Bo(e, t) {
|
|
|
4473
4516
|
...n
|
|
4474
4517
|
].join("\n"), "Install Plan");
|
|
4475
4518
|
}
|
|
4476
|
-
async function
|
|
4519
|
+
async function Jo(e, t) {
|
|
4477
4520
|
let n = [];
|
|
4478
4521
|
for (let r of e) {
|
|
4479
4522
|
let e = await Fr(r), i = await Ir(r, t);
|
|
@@ -4485,21 +4528,21 @@ async function Vo(e, t) {
|
|
|
4485
4528
|
}
|
|
4486
4529
|
return n;
|
|
4487
4530
|
}
|
|
4488
|
-
async function
|
|
4489
|
-
let { prepared: t, paths: n, cwd: r, spinner: i } = e, a =
|
|
4531
|
+
async function Yo(e) {
|
|
4532
|
+
let { prepared: t, paths: n, cwd: r, spinner: i } = e, a = Vo(Ho(t.map((e) => e.manifest.dependencies_npm)), n);
|
|
4490
4533
|
if (a.errors.length > 0) {
|
|
4491
4534
|
for (let e of a.errors) s.log.error(e);
|
|
4492
4535
|
return;
|
|
4493
4536
|
}
|
|
4494
4537
|
if (a.operations.length === 0) return;
|
|
4495
4538
|
i.start("Installing npm dependencies...");
|
|
4496
|
-
let o = await
|
|
4539
|
+
let o = await Uo(a.operations, r);
|
|
4497
4540
|
if (i.stop(o.ok ? "npm dependencies installed" : "npm dependency installation failed"), !o.ok) for (let e of o.errors) s.log.error(e);
|
|
4498
4541
|
}
|
|
4499
|
-
function
|
|
4500
|
-
|
|
4542
|
+
function Xo() {
|
|
4543
|
+
_a([`${z.command("npx @hype-stack/cli onboard")} ${z.muted("(set up env vars + run migrations)")}`, `${z.command("pnpm dev")} ${z.muted("(start frontend + backend)")}`]);
|
|
4501
4544
|
}
|
|
4502
|
-
function
|
|
4545
|
+
function Zo(e) {
|
|
4503
4546
|
if (e.length === 0) return;
|
|
4504
4547
|
let t = e.map((e) => {
|
|
4505
4548
|
let t = e.replace(/^\{\{[^}]+\}\}\//, "");
|
|
@@ -4507,10 +4550,10 @@ function Wo(e) {
|
|
|
4507
4550
|
});
|
|
4508
4551
|
s.note(t.join("\n"), "Skipped (already exist)");
|
|
4509
4552
|
}
|
|
4510
|
-
async function
|
|
4553
|
+
async function Qo(e) {
|
|
4511
4554
|
let { prepared: t, config: n, cwd: r, force: i, yes: a, slotsByPack: o } = e, c = /* @__PURE__ */ new Set();
|
|
4512
4555
|
if (i) return c;
|
|
4513
|
-
let l = await
|
|
4556
|
+
let l = await na({
|
|
4514
4557
|
packs: t,
|
|
4515
4558
|
config: n,
|
|
4516
4559
|
projectRoot: r,
|
|
@@ -4537,7 +4580,7 @@ async function Go(e) {
|
|
|
4537
4580
|
}
|
|
4538
4581
|
//#endregion
|
|
4539
4582
|
//#region src/ui/swatch.ts
|
|
4540
|
-
function
|
|
4583
|
+
function $o(e) {
|
|
4541
4584
|
let t = e.trim().match(/^oklch\(([^)]+)\)$/i);
|
|
4542
4585
|
if (!t) return null;
|
|
4543
4586
|
let n = t[1].trim().split(/\s+/);
|
|
@@ -4556,56 +4599,56 @@ function Ko(e) {
|
|
|
4556
4599
|
h: a
|
|
4557
4600
|
};
|
|
4558
4601
|
}
|
|
4559
|
-
function
|
|
4602
|
+
function es(e) {
|
|
4560
4603
|
return Math.min(255, Math.max(0, Math.round(e)));
|
|
4561
4604
|
}
|
|
4562
|
-
function
|
|
4605
|
+
function ts(e) {
|
|
4563
4606
|
return e <= .0031308 ? 12.92 * e : 1.055 * e ** (1 / 2.4) - .055;
|
|
4564
4607
|
}
|
|
4565
|
-
function
|
|
4608
|
+
function ns({ l: e, c: t, h: n }) {
|
|
4566
4609
|
let r = n * Math.PI / 180, i = t * Math.cos(r), a = t * Math.sin(r), o = e + .3963377774 * i + .2158037573 * a, s = e - .1055613458 * i - .0638541728 * a, c = e - .0894841775 * i - 1.291485548 * a, l = o ** 3, u = s ** 3, d = c ** 3, f = 4.0767416621 * l - 3.3077115913 * u + .2309699292 * d, p = -1.2684380042 * l + 2.6097570613 * u - .3413193965 * d, m = -.0041960863 * l - .7034186147 * u + 1.7076146937 * d;
|
|
4567
4610
|
return [
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4611
|
+
es(ts(f) * 255),
|
|
4612
|
+
es(ts(p) * 255),
|
|
4613
|
+
es(ts(m) * 255)
|
|
4571
4614
|
];
|
|
4572
4615
|
}
|
|
4573
|
-
var
|
|
4574
|
-
function
|
|
4616
|
+
var rs = "\x1B[49m";
|
|
4617
|
+
function is(e, t) {
|
|
4575
4618
|
let n = e[t];
|
|
4576
4619
|
if (!n) return b.dim(" ");
|
|
4577
|
-
let r =
|
|
4620
|
+
let r = $o(n);
|
|
4578
4621
|
if (!r) return b.dim(" ");
|
|
4579
|
-
let [i, a, o] =
|
|
4580
|
-
return `\x1b[48;2;${i};${a};${o}m ${
|
|
4622
|
+
let [i, a, o] = ns(r);
|
|
4623
|
+
return `\x1b[48;2;${i};${a};${o}m ${rs}`;
|
|
4581
4624
|
}
|
|
4582
|
-
var
|
|
4625
|
+
var as = [
|
|
4583
4626
|
"primary",
|
|
4584
4627
|
"secondary",
|
|
4585
4628
|
"accent"
|
|
4586
4629
|
];
|
|
4587
|
-
function
|
|
4588
|
-
return
|
|
4630
|
+
function os(e) {
|
|
4631
|
+
return as.map((t) => is(e, t)).join("");
|
|
4589
4632
|
}
|
|
4590
|
-
function
|
|
4591
|
-
return `${
|
|
4633
|
+
function ss(e) {
|
|
4634
|
+
return `${os(e.light)} ${b.dim("·")} ${os(e.dark)}`;
|
|
4592
4635
|
}
|
|
4593
4636
|
//#endregion
|
|
4594
4637
|
//#region src/commands/create.ts
|
|
4595
|
-
async function
|
|
4596
|
-
e.skipBanner ||
|
|
4638
|
+
async function cs(e) {
|
|
4639
|
+
e.skipBanner || qa(), s.intro(z.brandBold("Create a new Hype Stack project"));
|
|
4597
4640
|
let o = e.yes === !0, c, l;
|
|
4598
4641
|
if (o && e.name) {
|
|
4599
|
-
let t =
|
|
4600
|
-
t && (s.log.error(t), Z()), l = e.name, c =
|
|
4642
|
+
let t = $a(e.name);
|
|
4643
|
+
t && (s.log.error(t), Z()), l = e.name, c = Za(e.name);
|
|
4601
4644
|
} else {
|
|
4602
4645
|
let t = await s.text({
|
|
4603
4646
|
message: "What is your project named?",
|
|
4604
4647
|
placeholder: "my-app",
|
|
4605
4648
|
initialValue: e.name ?? "",
|
|
4606
|
-
validate: (e) =>
|
|
4649
|
+
validate: (e) => $a(e ?? "")
|
|
4607
4650
|
});
|
|
4608
|
-
s.isCancel(t) && Z(), l = t, c =
|
|
4651
|
+
s.isCancel(t) && Z(), l = t, c = Za(l);
|
|
4609
4652
|
}
|
|
4610
4653
|
l.trim() !== c && s.log.info(z.muted(`Using "${z.highlight(c)}" as the project name`));
|
|
4611
4654
|
let u;
|
|
@@ -4649,7 +4692,7 @@ async function ts(e) {
|
|
|
4649
4692
|
message: "Pick a color theme",
|
|
4650
4693
|
options: r.map((e) => ({
|
|
4651
4694
|
value: e.name,
|
|
4652
|
-
label: `${
|
|
4695
|
+
label: `${ss(e)} ${e.label}`
|
|
4653
4696
|
})),
|
|
4654
4697
|
initialValue: h
|
|
4655
4698
|
});
|
|
@@ -4667,31 +4710,31 @@ async function ts(e) {
|
|
|
4667
4710
|
(s.isCancel(e) || !e) && Z();
|
|
4668
4711
|
}
|
|
4669
4712
|
let _ = s.spinner();
|
|
4670
|
-
_.start("Cloning Hype Stack template..."), await
|
|
4713
|
+
_.start("Cloning Hype Stack template..."), await uo(d), _.stop(z.success("Template cloned"));
|
|
4671
4714
|
let v = s.spinner();
|
|
4672
|
-
v.start("Setting up project..."), await
|
|
4715
|
+
v.start("Setting up project..."), await Co(d), await To(d, c), await vo(d, p);
|
|
4673
4716
|
let y = await jr(d), b = Nr(c, y);
|
|
4674
|
-
await Ar(d, b), await
|
|
4717
|
+
await Ar(d, b), await zo(d, {
|
|
4675
4718
|
projectName: c,
|
|
4676
4719
|
editor: p,
|
|
4677
4720
|
workspace: y
|
|
4678
4721
|
});
|
|
4679
4722
|
let x = T.resolve(d, b.paths?.frontend.root ?? "apps/frontend");
|
|
4680
|
-
a(g) && (await
|
|
4723
|
+
a(g) && (await lo(x, i(g)) || s.log.warn(z.muted(`Could not find ${z.path("assets/styles.css")} to apply the ${g} theme`))), await ro(x, e.defaultMode === "dark" || e.defaultMode === "light" ? e.defaultMode : "light") || s.log.warn(z.muted(`Could not find ${z.path("src/hooks/use-theme.ts")} to set the default color mode`)), v.stop(z.success("Project configured"));
|
|
4681
4724
|
let S = s.spinner();
|
|
4682
4725
|
S.start("Installing dependencies..."), (await q("pnpm", ["install"], { cwd: d })).exitCode === 0 ? S.stop(z.success("Dependencies installed")) : (S.stop(z.warning("Dependencies installed with warnings")), s.log.warn(z.muted("You may need to run `pnpm install` manually to resolve issues.")));
|
|
4683
4726
|
let C = s.spinner();
|
|
4684
|
-
C.start("Initializing git repository..."), await
|
|
4727
|
+
C.start("Initializing git repository..."), await wo(d), C.stop(z.success("Git repository initialized with clean history"));
|
|
4685
4728
|
let w = s.spinner();
|
|
4686
4729
|
w.start("Creating .env files from examples...");
|
|
4687
|
-
let E = await
|
|
4730
|
+
let E = await bo(d);
|
|
4688
4731
|
if (E.length > 0) {
|
|
4689
4732
|
let e = E.length;
|
|
4690
4733
|
w.stop(z.success(`Created ${e} .env file${e === 1 ? "" : "s"} from examples`));
|
|
4691
4734
|
} else w.stop(z.muted("No .env.example files to copy"));
|
|
4692
4735
|
s.log.success(`${z.brandBold("Hype Stack")} project ${z.highlight(c)} is ready!`);
|
|
4693
4736
|
let D = T.relative(process.cwd(), d) || ".", O = [`${z.command(`cd ${D}`)}`];
|
|
4694
|
-
E.length > 0 ? O.push(`Review your ${z.path(".env")} files and fill in any secrets`) : O.push(`Copy ${z.path(".env.example")} to ${z.path(".env")} and configure`),
|
|
4737
|
+
E.length > 0 ? O.push(`Review your ${z.path(".env")} files and fill in any secrets`) : O.push(`Copy ${z.path(".env.example")} to ${z.path(".env")} and configure`), _a(O);
|
|
4695
4738
|
let k = e.setup === !1;
|
|
4696
4739
|
if (e.deferSetup) s.log.info(z.muted("Docker and migrations will run after your packs are installed."));
|
|
4697
4740
|
else {
|
|
@@ -4699,15 +4742,15 @@ async function ts(e) {
|
|
|
4699
4742
|
message: "Would you like to start Docker services and run database migrations now?",
|
|
4700
4743
|
initialValue: !0
|
|
4701
4744
|
}));
|
|
4702
|
-
s.isCancel(e) && Z(), e ? await
|
|
4745
|
+
s.isCancel(e) && Z(), e ? await Oa(d, o) : s.log.info(z.muted("Docker and migrations can run later via `npx @hype-stack/cli onboard`.")), Xo();
|
|
4703
4746
|
}
|
|
4704
|
-
return await
|
|
4747
|
+
return await Bo("project_create"), s.outro(z.muted("Happy building!")), d;
|
|
4705
4748
|
}
|
|
4706
4749
|
//#endregion
|
|
4707
4750
|
//#region src/commands/init.ts
|
|
4708
|
-
async function
|
|
4751
|
+
async function ls(e) {
|
|
4709
4752
|
let t = e.cwd ?? process.cwd(), n = e.silent ?? !1;
|
|
4710
|
-
if (n || (
|
|
4753
|
+
if (n || (Ja(), s.intro(z.brandBold("Initialize Hype Stack configuration"))), !await Pr(t)) {
|
|
4711
4754
|
s.log.error(`This doesn't look like a Hype Stack project. ${z.muted("Expected apps/ directory and package.json")}`), s.outro(z.muted(`Run ${z.command("npx @hype-stack/cli create")} to scaffold a new project.`));
|
|
4712
4755
|
return;
|
|
4713
4756
|
}
|
|
@@ -4744,21 +4787,21 @@ async function ns(e) {
|
|
|
4744
4787
|
message: "Project name for stack.json?",
|
|
4745
4788
|
placeholder: i,
|
|
4746
4789
|
initialValue: i,
|
|
4747
|
-
validate: (e) =>
|
|
4790
|
+
validate: (e) => $a(e ?? "")
|
|
4748
4791
|
});
|
|
4749
|
-
s.isCancel(e) && Z(), a =
|
|
4792
|
+
s.isCancel(e) && Z(), a = Za(e);
|
|
4750
4793
|
}
|
|
4751
4794
|
await Ar(t, Nr(a, r)), n || (s.log.success(`${z.path("stack.json")} written successfully`), s.outro(z.muted("Your project is mapped and ready for Hype Stack CLI commands.")));
|
|
4752
4795
|
}
|
|
4753
|
-
async function
|
|
4796
|
+
async function us(e, t = {}, n) {
|
|
4754
4797
|
if (await kr(e)) return {
|
|
4755
4798
|
projectRoot: e,
|
|
4756
4799
|
scaffolded: !1
|
|
4757
4800
|
};
|
|
4758
|
-
let r = t.runInit ?? ((e) =>
|
|
4801
|
+
let r = t.runInit ?? ((e) => ls({
|
|
4759
4802
|
cwd: e,
|
|
4760
4803
|
silent: !0
|
|
4761
|
-
})), i = t.runCreate ?? ((e, t) =>
|
|
4804
|
+
})), i = t.runCreate ?? ((e, t) => cs({
|
|
4762
4805
|
parentDirectory: e,
|
|
4763
4806
|
deferSetup: !0,
|
|
4764
4807
|
skipBanner: !0,
|
|
@@ -4798,10 +4841,10 @@ async function rs(e, t = {}, n) {
|
|
|
4798
4841
|
}
|
|
4799
4842
|
//#endregion
|
|
4800
4843
|
//#region src/commands/compose.ts
|
|
4801
|
-
async function
|
|
4844
|
+
async function ds(e = {}) {
|
|
4802
4845
|
let t = e.cwd ?? process.cwd();
|
|
4803
|
-
|
|
4804
|
-
let n = await
|
|
4846
|
+
qa();
|
|
4847
|
+
let n = await us(t), r = n?.projectRoot ?? null, i = n?.scaffolded ?? !1, a;
|
|
4805
4848
|
try {
|
|
4806
4849
|
a = await Or(r ?? t);
|
|
4807
4850
|
} catch (e) {
|
|
@@ -4819,13 +4862,13 @@ async function is(e = {}) {
|
|
|
4819
4862
|
c.stop("Failed to load packs"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${$(e)}`), process.exit(1);
|
|
4820
4863
|
}
|
|
4821
4864
|
c.stop("Packs loaded");
|
|
4822
|
-
let u = a.installedPacks ?? [], d = new Set(u), f = new Map(l.map((e) => [e.name, e])), p = e.licenseKey ?? a.licenseKey ?? null, m = (await Kn(I()))?.token ?? null, h = await
|
|
4865
|
+
let u = a.installedPacks ?? [], d = new Set(u), f = new Map(l.map((e) => [e.name, e])), p = e.licenseKey ?? a.licenseKey ?? null, m = (await Kn(I()))?.token ?? null, h = await Wo(l, d, {
|
|
4823
4866
|
token: m,
|
|
4824
4867
|
key: p
|
|
4825
4868
|
}), g = (e) => {
|
|
4826
4869
|
let t = f.get(e);
|
|
4827
4870
|
return !t || t.tier === "free" ? "free" : h[e]?.owned ? "owned" : "locked";
|
|
4828
|
-
}, _ = (e) => !d.has(e) && g(e) === "locked", v = await
|
|
4871
|
+
}, _ = (e) => !d.has(e) && g(e) === "locked", v = await fs({
|
|
4829
4872
|
packs: l,
|
|
4830
4873
|
installedSet: d,
|
|
4831
4874
|
stateOf: g,
|
|
@@ -4836,9 +4879,9 @@ async function is(e = {}) {
|
|
|
4836
4879
|
s.outro(z.muted("No packs selected. Nothing to do."));
|
|
4837
4880
|
return;
|
|
4838
4881
|
}
|
|
4839
|
-
let b =
|
|
4882
|
+
let b = hs(v), x = gs(v), S = La(l, b), C = Aa(Ra(l, S)), w;
|
|
4840
4883
|
try {
|
|
4841
|
-
w =
|
|
4884
|
+
w = Ma(b, C, u);
|
|
4842
4885
|
} catch (e) {
|
|
4843
4886
|
s.cancel($(e)), process.exit(1);
|
|
4844
4887
|
}
|
|
@@ -4846,7 +4889,7 @@ async function is(e = {}) {
|
|
|
4846
4889
|
s.note(`${w.alreadyInstalled.join(", ")} already installed.`, "Nothing to do"), s.outro(z.muted("Your selection is already part of the project."));
|
|
4847
4890
|
return;
|
|
4848
4891
|
}
|
|
4849
|
-
let T =
|
|
4892
|
+
let T = Na({
|
|
4850
4893
|
order: w.order,
|
|
4851
4894
|
graph: C,
|
|
4852
4895
|
isLocked: _,
|
|
@@ -4854,28 +4897,28 @@ async function is(e = {}) {
|
|
|
4854
4897
|
});
|
|
4855
4898
|
if (T.blocked.length > 0 && !m && !p) {
|
|
4856
4899
|
let e = await nr();
|
|
4857
|
-
e && (m = e, h = await
|
|
4900
|
+
e && (m = e, h = await Wo(l, d, {
|
|
4858
4901
|
token: m,
|
|
4859
4902
|
key: p
|
|
4860
|
-
}), T =
|
|
4903
|
+
}), T = Na({
|
|
4861
4904
|
order: w.order,
|
|
4862
4905
|
graph: C,
|
|
4863
4906
|
isLocked: _,
|
|
4864
4907
|
installed: u
|
|
4865
4908
|
}));
|
|
4866
4909
|
}
|
|
4867
|
-
if (T.blocked.length > 0 && await
|
|
4910
|
+
if (T.blocked.length > 0 && await Ko(T.blocked, _, f), T.installable.length === 0) {
|
|
4868
4911
|
s.outro(z.muted("Nothing left to install once locked packs are removed."));
|
|
4869
4912
|
return;
|
|
4870
4913
|
}
|
|
4871
|
-
if (
|
|
4914
|
+
if (qo(T.installable, f), !e.yes) {
|
|
4872
4915
|
let e = await s.confirm({ message: `Install ${T.installable.length} pack${T.installable.length === 1 ? "" : "s"}?` });
|
|
4873
4916
|
(s.isCancel(e) || !e) && (s.cancel("Installation cancelled."), process.exit(0));
|
|
4874
4917
|
}
|
|
4875
4918
|
c.start("Downloading packs...");
|
|
4876
4919
|
let E;
|
|
4877
4920
|
try {
|
|
4878
|
-
E = await
|
|
4921
|
+
E = await Jo(T.installable, {
|
|
4879
4922
|
token: m,
|
|
4880
4923
|
key: p
|
|
4881
4924
|
});
|
|
@@ -4883,7 +4926,7 @@ async function is(e = {}) {
|
|
|
4883
4926
|
c.stop("Download failed"), s.cancel($(e)), process.exit(1);
|
|
4884
4927
|
}
|
|
4885
4928
|
c.stop(`Downloaded ${E.length} pack${E.length === 1 ? "" : "s"}`);
|
|
4886
|
-
let D = await
|
|
4929
|
+
let D = await Qo({
|
|
4887
4930
|
prepared: E,
|
|
4888
4931
|
config: a,
|
|
4889
4932
|
cwd: o,
|
|
@@ -4893,7 +4936,7 @@ async function is(e = {}) {
|
|
|
4893
4936
|
});
|
|
4894
4937
|
try {
|
|
4895
4938
|
c.start("Installing pack files...");
|
|
4896
|
-
let t = await
|
|
4939
|
+
let t = await aa({
|
|
4897
4940
|
packs: E,
|
|
4898
4941
|
config: a,
|
|
4899
4942
|
projectRoot: o,
|
|
@@ -4906,22 +4949,22 @@ async function is(e = {}) {
|
|
|
4906
4949
|
for (let e of t.errors) s.log.error(e);
|
|
4907
4950
|
s.cancel("No files were written. Fix the errors above (or pass --force for existing files) and try again."), process.exit(1);
|
|
4908
4951
|
}
|
|
4909
|
-
c.stop("Files installed"), t.installed.length > 0 && s.log.success(`${z.highlight(String(t.installed.length))} files installed`), t.skipped.length > 0 && (s.log.warning(`${t.skipped.length} files skipped (use --force to overwrite)`),
|
|
4952
|
+
c.stop("Files installed"), t.installed.length > 0 && s.log.success(`${z.highlight(String(t.installed.length))} files installed`), t.skipped.length > 0 && (s.log.warning(`${t.skipped.length} files skipped (use --force to overwrite)`), Zo(t.skipped));
|
|
4910
4953
|
for (let e of t.errors) s.log.error(e);
|
|
4911
|
-
await
|
|
4954
|
+
await Yo({
|
|
4912
4955
|
prepared: E,
|
|
4913
4956
|
paths: a.paths,
|
|
4914
4957
|
cwd: o,
|
|
4915
4958
|
spinner: c
|
|
4916
4959
|
});
|
|
4917
4960
|
let n;
|
|
4918
|
-
i && (n = await
|
|
4961
|
+
i && (n = await ka(o, e.yes ?? !1)), await pr({
|
|
4919
4962
|
projectRoot: o,
|
|
4920
4963
|
paths: a.paths,
|
|
4921
4964
|
skipPrompts: e.yes ?? !1,
|
|
4922
4965
|
dbReady: n,
|
|
4923
4966
|
freshScaffold: i
|
|
4924
|
-
}),
|
|
4967
|
+
}), Xo(), s.outro(z.brand(`Installed ${t.appliedPacks.join(", ")}.`));
|
|
4925
4968
|
} finally {
|
|
4926
4969
|
await Promise.all(E.map((e) => y.rm(e.packDir, {
|
|
4927
4970
|
recursive: !0,
|
|
@@ -4929,10 +4972,10 @@ async function is(e = {}) {
|
|
|
4929
4972
|
})));
|
|
4930
4973
|
}
|
|
4931
4974
|
}
|
|
4932
|
-
async function
|
|
4975
|
+
async function fs(e) {
|
|
4933
4976
|
let { packs: t, installedSet: n, stateOf: r, options: i, adminAvailable: a } = e;
|
|
4934
4977
|
if (i.packs && i.packs.length > 0) {
|
|
4935
|
-
let e = i.packs.map(
|
|
4978
|
+
let e = i.packs.map(ms), n = e.filter((e) => !t.some((t) => t.name === e.name));
|
|
4936
4979
|
return n.length > 0 && (s.cancel(`Unknown pack${n.length === 1 ? "" : "s"}: ${n.map((e) => e.name).join(", ")}`), process.exit(1)), e;
|
|
4937
4980
|
}
|
|
4938
4981
|
let o = t.filter((e) => n.has(e.name));
|
|
@@ -4941,13 +4984,13 @@ async function as(e) {
|
|
|
4941
4984
|
if (c.length === 0) return s.outro(z.muted("Every available pack is already installed.")), [];
|
|
4942
4985
|
let l = ce();
|
|
4943
4986
|
s.note(c.map((e) => ` ${B.arrow} ${z.highlight(e.displayName)} ${ge(`${l}/packs/${e.name}`)}`).join("\n"), "Browse packs");
|
|
4944
|
-
let u =
|
|
4987
|
+
let u = pa(c, { adminAvailable: a }), d = [];
|
|
4945
4988
|
for (let e of u) {
|
|
4946
4989
|
let t = e.packs.map((e) => {
|
|
4947
4990
|
let t = r(e.name);
|
|
4948
4991
|
return {
|
|
4949
4992
|
value: e.name,
|
|
4950
|
-
label: `${e.displayName} ${
|
|
4993
|
+
label: `${e.displayName} ${Go(t, e.price)}`,
|
|
4951
4994
|
hint: e.description
|
|
4952
4995
|
};
|
|
4953
4996
|
});
|
|
@@ -4964,7 +5007,7 @@ async function as(e) {
|
|
|
4964
5007
|
});
|
|
4965
5008
|
continue;
|
|
4966
5009
|
}
|
|
4967
|
-
let n = await
|
|
5010
|
+
let n = await Xa({
|
|
4968
5011
|
message: `Select ${e.label.toLowerCase()} to add (optional)`,
|
|
4969
5012
|
options: t,
|
|
4970
5013
|
required: !1
|
|
@@ -4974,20 +5017,20 @@ async function as(e) {
|
|
|
4974
5017
|
}
|
|
4975
5018
|
return d;
|
|
4976
5019
|
}
|
|
4977
|
-
var
|
|
4978
|
-
function
|
|
4979
|
-
let t = e.match(
|
|
5020
|
+
var ps = /@(frontend|admin)$/;
|
|
5021
|
+
function ms(e) {
|
|
5022
|
+
let t = e.match(ps);
|
|
4980
5023
|
return t ? {
|
|
4981
5024
|
name: e.slice(0, -t[0].length),
|
|
4982
5025
|
slot: t[1]
|
|
4983
5026
|
} : { name: e };
|
|
4984
5027
|
}
|
|
4985
|
-
function
|
|
5028
|
+
function hs(e) {
|
|
4986
5029
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
4987
5030
|
for (let r of e) t.has(r.name) || (t.add(r.name), n.push(r.name));
|
|
4988
5031
|
return n;
|
|
4989
5032
|
}
|
|
4990
|
-
function
|
|
5033
|
+
function gs(e) {
|
|
4991
5034
|
let t = /* @__PURE__ */ new Map();
|
|
4992
5035
|
for (let n of e) {
|
|
4993
5036
|
if (!n.slot) continue;
|
|
@@ -4998,8 +5041,8 @@ function ls(e) {
|
|
|
4998
5041
|
}
|
|
4999
5042
|
//#endregion
|
|
5000
5043
|
//#region src/commands/login.ts
|
|
5001
|
-
async function
|
|
5002
|
-
|
|
5044
|
+
async function _s() {
|
|
5045
|
+
Ja(), s.intro(z.brandBold("Log in to Hype Stack")), s.log.step("Opening your browser to sign in...");
|
|
5003
5046
|
let e;
|
|
5004
5047
|
try {
|
|
5005
5048
|
e = await tr({ onUrl: (e) => {
|
|
@@ -5012,8 +5055,8 @@ async function us() {
|
|
|
5012
5055
|
}
|
|
5013
5056
|
//#endregion
|
|
5014
5057
|
//#region src/commands/logout.ts
|
|
5015
|
-
async function
|
|
5016
|
-
|
|
5058
|
+
async function vs() {
|
|
5059
|
+
Ja(), s.intro(z.brandBold("Log out of Hype Stack"));
|
|
5017
5060
|
let e = I(), t = await Kn(e);
|
|
5018
5061
|
if (!t) {
|
|
5019
5062
|
s.outro(z.muted("You're not logged in."));
|
|
@@ -5023,7 +5066,7 @@ async function ds() {
|
|
|
5023
5066
|
}
|
|
5024
5067
|
//#endregion
|
|
5025
5068
|
//#region src/core/onboard-env.ts
|
|
5026
|
-
function
|
|
5069
|
+
function ys(e) {
|
|
5027
5070
|
let t = [], n = "";
|
|
5028
5071
|
for (let r of e.split(/\r?\n/)) {
|
|
5029
5072
|
let e = r.trim();
|
|
@@ -5049,7 +5092,7 @@ function fs(e) {
|
|
|
5049
5092
|
}
|
|
5050
5093
|
return t;
|
|
5051
5094
|
}
|
|
5052
|
-
function
|
|
5095
|
+
function bs(e, t, n) {
|
|
5053
5096
|
let r = e.split(/\r?\n/), i = !1, a = r.map((e) => {
|
|
5054
5097
|
if (i) return e;
|
|
5055
5098
|
let r = e.trim();
|
|
@@ -5059,22 +5102,22 @@ function ps(e, t, n) {
|
|
|
5059
5102
|
});
|
|
5060
5103
|
return i ? a.join("\n") : e + `${e.length > 0 && !e.endsWith("\n") ? "\n" : ""}${t}=${n}\n`;
|
|
5061
5104
|
}
|
|
5062
|
-
async function
|
|
5105
|
+
async function xs(e) {
|
|
5063
5106
|
return await J(e) ? y.readFile(e, "utf-8") : "";
|
|
5064
5107
|
}
|
|
5065
|
-
async function
|
|
5108
|
+
async function Ss(e) {
|
|
5066
5109
|
let t = T.join(T.dirname(e), ".env");
|
|
5067
5110
|
return await J(t) || await y.copyFile(e, t), t;
|
|
5068
5111
|
}
|
|
5069
|
-
async function
|
|
5070
|
-
let r =
|
|
5112
|
+
async function Cs(e, t, n) {
|
|
5113
|
+
let r = bs(await xs(e), t, n);
|
|
5071
5114
|
await y.writeFile(e, r, "utf-8");
|
|
5072
5115
|
}
|
|
5073
5116
|
//#endregion
|
|
5074
5117
|
//#region src/commands/onboard.ts
|
|
5075
|
-
async function
|
|
5118
|
+
async function ws(e = {}) {
|
|
5076
5119
|
let t = e.cwd ?? process.cwd();
|
|
5077
|
-
|
|
5120
|
+
qa(), s.intro(z.brandBold("Onboard your stack"));
|
|
5078
5121
|
let n;
|
|
5079
5122
|
try {
|
|
5080
5123
|
n = await Or(t);
|
|
@@ -5082,19 +5125,19 @@ async function _s(e = {}) {
|
|
|
5082
5125
|
n = null;
|
|
5083
5126
|
}
|
|
5084
5127
|
n || (s.cancel(`${z.path("stack.json")} not found. Run ${z.command("npx @hype-stack/cli init")} first.`), process.exit(1));
|
|
5085
|
-
let r = n.installedPacks ?? [], i = n.onboarding?.envSections ?? [], a = await
|
|
5128
|
+
let r = n.installedPacks ?? [], i = n.onboarding?.envSections ?? [], a = await xo(t);
|
|
5086
5129
|
a.length === 0 && s.log.warn(z.muted("No .env.example files found; skipping env setup."));
|
|
5087
|
-
for (let n of a) await
|
|
5130
|
+
for (let n of a) await Ts({
|
|
5088
5131
|
examplePath: n,
|
|
5089
5132
|
projectRoot: t,
|
|
5090
5133
|
skipPrompts: e.yes ?? !1,
|
|
5091
5134
|
installedEnvSections: i
|
|
5092
5135
|
});
|
|
5093
5136
|
let o = Dr(r);
|
|
5094
|
-
o.length > 0 && s.note(o.map((e) => ` ${z.muted("·")} ${e}`).join("\n"), "Tips"), e.skipMigrations || await
|
|
5137
|
+
o.length > 0 && s.note(o.map((e) => ` ${z.muted("·")} ${e}`).join("\n"), "Tips"), e.skipMigrations || await Os(t, e.yes ?? !1), s.outro(z.brand(`All set. Run ${z.command("pnpm dev")} to start your app.`));
|
|
5095
5138
|
}
|
|
5096
|
-
async function
|
|
5097
|
-
let { examplePath: t, projectRoot: n, skipPrompts: r, installedEnvSections: i } = e, a = T.relative(n, t) || t, o = await
|
|
5139
|
+
async function Ts(e) {
|
|
5140
|
+
let { examplePath: t, projectRoot: n, skipPrompts: r, installedEnvSections: i } = e, a = T.relative(n, t) || t, o = await Ss(t), c = await xs(o), l = ys(await y.readFile(t, "utf-8")), u = z.path(a);
|
|
5098
5141
|
s.log.step(`Env: ${u}`);
|
|
5099
5142
|
for (let e of l) {
|
|
5100
5143
|
if (e.vars.length === 0) continue;
|
|
@@ -5110,7 +5153,7 @@ async function vs(e) {
|
|
|
5110
5153
|
s.log.info(`${z.label(n.key)} ${z.muted("skipped (non-interactive)")}`);
|
|
5111
5154
|
continue;
|
|
5112
5155
|
}
|
|
5113
|
-
let e =
|
|
5156
|
+
let e = Es(c, n.key), i = await s.text({
|
|
5114
5157
|
message: `${z.label(n.key)}`,
|
|
5115
5158
|
placeholder: e ? `${e} ${z.muted("(Enter keeps this)")}` : t.hint
|
|
5116
5159
|
});
|
|
@@ -5120,31 +5163,31 @@ async function vs(e) {
|
|
|
5120
5163
|
s.log.info(z.muted(`${n.key} unchanged.`));
|
|
5121
5164
|
continue;
|
|
5122
5165
|
}
|
|
5123
|
-
await
|
|
5166
|
+
await Cs(o, n.key, a), s.log.success(`${n.key} saved`);
|
|
5124
5167
|
}
|
|
5125
5168
|
}
|
|
5126
5169
|
}
|
|
5127
|
-
function
|
|
5170
|
+
function Es(e, t) {
|
|
5128
5171
|
for (let n of e.split(/\r?\n/)) {
|
|
5129
|
-
let e = n.match(RegExp(`^${
|
|
5172
|
+
let e = n.match(RegExp(`^${Ds(t)}\\s*=\\s*(.*)$`));
|
|
5130
5173
|
if (e) return e[1].trim();
|
|
5131
5174
|
}
|
|
5132
5175
|
return "";
|
|
5133
5176
|
}
|
|
5134
|
-
function
|
|
5177
|
+
function Ds(e) {
|
|
5135
5178
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5136
5179
|
}
|
|
5137
|
-
async function
|
|
5138
|
-
if (!await
|
|
5180
|
+
async function Os(e, t) {
|
|
5181
|
+
if (!await va() && !await ba(e, t, !1)) {
|
|
5139
5182
|
s.log.info(z.muted(`Start services later with ${z.command("docker compose up -d")} (in apps/backend), then ${z.command("pnpm --filter @internal/backend migration:latest")}.`));
|
|
5140
5183
|
return;
|
|
5141
5184
|
}
|
|
5142
5185
|
let n = s.spinner();
|
|
5143
|
-
if (n.start("Waiting for Postgres to be ready..."), !await
|
|
5186
|
+
if (n.start("Waiting for Postgres to be ready..."), !await Sa(e)) {
|
|
5144
5187
|
n.error("Postgres health check timed out"), s.log.warn(z.muted(`Run migrations manually once Postgres is ready: ${z.command("pnpm --filter @internal/backend migration:latest")}`));
|
|
5145
5188
|
return;
|
|
5146
5189
|
}
|
|
5147
|
-
if (n.stop(z.success("Postgres is ready")), await
|
|
5190
|
+
if (n.stop(z.success("Postgres is ready")), await wa(e)) {
|
|
5148
5191
|
s.log.info(z.muted("Migrations already applied, skipping."));
|
|
5149
5192
|
return;
|
|
5150
5193
|
}
|
|
@@ -5156,20 +5199,20 @@ async function xs(e, t) {
|
|
|
5156
5199
|
s.log.info(z.muted("Skipping database migrations."));
|
|
5157
5200
|
return;
|
|
5158
5201
|
}
|
|
5159
|
-
await
|
|
5202
|
+
await Ta(e);
|
|
5160
5203
|
}
|
|
5161
5204
|
//#endregion
|
|
5162
5205
|
//#region src/core/templates.ts
|
|
5163
|
-
var
|
|
5206
|
+
var ks = K.createRequest()({
|
|
5164
5207
|
endpoint: "/templates/list",
|
|
5165
5208
|
method: "GET"
|
|
5166
5209
|
});
|
|
5167
|
-
async function
|
|
5168
|
-
let { data: e, error: t } = await
|
|
5210
|
+
async function As() {
|
|
5211
|
+
let { data: e, error: t } = await ks.send();
|
|
5169
5212
|
if (t || !e) throw Error(`Failed to fetch template list: ${String(t)}`);
|
|
5170
5213
|
return e.templates;
|
|
5171
5214
|
}
|
|
5172
|
-
async function
|
|
5215
|
+
async function js(e) {
|
|
5173
5216
|
let { data: t, error: n, status: r } = await K.createRequest()({
|
|
5174
5217
|
endpoint: `/templates/${encodeURIComponent(e)}/manifest`,
|
|
5175
5218
|
method: "GET"
|
|
@@ -5178,7 +5221,7 @@ async function ws(e) {
|
|
|
5178
5221
|
if (n || !t) throw Error(`Failed to load manifest for template "${e}": ${String(n)}`);
|
|
5179
5222
|
return t;
|
|
5180
5223
|
}
|
|
5181
|
-
async function
|
|
5224
|
+
async function Ms(e, t = {}) {
|
|
5182
5225
|
let n = K.createRequest()({
|
|
5183
5226
|
endpoint: `/templates/${encodeURIComponent(e)}/download`,
|
|
5184
5227
|
method: "POST"
|
|
@@ -5206,9 +5249,9 @@ async function Ts(e, t = {}) {
|
|
|
5206
5249
|
}
|
|
5207
5250
|
//#endregion
|
|
5208
5251
|
//#region src/commands/template.ts
|
|
5209
|
-
async function
|
|
5252
|
+
async function Ns(t = {}) {
|
|
5210
5253
|
let n = t.cwd ?? process.cwd();
|
|
5211
|
-
|
|
5254
|
+
qa();
|
|
5212
5255
|
let r = s.spinner();
|
|
5213
5256
|
r.start("Loading packs...");
|
|
5214
5257
|
let o;
|
|
@@ -5220,7 +5263,7 @@ async function Es(t = {}) {
|
|
|
5220
5263
|
r.stop("Packs loaded"), r.start("Loading templates...");
|
|
5221
5264
|
let c;
|
|
5222
5265
|
try {
|
|
5223
|
-
c = await
|
|
5266
|
+
c = await As();
|
|
5224
5267
|
} catch (e) {
|
|
5225
5268
|
r.stop("Failed to load templates"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${$(e)}`), process.exit(1);
|
|
5226
5269
|
}
|
|
@@ -5243,11 +5286,11 @@ async function Es(t = {}) {
|
|
|
5243
5286
|
u || (r.stop("Template not found"), s.cancel(`Template "${l}" not found. Available: ${c.map((e) => e.id).join(", ") || "(none)"}`), process.exit(1)), r.stop(`Template: ${u.name}`);
|
|
5244
5287
|
let d;
|
|
5245
5288
|
try {
|
|
5246
|
-
d = await
|
|
5289
|
+
d = await js(u.id);
|
|
5247
5290
|
} catch (e) {
|
|
5248
5291
|
s.cancel($(e)), process.exit(1);
|
|
5249
5292
|
}
|
|
5250
|
-
let f = await
|
|
5293
|
+
let f = await us(n, {}, {
|
|
5251
5294
|
defaultTheme: d.theme,
|
|
5252
5295
|
defaultMode: d.defaultMode
|
|
5253
5296
|
}), p = f?.projectRoot ?? null, m = f?.scaffolded ?? !1, h;
|
|
@@ -5259,59 +5302,59 @@ async function Es(t = {}) {
|
|
|
5259
5302
|
h || (s.cancel(p ? `Could not read ${z.path("stack.json")}. Run 'npx @hype-stack/cli init' to regenerate it, then run 'npx @hype-stack/cli template' again.` : `No ${z.path("stack.json")}. Run 'npx @hype-stack/cli init' first, then 'npx @hype-stack/cli template'.`), process.exit(1)), h.paths || (s.cancel(`${z.path("stack.json")} is missing ${z.path("paths")}. Run 'npx @hype-stack/cli init' again to regenerate it.`), process.exit(1));
|
|
5260
5303
|
let g = p ?? n;
|
|
5261
5304
|
s.intro(z.brandBold("Install a template"));
|
|
5262
|
-
let _ = h.installedPacks ?? [], v = new Set(_), b = new Map(o.map((e) => [e.name, e])), x = t.licenseKey ?? h.licenseKey ?? null, S = (await Kn(I()))?.token ?? null, C = await
|
|
5305
|
+
let _ = h.installedPacks ?? [], v = new Set(_), b = new Map(o.map((e) => [e.name, e])), x = t.licenseKey ?? h.licenseKey ?? null, S = (await Kn(I()))?.token ?? null, C = await Ps(u, t.variants, t.yes ?? !1), w = Pa(u.slots, C), E = Fa(u.slots, u.packs, w), D = await Fs({
|
|
5263
5306
|
packs: o,
|
|
5264
5307
|
templatePacks: E,
|
|
5265
5308
|
installedSet: v,
|
|
5266
5309
|
options: t
|
|
5267
5310
|
}), O = [...E, ...D.filter((e) => !E.includes(e))], k = O.filter((e) => !b.has(e));
|
|
5268
5311
|
k.length > 0 && (s.cancel(`Unknown pack${k.length === 1 ? "" : "s"}: ${k.join(", ")}`), process.exit(1));
|
|
5269
|
-
let ee =
|
|
5312
|
+
let ee = Ra(o, w), A = Aa(ee), j;
|
|
5270
5313
|
try {
|
|
5271
|
-
|
|
5314
|
+
j = Ma(O, A, _);
|
|
5272
5315
|
} catch (e) {
|
|
5273
5316
|
s.cancel($(e)), process.exit(1);
|
|
5274
5317
|
}
|
|
5275
|
-
if (
|
|
5318
|
+
if (j.order.length === 0) {
|
|
5276
5319
|
s.outro(z.muted("Every pack in this template is already installed."));
|
|
5277
5320
|
return;
|
|
5278
5321
|
}
|
|
5279
|
-
let
|
|
5322
|
+
let te = await Wo(ee, v, {
|
|
5280
5323
|
token: S,
|
|
5281
5324
|
key: x
|
|
5282
5325
|
}), ne = (e) => {
|
|
5283
5326
|
let t = b.get(e);
|
|
5284
|
-
return !t || t.tier === "free" ? "free" :
|
|
5285
|
-
}, M = (e) => !v.has(e) && ne(e) === "locked", N =
|
|
5286
|
-
order:
|
|
5327
|
+
return !t || t.tier === "free" ? "free" : te[e]?.owned ? "owned" : "locked";
|
|
5328
|
+
}, M = (e) => !v.has(e) && ne(e) === "locked", N = Na({
|
|
5329
|
+
order: j.order,
|
|
5287
5330
|
graph: A,
|
|
5288
5331
|
isLocked: M,
|
|
5289
5332
|
installed: _
|
|
5290
5333
|
});
|
|
5291
5334
|
if (N.blocked.length > 0 && !S && !x) {
|
|
5292
5335
|
let e = await nr();
|
|
5293
|
-
e && (S = e,
|
|
5336
|
+
e && (S = e, te = await Wo(ee, v, {
|
|
5294
5337
|
token: S,
|
|
5295
5338
|
key: x
|
|
5296
|
-
}), N =
|
|
5297
|
-
order:
|
|
5339
|
+
}), N = Na({
|
|
5340
|
+
order: j.order,
|
|
5298
5341
|
graph: A,
|
|
5299
5342
|
isLocked: M,
|
|
5300
5343
|
installed: _
|
|
5301
5344
|
}));
|
|
5302
5345
|
}
|
|
5303
|
-
if (N.blocked.length > 0 && await
|
|
5346
|
+
if (N.blocked.length > 0 && await Ko(N.blocked, M, b), N.installable.length === 0) {
|
|
5304
5347
|
s.outro(z.muted("Nothing left to install once locked packs are removed."));
|
|
5305
5348
|
return;
|
|
5306
5349
|
}
|
|
5307
|
-
if (
|
|
5350
|
+
if (qo(N.installable, b), !t.yes) {
|
|
5308
5351
|
let e = await s.confirm({ message: `Install template ${z.brandBold(u.name)} (${N.installable.length} pack${N.installable.length === 1 ? "" : "s"})?` });
|
|
5309
5352
|
(s.isCancel(e) || !e) && (s.cancel("Installation cancelled."), process.exit(0));
|
|
5310
5353
|
}
|
|
5311
5354
|
r.start("Downloading packs...");
|
|
5312
5355
|
let P;
|
|
5313
5356
|
try {
|
|
5314
|
-
P = await
|
|
5357
|
+
P = await Jo(N.installable, {
|
|
5315
5358
|
token: S,
|
|
5316
5359
|
key: x
|
|
5317
5360
|
});
|
|
@@ -5319,7 +5362,7 @@ async function Es(t = {}) {
|
|
|
5319
5362
|
r.stop("Download failed"), s.cancel($(e)), process.exit(1);
|
|
5320
5363
|
}
|
|
5321
5364
|
r.stop(`Downloaded ${P.length} pack${P.length === 1 ? "" : "s"}`);
|
|
5322
|
-
let re = await
|
|
5365
|
+
let re = await Qo({
|
|
5323
5366
|
prepared: P,
|
|
5324
5367
|
config: h,
|
|
5325
5368
|
cwd: g,
|
|
@@ -5328,7 +5371,7 @@ async function Es(t = {}) {
|
|
|
5328
5371
|
}), F = null;
|
|
5329
5372
|
try {
|
|
5330
5373
|
r.start("Installing pack files...");
|
|
5331
|
-
let n = await
|
|
5374
|
+
let n = await aa({
|
|
5332
5375
|
packs: P,
|
|
5333
5376
|
config: h,
|
|
5334
5377
|
projectRoot: g,
|
|
@@ -5340,15 +5383,15 @@ async function Es(t = {}) {
|
|
|
5340
5383
|
for (let e of n.errors) s.log.error(e);
|
|
5341
5384
|
s.cancel("No files were written. Fix the errors above (or pass --force for existing files) and try again."), process.exit(1);
|
|
5342
5385
|
}
|
|
5343
|
-
r.stop("Files installed"), n.installed.length > 0 && s.log.success(`${z.highlight(String(n.installed.length))} files installed`), n.skipped.length > 0 && (s.log.warning(`${n.skipped.length} files skipped (use --force to overwrite)`),
|
|
5386
|
+
r.stop("Files installed"), n.installed.length > 0 && s.log.success(`${z.highlight(String(n.installed.length))} files installed`), n.skipped.length > 0 && (s.log.warning(`${n.skipped.length} files skipped (use --force to overwrite)`), Zo(n.skipped));
|
|
5344
5387
|
for (let e of n.errors) s.log.error(e);
|
|
5345
5388
|
r.start("Applying template overrides...");
|
|
5346
|
-
let o = await
|
|
5389
|
+
let o = await Ms(u.id, {
|
|
5347
5390
|
token: S,
|
|
5348
5391
|
licenseKey: x
|
|
5349
5392
|
});
|
|
5350
5393
|
o.status === "denied" && (r.stop("Template download denied"), s.cancel(`Access to template "${u.id}" was denied (${o.reason}). Try 'npx @hype-stack/cli login' or check your license.`), process.exit(1)), F = o.templateDir;
|
|
5351
|
-
let c = await
|
|
5394
|
+
let c = await sa({
|
|
5352
5395
|
manifest: d,
|
|
5353
5396
|
config: h,
|
|
5354
5397
|
projectRoot: g,
|
|
@@ -5358,11 +5401,11 @@ async function Es(t = {}) {
|
|
|
5358
5401
|
for (let e of c.errors) s.log.error(e);
|
|
5359
5402
|
if (!m) {
|
|
5360
5403
|
let t = T.resolve(g, h.paths?.frontend.root ?? "apps/frontend"), n = d.theme ?? "zinc-mono";
|
|
5361
|
-
a(n) && (await
|
|
5404
|
+
a(n) && (await lo(t, i(n)) ? s.log.success(`Applied the ${i(n).label} theme`) : s.log.warning(z.muted(`Could not find ${z.path("assets/styles.css")} to apply the theme`)));
|
|
5362
5405
|
let r = d.defaultMode === "dark" || d.defaultMode === "light" ? d.defaultMode : e;
|
|
5363
|
-
await
|
|
5406
|
+
await ro(t, r) ? s.log.success(`Default color mode set to ${r}`) : s.log.warning(z.muted(`Could not find ${z.path("src/hooks/use-theme.ts")} to set the default color mode`));
|
|
5364
5407
|
}
|
|
5365
|
-
await
|
|
5408
|
+
await Is({
|
|
5366
5409
|
prepared: P,
|
|
5367
5410
|
templateNpm: d.dependencies_npm,
|
|
5368
5411
|
paths: h.paths,
|
|
@@ -5370,13 +5413,13 @@ async function Es(t = {}) {
|
|
|
5370
5413
|
spinner: r
|
|
5371
5414
|
});
|
|
5372
5415
|
let l;
|
|
5373
|
-
m && (l = await
|
|
5416
|
+
m && (l = await ka(g, t.yes ?? !1)), await pr({
|
|
5374
5417
|
projectRoot: g,
|
|
5375
5418
|
paths: h.paths,
|
|
5376
5419
|
skipPrompts: t.yes ?? !1,
|
|
5377
5420
|
dbReady: l,
|
|
5378
5421
|
freshScaffold: m
|
|
5379
|
-
}),
|
|
5422
|
+
}), Xo(), s.outro(z.brand(`Installed template ${u.name}.`));
|
|
5380
5423
|
} finally {
|
|
5381
5424
|
await Promise.all(P.map((e) => y.rm(e.packDir, {
|
|
5382
5425
|
recursive: !0,
|
|
@@ -5387,7 +5430,7 @@ async function Es(t = {}) {
|
|
|
5387
5430
|
});
|
|
5388
5431
|
}
|
|
5389
5432
|
}
|
|
5390
|
-
async function
|
|
5433
|
+
async function Ps(e, t, n) {
|
|
5391
5434
|
let r = {};
|
|
5392
5435
|
for (let i of e.slots) {
|
|
5393
5436
|
if (t?.[i.family]) {
|
|
@@ -5411,7 +5454,7 @@ async function Ds(e, t, n) {
|
|
|
5411
5454
|
}
|
|
5412
5455
|
return r;
|
|
5413
5456
|
}
|
|
5414
|
-
async function
|
|
5457
|
+
async function Fs(e) {
|
|
5415
5458
|
let { packs: t, templatePacks: n, installedSet: r, options: i } = e, a = new Set(n);
|
|
5416
5459
|
if (i.packs && i.packs.length > 0) {
|
|
5417
5460
|
let e = i.packs.filter((e) => !t.some((t) => t.name === e));
|
|
@@ -5422,7 +5465,7 @@ async function Os(e) {
|
|
|
5422
5465
|
if (o.length === 0) return [];
|
|
5423
5466
|
let c = ce();
|
|
5424
5467
|
s.note(o.map((e) => ` ${B.arrow} ${z.highlight(e.displayName)} ${ge(`${c}/packs/${e.name}`)}`).join("\n"), "Browse packs");
|
|
5425
|
-
let l = await
|
|
5468
|
+
let l = await Xa({
|
|
5426
5469
|
message: "Add extra packs on top of the template (optional)",
|
|
5427
5470
|
options: o.map((e) => ({
|
|
5428
5471
|
value: e.name,
|
|
@@ -5433,25 +5476,25 @@ async function Os(e) {
|
|
|
5433
5476
|
});
|
|
5434
5477
|
return m(l) && (s.cancel("Cancelled."), process.exit(0)), l;
|
|
5435
5478
|
}
|
|
5436
|
-
async function
|
|
5437
|
-
let { prepared: t, templateNpm: n, paths: r, cwd: i, spinner: a } = e, o =
|
|
5479
|
+
async function Is(e) {
|
|
5480
|
+
let { prepared: t, templateNpm: n, paths: r, cwd: i, spinner: a } = e, o = Ho(t.map((e) => e.manifest.dependencies_npm)), c = Vo(n ? Ho([o, n]) : o, r);
|
|
5438
5481
|
if (c.errors.length > 0) {
|
|
5439
5482
|
for (let e of c.errors) s.log.error(e);
|
|
5440
5483
|
return;
|
|
5441
5484
|
}
|
|
5442
5485
|
if (c.operations.length === 0) return;
|
|
5443
5486
|
a.start("Installing npm dependencies...");
|
|
5444
|
-
let l = await
|
|
5487
|
+
let l = await Uo(c.operations, i);
|
|
5445
5488
|
if (a.stop(l.ok ? "npm dependencies installed" : "npm dependency installation failed"), !l.ok) for (let e of l.errors) s.log.error(e);
|
|
5446
5489
|
}
|
|
5447
5490
|
//#endregion
|
|
5448
5491
|
//#region src/cli.ts
|
|
5449
|
-
function
|
|
5492
|
+
function Ls(e) {
|
|
5450
5493
|
if (!e) return;
|
|
5451
5494
|
let t = e.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
|
|
5452
5495
|
return t.length > 0 ? t : void 0;
|
|
5453
5496
|
}
|
|
5454
|
-
function
|
|
5497
|
+
function Rs(e) {
|
|
5455
5498
|
if (!e) return;
|
|
5456
5499
|
let t = {};
|
|
5457
5500
|
for (let n of e.split(",")) {
|
|
@@ -5460,10 +5503,10 @@ function js(e) {
|
|
|
5460
5503
|
}
|
|
5461
5504
|
return Object.keys(t).length > 0 ? t : void 0;
|
|
5462
5505
|
}
|
|
5463
|
-
function
|
|
5506
|
+
function zs() {
|
|
5464
5507
|
let e = new o();
|
|
5465
5508
|
return e.name("hype-stack").description("Build with Hype Stack -- templates, components, modules, and more").version(A, "-v, --version"), e.command("create").description("Create a new Hype Stack project").option("-n, --name <name>", "Project name").option("-d, --directory <path>", "Target directory").option("-e, --editor <editor>", "Code editor (cursor, claude, windsurf, copilot)").option("-t, --theme <theme>", "Color theme (default, slate, rose, emerald, violet, amber, ocean, zinc-mono, crimson, midnight)").option("--no-install", "Skip dependency installation").option("--no-setup", "Skip Docker services and database migrations after create").option("-y, --yes", "Skip confirmation prompts (requires --name)").action(async (e) => {
|
|
5466
|
-
await
|
|
5509
|
+
await cs({
|
|
5467
5510
|
name: e.name,
|
|
5468
5511
|
directory: e.directory,
|
|
5469
5512
|
install: e.install,
|
|
@@ -5473,38 +5516,38 @@ function Ms() {
|
|
|
5473
5516
|
setup: e.setup
|
|
5474
5517
|
});
|
|
5475
5518
|
}), e.command("init").description("Initialize stack.json in the current project").action(async () => {
|
|
5476
|
-
await
|
|
5519
|
+
await ls({});
|
|
5477
5520
|
}), e.command("onboard").description("Set up env vars, run migrations, and get the start command").option("-y, --yes", "Skip prompts, accept defaults").option("--skip-migrations", "Skip Docker services and database migrations").option("--cwd <path>", "Working directory").action(async (e) => {
|
|
5478
|
-
await
|
|
5521
|
+
await ws({
|
|
5479
5522
|
cwd: e.cwd,
|
|
5480
5523
|
yes: e.yes,
|
|
5481
5524
|
skipMigrations: e.skipMigrations
|
|
5482
5525
|
});
|
|
5483
5526
|
}), e.command("compose").description("Choose feature packs to add to your project").option("--packs <list>", "Comma-separated pack names (non-interactive). Append @frontend or @admin to a layout pack to target that app shell, e.g. layout-basic@frontend,layout-native-app-shell@admin").option("--force", "Overwrite existing files").option("-y, --yes", "Skip confirmation prompts").option("-k, --key <key>", "License key").option("--license-key <key>", "License key (alias for --key)").option("--cwd <path>", "Working directory").action(async (e) => {
|
|
5484
|
-
await
|
|
5485
|
-
packs:
|
|
5527
|
+
await ds({
|
|
5528
|
+
packs: Ls(e.packs),
|
|
5486
5529
|
force: e.force,
|
|
5487
5530
|
yes: e.yes,
|
|
5488
5531
|
licenseKey: e.key ?? e.licenseKey,
|
|
5489
5532
|
cwd: e.cwd
|
|
5490
5533
|
});
|
|
5491
5534
|
}), e.command("template").description("Install a template by id, with starter/layout variant swaps and extra packs on top").argument("[id]", "Template id (omit to pick interactively)").option("--variants <map>", "Preselect slot variants, e.g. starter-saas=starter-saas-better-auth,layout=layout-basic").option("--packs <list>", "Extra packs to add on top of the template (comma-separated)").option("--force", "Overwrite existing files").option("-y, --yes", "Skip confirmation prompts (requires <id>)").option("-k, --key <key>", "License key").option("--license-key <key>", "License key (alias for --key)").option("--cwd <path>", "Working directory").action(async (e, t) => {
|
|
5492
|
-
await
|
|
5535
|
+
await Ns({
|
|
5493
5536
|
templateId: e,
|
|
5494
|
-
variants:
|
|
5495
|
-
packs:
|
|
5537
|
+
variants: Rs(t.variants),
|
|
5538
|
+
packs: Ls(t.packs),
|
|
5496
5539
|
force: t.force,
|
|
5497
5540
|
yes: t.yes,
|
|
5498
5541
|
licenseKey: t.key ?? t.licenseKey,
|
|
5499
5542
|
cwd: t.cwd
|
|
5500
5543
|
});
|
|
5501
5544
|
}), e.command("login").description("Log in via your browser to install packs your organization owns").action(async () => {
|
|
5502
|
-
await
|
|
5545
|
+
await _s();
|
|
5503
5546
|
}), e.command("logout").description("Log out and remove the saved CLI token").action(async () => {
|
|
5504
|
-
await
|
|
5547
|
+
await vs();
|
|
5505
5548
|
}), e.command("auth").description("Alias for `login`").action(async () => {
|
|
5506
|
-
await
|
|
5549
|
+
await _s();
|
|
5507
5550
|
}), e;
|
|
5508
5551
|
}
|
|
5509
5552
|
//#endregion
|
|
5510
|
-
export {
|
|
5553
|
+
export { us as a, ds as i, vs as n, ls as o, _s as r, cs as s, zs as t };
|