@hype-stack/cli 0.5.11 → 0.5.12
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-DROj2oQA.js → cli-CHPFj1jR.js} +583 -624
- package/dist/config/bin.js +1 -1
- package/dist/core/codemods.d.ts +2 -12
- package/dist/core/codemods.d.ts.map +1 -1
- package/dist/core/installer.d.ts.map +1 -1
- package/dist/core/onboard-catalog.d.ts +10 -9
- package/dist/core/onboard-catalog.d.ts.map +1 -1
- package/dist/core/onboard-env.d.ts +8 -0
- package/dist/core/onboard-env.d.ts.map +1 -1
- package/dist/core/post-clone.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/types/types.d.ts +0 -2
- 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.12", te = "gh:BetterTyped/hype-stack", j = "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 = Ve.initiallyFocused, initiallyOnline: n = Ve.initiallyOnline } = this.options || Ve;
|
|
339
339
|
this.setInitialFocus(t), this.setInitialOnline(n), this.isBrowser = Le();
|
|
340
340
|
}
|
|
341
341
|
initialize = () => {
|
|
342
|
-
let { focusEvent: e =
|
|
342
|
+
let { focusEvent: e = Ve.focusEvent, onlineEvent: t = Ve.onlineEvent } = this.options || Ve;
|
|
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
|
+
}({}), Ve = {
|
|
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
|
+
}, He = class {
|
|
400
400
|
emitter = new Pe();
|
|
401
|
-
events =
|
|
401
|
+
events = vt(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
|
+
}, Ue = () => "loading-event-any", We = (e) => `${e}-loading-event`, Ge = (e) => `${e}-loading-cache-event`, Ke = (e) => `${e}-loading-event-by-id`, qe = () => "remove-event-any", Je = (e) => `${e}-remove-event`, Ye = (e) => `${e}-remove-event-by-id`, Xe = () => "request-abort-any", Ze = (e) => `${e}-request-abort`, Qe = (e) => `${e}-request-abort-by-id`, $e = () => "response-any", et = (e) => `${e}-response`, tt = (e) => `${e}-response-by-id`, nt = () => "request-start-any", rt = (e) => `${e}-request-start`, it = (e) => `${e}-request-start-by-id`, at = () => "response-start-any", ot = (e) => `${e}-response-start`, st = (e) => `${e}-response-start-by-id`, ct = () => "request-progress-any", lt = (e) => `${e}-request-progress`, ut = (e) => `${e}-request-progress-by-id`, dt = () => "response-progress-any", ft = (e) => `${e}-response-progress`, pt = (e) => `${e}-response-progress-by-id`, mt = () => "request-deduplicated-any", ht = (e) => `${e}-query-request-deduplicated`, gt = (e) => `${e}-cache-request-deduplicated`, _t = (e) => `${e}-request-deduplicated-by-id`, vt = (e) => ({
|
|
439
439
|
emitDeduplicated: (t, n = !1) => {
|
|
440
|
-
e.emit(
|
|
440
|
+
e.emit(mt(), t, n), e.emit(_t(t.requestId), t, n), e.emit(gt(t.request.cacheKey), t, n), e.emit(ht(t.request.queryKey), t, n);
|
|
441
441
|
},
|
|
442
442
|
emitLoading: (t, n = !1) => {
|
|
443
|
-
e.emit(
|
|
443
|
+
e.emit(Ue(), t, n), e.emit(Ke(t.requestId), t, n), e.emit(Ge(t.request.cacheKey), t, n), e.emit(We(t.request.queryKey), t, n);
|
|
444
444
|
},
|
|
445
445
|
emitRequestStart: (t, n = !1) => {
|
|
446
|
-
e.emit(
|
|
446
|
+
e.emit(nt(), t, n), e.emit(it(t.requestId), t, n), e.emit(rt(t.request.queryKey), t, n);
|
|
447
447
|
},
|
|
448
448
|
emitResponseStart: (t, n = !1) => {
|
|
449
|
-
e.emit(
|
|
449
|
+
e.emit(at(), t, n), e.emit(st(t.requestId), t, n), e.emit(ot(t.request.queryKey), t, n);
|
|
450
450
|
},
|
|
451
451
|
emitUploadProgress: (t, n = !1) => {
|
|
452
|
-
e.emit(
|
|
452
|
+
e.emit(ct(), t, n), e.emit(ut(t.requestId), t, n), e.emit(lt(t.request.queryKey), t, n);
|
|
453
453
|
},
|
|
454
454
|
emitDownloadProgress: (t, n = !1) => {
|
|
455
|
-
e.emit(
|
|
455
|
+
e.emit(dt(), t, n), e.emit(pt(t.requestId), t, n), e.emit(ft(t.request.queryKey), t, n);
|
|
456
456
|
},
|
|
457
457
|
emitResponse: (t, n = !1) => {
|
|
458
|
-
e.emit(
|
|
458
|
+
e.emit($e(), t, n), e.emit(tt(t.requestId), t, n), e.emit(et(t.request.cacheKey), t, n);
|
|
459
459
|
},
|
|
460
460
|
emitAbort: (t, n = !1) => {
|
|
461
|
-
e.emit(
|
|
461
|
+
e.emit(Xe(), t, n), e.emit(Qe(t.requestId), t, n), e.emit(Ze(t.request.abortKey), t, n);
|
|
462
462
|
},
|
|
463
463
|
emitRemove: (t, n = !1) => {
|
|
464
|
-
e.emit(
|
|
464
|
+
e.emit(qe(), t, n), e.emit(Ye(t.requestId), t, n), e.emit(Je(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(mt(), t), () => e.removeListener(mt(), t)),
|
|
467
|
+
onDeduplicatedByQueue: (t, n) => (e.on(ht(t), n), () => e.removeListener(ht(t), n)),
|
|
468
|
+
onDeduplicatedByCache: (t, n) => (e.on(gt(t), n), () => e.removeListener(gt(t), n)),
|
|
469
|
+
onDeduplicatedById: (t, n) => (e.on(_t(t), n), () => e.removeListener(_t(t), n)),
|
|
470
|
+
onLoading: (t) => (e.on(Ue(), t), () => e.removeListener(Ue(), t)),
|
|
471
|
+
onLoadingByQueue: (t, n) => (e.on(We(t), n), () => e.removeListener(We(t), n)),
|
|
472
|
+
onLoadingByCache: (t, n) => (e.on(Ge(t), n), () => e.removeListener(Ge(t), n)),
|
|
473
|
+
onLoadingById: (t, n) => (e.on(Ke(t), n), () => e.removeListener(Ke(t), n)),
|
|
474
|
+
onRequestStart: (t) => (e.on(nt(), t), () => e.removeListener(nt(), t)),
|
|
475
|
+
onRequestStartByQueue: (t, n) => (e.on(rt(t), n), () => e.removeListener(rt(t), n)),
|
|
476
|
+
onRequestStartById: (t, n) => (e.on(it(t), n), () => e.removeListener(it(t), n)),
|
|
477
|
+
onResponseStart: (t) => (e.on(at(), t), () => e.removeListener(at(), t)),
|
|
478
|
+
onResponseStartByQueue: (t, n) => (e.on(ot(t), n), () => e.removeListener(ot(t), n)),
|
|
479
|
+
onResponseStartById: (t, n) => (e.on(st(t), n), () => e.removeListener(st(t), n)),
|
|
480
|
+
onUploadProgress: (t) => (e.on(ct(), t), () => e.removeListener(ct(), t)),
|
|
481
|
+
onUploadProgressByQueue: (t, n) => (e.on(lt(t), n), () => e.removeListener(lt(t), n)),
|
|
482
|
+
onUploadProgressById: (t, n) => (e.on(ut(t), n), () => e.removeListener(ut(t), n)),
|
|
483
|
+
onDownloadProgress: (t) => (e.on(dt(), t), () => e.removeListener(dt(), t)),
|
|
484
|
+
onDownloadProgressByQueue: (t, n) => (e.on(ft(t), n), () => e.removeListener(ft(t), n)),
|
|
485
|
+
onDownloadProgressById: (t, n) => (e.on(pt(t), n), () => e.removeListener(pt(t), n)),
|
|
486
|
+
onResponse: (t) => (e.on($e(), t), () => e.removeListener($e(), t)),
|
|
487
|
+
onResponseByCache: (t, n) => (e.on(et(t), n), () => e.removeListener(et(t), n)),
|
|
488
|
+
onResponseById: (t, n) => (e.on(tt(t), n), () => e.removeListener(tt(t), n)),
|
|
489
|
+
onAbort: (t) => (e.on(Xe(), t), () => e.removeListener(Xe(), t)),
|
|
490
|
+
onAbortByKey: (t, n) => (e.on(Ze(t), n), () => e.removeListener(Ze(t), n)),
|
|
491
|
+
onAbortById: (t, n) => (e.on(Qe(t), n), () => e.removeListener(Qe(t), n)),
|
|
492
|
+
onRemove: (t) => (e.on(qe(), t), () => e.removeListener(qe(), t)),
|
|
493
|
+
onRemoveByQueue: (t, n) => (e.on(Je(t), n), () => e.removeListener(Je(t), n)),
|
|
494
|
+
onRemoveById: (t, n) => (e.on(Ye(t), n), () => e.removeListener(Ye(t), n))
|
|
495
|
+
}), yt = 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 || St, 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 && (Ct.indexOf(this.level) <= Ct.indexOf(e.level) || this.modules && !this.modules.includes(e.module) || this.logger(e));
|
|
534
534
|
};
|
|
535
|
-
},
|
|
536
|
-
let t =
|
|
535
|
+
}, bt = () => `${(/* @__PURE__ */ new Date()).toLocaleTimeString()}`, xt = (e) => e.type === "request" || e.type === "response" ? `${e.extra.request.endpoint}` : `[${e.module}]`, St = (e) => {
|
|
536
|
+
let t = Tt[e.level], n = Et[e.level], r = `%c[${bt()}]%c${e.title}%c${xt(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
|
+
}, Ct = [
|
|
539
539
|
"error",
|
|
540
540
|
"warning",
|
|
541
541
|
"info",
|
|
542
542
|
"debug"
|
|
543
|
-
],
|
|
544
|
-
error: `${
|
|
545
|
-
warning: `${
|
|
546
|
-
info: `${
|
|
547
|
-
debug: `${
|
|
548
|
-
},
|
|
543
|
+
], wt = "padding:2px 5px;", Tt = {
|
|
544
|
+
error: `${wt};background:#db252520;`,
|
|
545
|
+
warning: `${wt};background:#e1941e20;`,
|
|
546
|
+
info: `${wt};background:#1e74e120;`,
|
|
547
|
+
debug: `${wt};background:#00000020;`
|
|
548
|
+
}, Et = {
|
|
549
549
|
error: "color:#ff3737;",
|
|
550
550
|
warning: "color:#ffc107;",
|
|
551
551
|
info: "color:#34a8ff;",
|
|
552
552
|
debug: "color:#cccccc;"
|
|
553
|
-
},
|
|
553
|
+
}, Dt = class extends Error {
|
|
554
554
|
constructor() {
|
|
555
555
|
super("Request timeout"), this.name = "TimeoutError";
|
|
556
556
|
}
|
|
557
|
-
},
|
|
557
|
+
}, Ot = class extends Error {
|
|
558
558
|
constructor() {
|
|
559
559
|
super("Request aborted"), this.name = "AbortError";
|
|
560
560
|
}
|
|
561
|
-
},
|
|
561
|
+
}, kt = class extends Error {
|
|
562
562
|
constructor() {
|
|
563
563
|
super("Request deleted"), this.name = "DeletedError";
|
|
564
564
|
}
|
|
565
|
-
},
|
|
565
|
+
}, At = 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
|
+
}, jt = 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
|
+
}, H = (e) => e === "timeout" ? new Dt() : e === "abort" ? new Ot() : e === "deleted" ? new kt() : e === "processing" ? new At() : new jt(), 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: H("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
|
+
}, te = (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
|
+
}, j = () => {
|
|
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(H("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: H("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: H(),
|
|
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 At("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: te,
|
|
1193
|
+
onResponseEnd: j,
|
|
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 At("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 At(`Adapter ${this.options.name} is not initialized`);
|
|
1325
|
+
if (!this.unstable_fetcher) throw new At(`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) : H(), 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 = H("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 yt();
|
|
2086
|
+
requestManager = new He();
|
|
2087
2087
|
appManager;
|
|
2088
2088
|
adapter;
|
|
2089
2089
|
cache;
|
|
@@ -2584,61 +2584,56 @@ function xr(e) {
|
|
|
2584
2584
|
let t = vr(e);
|
|
2585
2585
|
return t ? yr[t] : br;
|
|
2586
2586
|
}
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
Y.Databases,
|
|
2590
|
-
Y.Sentry,
|
|
2591
|
-
Y.Resend
|
|
2592
|
-
]);
|
|
2593
|
-
function Cr(e, t) {
|
|
2587
|
+
function Sr(e, t) {
|
|
2588
|
+
if (t.length === 0) return !0;
|
|
2594
2589
|
let n = vr(e);
|
|
2595
|
-
return n
|
|
2590
|
+
return n ? t.includes(n) : !1;
|
|
2596
2591
|
}
|
|
2597
|
-
function
|
|
2592
|
+
function Cr(e) {
|
|
2598
2593
|
return e ? e.map((e) => {
|
|
2599
2594
|
let t = vr(e.envExample.section);
|
|
2600
2595
|
if (!t) throw Error(`Unknown onboarding env section "${e.envExample.section}". Known sections: ${Object.values(Y).join(", ")}.`);
|
|
2601
2596
|
return t;
|
|
2602
2597
|
}) : [];
|
|
2603
2598
|
}
|
|
2604
|
-
function
|
|
2599
|
+
function wr(e) {
|
|
2605
2600
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
2606
2601
|
for (let r of e) t.has(r) || (t.add(r), n.push(r));
|
|
2607
2602
|
return n;
|
|
2608
2603
|
}
|
|
2609
|
-
var
|
|
2604
|
+
var Tr = {
|
|
2610
2605
|
"starter-saas-workos": ["Your WebSocket upgrades can be authenticated with `authenticateWsUpgrade` from `@backend/middleware/auth/ws-auth` via `sockets.routes(authenticateWsUpgrade)`."],
|
|
2611
2606
|
"starter-saas-betterauth": ["Your WebSocket upgrades can be authenticated with `authenticateWsUpgrade` from `@backend/middleware/auth/ws-auth` via `sockets.routes(authenticateWsUpgrade)`."],
|
|
2612
2607
|
"pack-notifications": ["Notifications push over the `appChannel` socket channel; register it in your server startup to go live."],
|
|
2613
2608
|
"pack-collaboration": ["Team and TeamMember are available as CASL subjects; project member and team management reuse the existing `Project` subject."]
|
|
2614
2609
|
};
|
|
2615
|
-
function
|
|
2610
|
+
function Er(e) {
|
|
2616
2611
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
2617
2612
|
for (let r of e) {
|
|
2618
|
-
let e =
|
|
2613
|
+
let e = Tr[r];
|
|
2619
2614
|
if (e) for (let r of e) t.has(r) || (t.add(r), n.push(r));
|
|
2620
2615
|
}
|
|
2621
2616
|
return n;
|
|
2622
2617
|
}
|
|
2623
2618
|
//#endregion
|
|
2624
2619
|
//#region src/core/stack-config.ts
|
|
2625
|
-
async function
|
|
2626
|
-
return sr(T.join(e,
|
|
2620
|
+
async function Dr(e) {
|
|
2621
|
+
return sr(T.join(e, j));
|
|
2627
2622
|
}
|
|
2628
|
-
async function
|
|
2629
|
-
return J(T.join(e,
|
|
2623
|
+
async function Or(e) {
|
|
2624
|
+
return J(T.join(e, j));
|
|
2630
2625
|
}
|
|
2631
|
-
async function
|
|
2632
|
-
await cr(T.join(e,
|
|
2626
|
+
async function kr(e, t) {
|
|
2627
|
+
await cr(T.join(e, j), t);
|
|
2633
2628
|
}
|
|
2634
|
-
async function
|
|
2629
|
+
async function Ar(e) {
|
|
2635
2630
|
let t = T.join(e, "apps"), n = T.join(e, "packages"), [r, i] = await Promise.all([lr(t), lr(n)]);
|
|
2636
2631
|
return {
|
|
2637
2632
|
apps: r,
|
|
2638
2633
|
packages: i
|
|
2639
2634
|
};
|
|
2640
2635
|
}
|
|
2641
|
-
function
|
|
2636
|
+
function jr(e) {
|
|
2642
2637
|
let t = e.apps.backend ?? "apps/backend", n = e.apps.frontend ?? "apps/frontend", r = e.apps.admin ?? "apps/admin", i = e.packages.enums ?? "packages/enums";
|
|
2643
2638
|
return {
|
|
2644
2639
|
backend: {
|
|
@@ -2672,19 +2667,19 @@ function Mr(e) {
|
|
|
2672
2667
|
}
|
|
2673
2668
|
};
|
|
2674
2669
|
}
|
|
2675
|
-
function
|
|
2670
|
+
function Mr(e, t) {
|
|
2676
2671
|
return {
|
|
2677
2672
|
$schema: ue(),
|
|
2678
2673
|
version: 1,
|
|
2679
2674
|
name: e,
|
|
2680
2675
|
apps: t.apps,
|
|
2681
2676
|
packages: t.packages,
|
|
2682
|
-
paths:
|
|
2677
|
+
paths: jr(t),
|
|
2683
2678
|
installedPacks: [],
|
|
2684
2679
|
licenseKey: null
|
|
2685
2680
|
};
|
|
2686
2681
|
}
|
|
2687
|
-
async function
|
|
2682
|
+
async function Nr(e) {
|
|
2688
2683
|
let t = T.join(e, "package.json"), n = T.join(e, "apps"), [r, i] = await Promise.all([J(t), ar(n)]);
|
|
2689
2684
|
return r && i;
|
|
2690
2685
|
}
|
|
@@ -2699,7 +2694,7 @@ function X(e, t) {
|
|
|
2699
2694
|
}
|
|
2700
2695
|
//#endregion
|
|
2701
2696
|
//#region src/core/registry.ts
|
|
2702
|
-
async function
|
|
2697
|
+
async function Pr(e) {
|
|
2703
2698
|
let { data: t, error: n, status: r } = await K.createRequest()({
|
|
2704
2699
|
endpoint: `/packs/${encodeURIComponent(e)}/manifest`,
|
|
2705
2700
|
method: "GET"
|
|
@@ -2708,7 +2703,7 @@ async function Fr(e) {
|
|
|
2708
2703
|
if (n || !t) throw Error(`Failed to load manifest for "${e}": ${String(n)}`);
|
|
2709
2704
|
return t;
|
|
2710
2705
|
}
|
|
2711
|
-
async function
|
|
2706
|
+
async function Fr(e, t = {}) {
|
|
2712
2707
|
let n = K.createRequest()({
|
|
2713
2708
|
endpoint: `/packs/${encodeURIComponent(e)}/download`,
|
|
2714
2709
|
method: "POST"
|
|
@@ -2734,23 +2729,23 @@ async function Ir(e, t = {}) {
|
|
|
2734
2729
|
packDir: s
|
|
2735
2730
|
};
|
|
2736
2731
|
}
|
|
2737
|
-
function
|
|
2732
|
+
function Ir(e, t, n) {
|
|
2738
2733
|
let r = X(e, t);
|
|
2739
2734
|
return T.resolve(n, r);
|
|
2740
2735
|
}
|
|
2741
|
-
function
|
|
2736
|
+
function Lr(e, t) {
|
|
2742
2737
|
return T.join(t, e);
|
|
2743
2738
|
}
|
|
2744
|
-
var
|
|
2739
|
+
var Rr = K.createRequest()({
|
|
2745
2740
|
endpoint: "/packs/list",
|
|
2746
2741
|
method: "GET"
|
|
2747
2742
|
});
|
|
2748
|
-
async function
|
|
2749
|
-
let { data: e, error: t } = await
|
|
2743
|
+
async function zr() {
|
|
2744
|
+
let { data: e, error: t } = await Rr.send();
|
|
2750
2745
|
if (t || !e) throw Error(`Failed to fetch pack list: ${String(t)}`);
|
|
2751
2746
|
return e.packs;
|
|
2752
2747
|
}
|
|
2753
|
-
async function
|
|
2748
|
+
async function Br(e, t = {}) {
|
|
2754
2749
|
if (e.length === 0) return {};
|
|
2755
2750
|
let n = K.createRequest()({
|
|
2756
2751
|
endpoint: "/packs/authorize",
|
|
@@ -2766,30 +2761,33 @@ async function Vr(e, t = {}) {
|
|
|
2766
2761
|
}
|
|
2767
2762
|
//#endregion
|
|
2768
2763
|
//#region src/core/codemods.ts
|
|
2769
|
-
var
|
|
2764
|
+
var Vr = "@hype-stack/", Hr = /@hype-stack\/(?!cli\b)/g;
|
|
2770
2765
|
function Ur(e, t) {
|
|
2766
|
+
return e.replace(Hr, t);
|
|
2767
|
+
}
|
|
2768
|
+
function Wr(e, t) {
|
|
2771
2769
|
return X(e === "admin" ? "{{admin.root}}" : "{{frontend.root}}", t);
|
|
2772
2770
|
}
|
|
2773
|
-
async function
|
|
2771
|
+
async function Gr(e, t, n) {
|
|
2774
2772
|
let r = X("{{backend.root}}", t), i = T.resolve(n, r, "src/config/env/env.config.ts"), a = T.resolve(n, r, ".env.example"), o = T.resolve(n, r, ".env"), s = T.resolve(n, r, ".env.test");
|
|
2775
2773
|
if (await J(i)) {
|
|
2776
2774
|
let t = await y.readFile(i, "utf-8");
|
|
2777
|
-
for (let n of e) t.includes(`from "${n.from}"`) || (t =
|
|
2775
|
+
for (let n of e) t.includes(`from "${n.from}"`) || (t = Kr(t, n), t = qr(t, n));
|
|
2778
2776
|
await y.writeFile(i, t, "utf-8");
|
|
2779
2777
|
}
|
|
2780
|
-
if (await Promise.all([a, o].map((t) =>
|
|
2778
|
+
if (await Promise.all([a, o].map((t) => Jr(t, e))), await J(s)) {
|
|
2781
2779
|
let t = await y.readFile(s, "utf-8");
|
|
2782
|
-
for (let n of e) t =
|
|
2780
|
+
for (let n of e) t = Xr(t, n);
|
|
2783
2781
|
await y.writeFile(s, t, "utf-8");
|
|
2784
2782
|
}
|
|
2785
2783
|
}
|
|
2786
|
-
function
|
|
2784
|
+
function Kr(e, t) {
|
|
2787
2785
|
let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("import ");
|
|
2788
2786
|
if (r === -1) return n + "\n" + e;
|
|
2789
2787
|
let i = e.indexOf("\n", e.indexOf(";", r));
|
|
2790
2788
|
return i === -1 ? e + "\n" + n : e.slice(0, i + 1) + n + "\n" + e.slice(i + 1);
|
|
2791
2789
|
}
|
|
2792
|
-
function
|
|
2790
|
+
function qr(e, t) {
|
|
2793
2791
|
let n = `.extend(${t.import}.shape)`;
|
|
2794
2792
|
if (e.includes(n)) return e;
|
|
2795
2793
|
let r = e.indexOf("export const envSchema = z.object({");
|
|
@@ -2804,33 +2802,33 @@ function Kr(e, t) {
|
|
|
2804
2802
|
let o = a + 2;
|
|
2805
2803
|
return e.slice(0, o) + n + e.slice(o);
|
|
2806
2804
|
}
|
|
2807
|
-
async function
|
|
2805
|
+
async function Jr(e, t) {
|
|
2808
2806
|
if (!await J(e)) return;
|
|
2809
2807
|
let n = await y.readFile(e, "utf-8");
|
|
2810
|
-
for (let e of t) n =
|
|
2808
|
+
for (let e of t) n = Yr(n, e);
|
|
2811
2809
|
await y.writeFile(e, n, "utf-8");
|
|
2812
2810
|
}
|
|
2813
|
-
function
|
|
2811
|
+
function Yr(e, t) {
|
|
2814
2812
|
for (let n of Object.keys(t.envExample.vars)) if (e.includes(`${n}=`)) return e;
|
|
2815
2813
|
let n = [];
|
|
2816
2814
|
n.push(""), n.push(`# ${hr[t.envExample.section]}`);
|
|
2817
2815
|
for (let [e, r] of Object.entries(t.envExample.vars)) n.push(`${e}=${r}`);
|
|
2818
2816
|
return e.trimEnd() + "\n" + n.join("\n") + "\n";
|
|
2819
2817
|
}
|
|
2820
|
-
function
|
|
2818
|
+
function Xr(e, t) {
|
|
2821
2819
|
for (let n of Object.keys(t.envTest)) if (e.includes(`${n}=`)) return e;
|
|
2822
2820
|
let n = [""];
|
|
2823
2821
|
for (let [e, r] of Object.entries(t.envTest)) n.push(`${e}=${r}`);
|
|
2824
2822
|
return e.trimEnd() + "\n" + n.join("\n") + "\n";
|
|
2825
2823
|
}
|
|
2826
|
-
async function
|
|
2824
|
+
async function Zr(e, t, n) {
|
|
2827
2825
|
let r = T.resolve(n, X("{{backend.routes}}", t), "index.ts");
|
|
2828
2826
|
if (!await J(r)) return;
|
|
2829
2827
|
let i = await y.readFile(r, "utf-8");
|
|
2830
|
-
for (let t of e) i.includes(`from "${t.from}"`) || (i =
|
|
2828
|
+
for (let t of e) i.includes(`from "${t.from}"`) || (i = Qr(i, t), i = $r(i, t));
|
|
2831
2829
|
await y.writeFile(r, i, "utf-8");
|
|
2832
2830
|
}
|
|
2833
|
-
function
|
|
2831
|
+
function Qr(e, t) {
|
|
2834
2832
|
let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("from \"./");
|
|
2835
2833
|
if (r !== -1) {
|
|
2836
2834
|
let t = e.indexOf("\n", r);
|
|
@@ -2839,7 +2837,7 @@ function Zr(e, t) {
|
|
|
2839
2837
|
let i = e.indexOf("export const registerRoutes");
|
|
2840
2838
|
return i === -1 ? e : e.slice(0, i) + n + "\n\n" + e.slice(i);
|
|
2841
2839
|
}
|
|
2842
|
-
function
|
|
2840
|
+
function $r(e, t) {
|
|
2843
2841
|
let n = `.route("${t.prefix}", ${t.import})`, r = e.match(/\.route\([^)]+\);/g);
|
|
2844
2842
|
if (r) {
|
|
2845
2843
|
let t = r[r.length - 1], i = e.lastIndexOf(t) + t.length - 1;
|
|
@@ -2847,14 +2845,14 @@ function Qr(e, t) {
|
|
|
2847
2845
|
}
|
|
2848
2846
|
return e.replace("return app;", `return app\n ${n};`);
|
|
2849
2847
|
}
|
|
2850
|
-
async function
|
|
2848
|
+
async function ei(e, t, n) {
|
|
2851
2849
|
let r = T.resolve(n, X("{{backend.root}}", t), "src/context.ts");
|
|
2852
2850
|
if (!await J(r)) return;
|
|
2853
2851
|
let i = await y.readFile(r, "utf-8");
|
|
2854
|
-
for (let t of e) i.includes(`export let ${t.export}`) || (i =
|
|
2852
|
+
for (let t of e) i.includes(`export let ${t.export}`) || (i = ti(i, t), i = ni(i, t), i = ri(i, t), i = ai(i, t));
|
|
2855
2853
|
await y.writeFile(r, i, "utf-8");
|
|
2856
2854
|
}
|
|
2857
|
-
function
|
|
2855
|
+
function ti(e, t) {
|
|
2858
2856
|
let n = `import { ${t.typeImport.name} } from "${t.typeImport.from}";`;
|
|
2859
2857
|
if (e.includes(`from "${t.typeImport.from}"`)) return e;
|
|
2860
2858
|
let r = e.lastIndexOf("import ");
|
|
@@ -2862,7 +2860,7 @@ function ei(e, t) {
|
|
|
2862
2860
|
let i = e.indexOf("\n", e.indexOf(";", r));
|
|
2863
2861
|
return i === -1 ? e + "\n" + n : e.slice(0, i + 1) + n + "\n" + e.slice(i + 1);
|
|
2864
2862
|
}
|
|
2865
|
-
function
|
|
2863
|
+
function ni(e, t) {
|
|
2866
2864
|
let n = `export let ${t.export}: ${t.type};`, r = e.lastIndexOf("export let ");
|
|
2867
2865
|
if (r === -1) {
|
|
2868
2866
|
let t = e.indexOf("export const setupContext");
|
|
@@ -2871,15 +2869,15 @@ function ti(e, t) {
|
|
|
2871
2869
|
let i = e.indexOf("\n", r);
|
|
2872
2870
|
return i === -1 ? e + "\n" + n : e.slice(0, i + 1) + n + "\n" + e.slice(i + 1);
|
|
2873
2871
|
}
|
|
2874
|
-
function
|
|
2872
|
+
function ri(e, t) {
|
|
2875
2873
|
let n = ` ${t.export} = ${t.init};`, r = e.match(/export const setupContext\s*=\s*async\s*\([^)]*\)\s*=>\s*\{/);
|
|
2876
2874
|
if (!r) return e;
|
|
2877
2875
|
let i = e.indexOf("{", e.indexOf(r[0]));
|
|
2878
2876
|
if (i === -1) return e;
|
|
2879
|
-
let a =
|
|
2877
|
+
let a = ii(e, i);
|
|
2880
2878
|
return a === -1 ? e : e.slice(0, a) + n + "\n" + e.slice(a);
|
|
2881
2879
|
}
|
|
2882
|
-
function
|
|
2880
|
+
function ii(e, t) {
|
|
2883
2881
|
let n = 0;
|
|
2884
2882
|
for (let r = t; r < e.length; r++) {
|
|
2885
2883
|
let t = e[r];
|
|
@@ -2888,63 +2886,20 @@ function ri(e, t) {
|
|
|
2888
2886
|
}
|
|
2889
2887
|
return -1;
|
|
2890
2888
|
}
|
|
2891
|
-
function
|
|
2889
|
+
function ai(e, t) {
|
|
2892
2890
|
let n = ` ${t.export}: ${t.type};`, r = e.indexOf("export type ContextVariables = {");
|
|
2893
2891
|
if (r === -1) return e;
|
|
2894
2892
|
let i = e.indexOf("};", r);
|
|
2895
2893
|
return i === -1 ? e : e.slice(0, i) + n + "\n" + e.slice(i);
|
|
2896
2894
|
}
|
|
2897
|
-
async function
|
|
2898
|
-
let r = T.resolve(n, X("{{backend.root}}", t), "src/context.ts");
|
|
2899
|
-
if (!await J(r)) return;
|
|
2900
|
-
let i = await y.readFile(r, "utf-8");
|
|
2901
|
-
for (let t of e) i = oi(i, t);
|
|
2902
|
-
await y.writeFile(r, i, "utf-8");
|
|
2903
|
-
}
|
|
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) {
|
|
2895
|
+
async function oi(e, t, n) {
|
|
2941
2896
|
let r = T.resolve(n, X("{{enums.src}}", t), "index.ts");
|
|
2942
2897
|
if (!await J(r)) return;
|
|
2943
2898
|
let i = await y.readFile(r, "utf-8");
|
|
2944
|
-
for (let t of e) i.includes(`from "${t.from}"`) || (i =
|
|
2899
|
+
for (let t of e) i.includes(`from "${t.from}"`) || (i = si(i, t));
|
|
2945
2900
|
await y.writeFile(r, i, "utf-8");
|
|
2946
2901
|
}
|
|
2947
|
-
function
|
|
2902
|
+
function si(e, t) {
|
|
2948
2903
|
let n = `export * from "${t.from}";`, r = e.lastIndexOf("export * from");
|
|
2949
2904
|
if (r !== -1) {
|
|
2950
2905
|
let t = e.indexOf("\n", r);
|
|
@@ -2952,14 +2907,14 @@ function pi(e, t) {
|
|
|
2952
2907
|
}
|
|
2953
2908
|
return e.trim() === "" ? n + "\n" : e.trimEnd() + "\n" + n + "\n";
|
|
2954
2909
|
}
|
|
2955
|
-
async function
|
|
2910
|
+
async function ci(e, t, n) {
|
|
2956
2911
|
let r = X("{{backend.root}}", t), i = T.resolve(n, r, "src/sockets/index.ts");
|
|
2957
2912
|
if (!await J(i)) return;
|
|
2958
2913
|
let a = await y.readFile(i, "utf-8");
|
|
2959
|
-
for (let t of e) a.includes(`from "${t.from}"`) || (a =
|
|
2960
|
-
await J(T.resolve(n, r, "src/libs/websocket/ws-authenticate.ts")) && (a =
|
|
2914
|
+
for (let t of e) a.includes(`from "${t.from}"`) || (a = li(a, t), a = ui(a, t));
|
|
2915
|
+
await J(T.resolve(n, r, "src/libs/websocket/ws-authenticate.ts")) && (a = di(a)), await y.writeFile(i, a, "utf-8");
|
|
2961
2916
|
}
|
|
2962
|
-
function
|
|
2917
|
+
function li(e, t) {
|
|
2963
2918
|
let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("from \"./");
|
|
2964
2919
|
if (r !== -1) {
|
|
2965
2920
|
let t = e.indexOf("\n", r);
|
|
@@ -2968,7 +2923,7 @@ function hi(e, t) {
|
|
|
2968
2923
|
let i = e.indexOf("const sockets");
|
|
2969
2924
|
return i === -1 ? e : e.slice(0, i) + n + "\n\n" + e.slice(i);
|
|
2970
2925
|
}
|
|
2971
|
-
function
|
|
2926
|
+
function ui(e, t) {
|
|
2972
2927
|
let n = `.socket("${t.prefix}", ${t.import})`, r = e.indexOf("const sockets");
|
|
2973
2928
|
if (r === -1) return e;
|
|
2974
2929
|
let i = e.indexOf("new SocketRouter", r);
|
|
@@ -2982,7 +2937,7 @@ function gi(e, t) {
|
|
|
2982
2937
|
}
|
|
2983
2938
|
return e;
|
|
2984
2939
|
}
|
|
2985
|
-
function
|
|
2940
|
+
function di(e) {
|
|
2986
2941
|
if (e.includes("wsAuthenticate")) return e;
|
|
2987
2942
|
let t = e.indexOf("from \"@backend/libs/websocket/socket-router\""), n = e;
|
|
2988
2943
|
if (t !== -1) {
|
|
@@ -2991,14 +2946,14 @@ function _i(e) {
|
|
|
2991
2946
|
}
|
|
2992
2947
|
return n.replace("new SocketRouter()", "new SocketRouter({ authenticate: wsAuthenticate })");
|
|
2993
2948
|
}
|
|
2994
|
-
async function
|
|
2949
|
+
async function fi(e, t, n) {
|
|
2995
2950
|
let r = X("{{frontend.root}}", t), i = T.resolve(n, r, "src/api/sdk.ts");
|
|
2996
2951
|
if (!await J(i)) return;
|
|
2997
2952
|
let a = await y.readFile(i, "utf-8");
|
|
2998
|
-
for (let t of e) a.includes(`.$configure(${t.import})`) || (a =
|
|
2953
|
+
for (let t of e) a.includes(`.$configure(${t.import})`) || (a = pi(a, t), a = mi(a, t));
|
|
2999
2954
|
await y.writeFile(i, a, "utf-8");
|
|
3000
2955
|
}
|
|
3001
|
-
function
|
|
2956
|
+
function pi(e, t) {
|
|
3002
2957
|
let n = `import { ${t.import} } from "${t.from}";`;
|
|
3003
2958
|
if (e.includes(n)) return e;
|
|
3004
2959
|
let r = e.lastIndexOf("from \"./");
|
|
@@ -3009,20 +2964,20 @@ function yi(e, t) {
|
|
|
3009
2964
|
let i = e.indexOf("export const sdk");
|
|
3010
2965
|
return i === -1 ? e : e.slice(0, i) + n + "\n\n" + e.slice(i);
|
|
3011
2966
|
}
|
|
3012
|
-
function
|
|
2967
|
+
function mi(e, t) {
|
|
3013
2968
|
let n = `.$configure(${t.import})`, r = e.indexOf("export const sdk");
|
|
3014
2969
|
if (r === -1) return e;
|
|
3015
2970
|
let i = e.indexOf(";", r);
|
|
3016
2971
|
return i === -1 ? e : e.slice(0, i) + "\n " + n + e.slice(i);
|
|
3017
2972
|
}
|
|
3018
|
-
async function
|
|
2973
|
+
async function hi(e, t, n) {
|
|
3019
2974
|
let r = T.resolve(n, X("{{backend.utils}}", t), "frontend-url/frontend-url.ts");
|
|
3020
2975
|
if (!await J(r)) return;
|
|
3021
2976
|
let i = await y.readFile(r, "utf-8");
|
|
3022
|
-
for (let t of e) i.includes(`"${t.path}"`) || (i =
|
|
2977
|
+
for (let t of e) i.includes(`"${t.path}"`) || (i = gi(i, t));
|
|
3023
2978
|
await y.writeFile(r, i, "utf-8");
|
|
3024
2979
|
}
|
|
3025
|
-
function
|
|
2980
|
+
function gi(e, t) {
|
|
3026
2981
|
let n = ` "${t.path}": ${t.search};`, r = e.indexOf("type RouteDefinitions = {");
|
|
3027
2982
|
if (r === -1) return e;
|
|
3028
2983
|
let i = e.indexOf("{", r);
|
|
@@ -3038,38 +2993,38 @@ function Si(e, t) {
|
|
|
3038
2993
|
}
|
|
3039
2994
|
return o === -1 ? e : e.slice(0, o) + n + "\n" + e.slice(o);
|
|
3040
2995
|
}
|
|
3041
|
-
var
|
|
2996
|
+
var _i = "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", vi = {
|
|
3042
2997
|
primary: "primaryNav",
|
|
3043
2998
|
secondary: "secondaryNav",
|
|
3044
2999
|
tertiary: "tertiaryNav",
|
|
3045
3000
|
settings: "settingsNav"
|
|
3046
3001
|
};
|
|
3047
|
-
async function
|
|
3048
|
-
let { entries: t, paths: n, projectRoot: r, slot: i = "frontend" } = e, a =
|
|
3049
|
-
await J(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s =
|
|
3050
|
-
for (let e of t) s.includes(`label: "${e.label}"`) || (s =
|
|
3051
|
-
for (let e of t.toReversed()) s.includes(`label: "${e.label}"`) || (s =
|
|
3002
|
+
async function yi(e) {
|
|
3003
|
+
let { entries: t, paths: n, projectRoot: r, slot: i = "frontend" } = e, a = Wr(i, n), o = T.resolve(r, a, "src/constants/nav.constants.ts"), s;
|
|
3004
|
+
await J(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s = _i);
|
|
3005
|
+
for (let e of t) s.includes(`label: "${e.label}"`) || (s = Si(s, e));
|
|
3006
|
+
for (let e of t.toReversed()) s.includes(`label: "${e.label}"`) || (s = wi(s, e));
|
|
3052
3007
|
await y.writeFile(o, s, "utf-8");
|
|
3053
3008
|
}
|
|
3054
|
-
async function
|
|
3055
|
-
let { postLoginRedirect: t, paths: n, projectRoot: r, slot: i = "frontend" } = e, a =
|
|
3009
|
+
async function bi(e) {
|
|
3010
|
+
let { postLoginRedirect: t, paths: n, projectRoot: r, slot: i = "frontend" } = e, a = Wr(i, n), o = T.resolve(r, a, "src/features/auth/constants/auth.constants.ts");
|
|
3056
3011
|
if (!await J(o)) return;
|
|
3057
3012
|
let s = await y.readFile(o, "utf-8"), c = /export const POST_LOGIN_REDIRECT_PATH = "[^"]*";/;
|
|
3058
3013
|
if (!c.test(s)) return;
|
|
3059
3014
|
let l = s.replace(c, `export const POST_LOGIN_REDIRECT_PATH = "${t}";`);
|
|
3060
3015
|
await y.writeFile(o, l, "utf-8");
|
|
3061
3016
|
}
|
|
3062
|
-
function
|
|
3017
|
+
function xi(e) {
|
|
3063
3018
|
let t = [e.icon];
|
|
3064
3019
|
if (e.items) for (let n of e.items) t.includes(n.icon) || t.push(n.icon);
|
|
3065
3020
|
return t;
|
|
3066
3021
|
}
|
|
3067
|
-
function
|
|
3068
|
-
let n =
|
|
3069
|
-
for (let e of n) r =
|
|
3022
|
+
function Si(e, t) {
|
|
3023
|
+
let n = xi(t), r = e;
|
|
3024
|
+
for (let e of n) r = Ci(r, e);
|
|
3070
3025
|
return r;
|
|
3071
3026
|
}
|
|
3072
|
-
function
|
|
3027
|
+
function Ci(e, t) {
|
|
3073
3028
|
let n = e.match(/import \{([^}]+)\} from "lucide-react";/);
|
|
3074
3029
|
if (!n) return e;
|
|
3075
3030
|
let r = n[1].split(",").map((e) => e.trim()).filter(Boolean);
|
|
@@ -3077,21 +3032,21 @@ function ki(e, t) {
|
|
|
3077
3032
|
let i = r.findIndex((e) => e.startsWith("type "));
|
|
3078
3033
|
return i === -1 ? r.push(t) : r.splice(i, 0, t), e.replace(n[0], `import { ${r.join(", ")} } from "lucide-react";`);
|
|
3079
3034
|
}
|
|
3080
|
-
function
|
|
3081
|
-
let n =
|
|
3035
|
+
function wi(e, t) {
|
|
3036
|
+
let n = vi[t.group];
|
|
3082
3037
|
if (!n) return e;
|
|
3083
|
-
let r =
|
|
3038
|
+
let r = Ei(t), i = RegExp(`export const ${n}: NavEntry\\[\\] = \\[`), a = e.match(i);
|
|
3084
3039
|
if (!a) return e;
|
|
3085
|
-
let o = e.indexOf(a[0]) + a[0].length, s =
|
|
3040
|
+
let o = e.indexOf(a[0]) + a[0].length, s = Ti(e, o - 1);
|
|
3086
3041
|
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);
|
|
3087
3042
|
}
|
|
3088
|
-
function
|
|
3043
|
+
function Ti(e, t) {
|
|
3089
3044
|
let n = 0;
|
|
3090
3045
|
for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
|
|
3091
3046
|
else if (e[r] === "]" && (n--, n === 0)) return r;
|
|
3092
3047
|
return -1;
|
|
3093
3048
|
}
|
|
3094
|
-
function
|
|
3049
|
+
function Ei(e) {
|
|
3095
3050
|
let t = [];
|
|
3096
3051
|
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) {
|
|
3097
3052
|
t.push(" items: [");
|
|
@@ -3107,14 +3062,14 @@ function Mi(e) {
|
|
|
3107
3062
|
} else t.push(" items: [],");
|
|
3108
3063
|
return t.push(" },"), t.join("\n");
|
|
3109
3064
|
}
|
|
3110
|
-
async function
|
|
3065
|
+
async function Di(e, t, n) {
|
|
3111
3066
|
let r = X("{{backend.features}}", t), i = T.resolve(n, r, "organizations/modules/setup-organization/steps/index.ts");
|
|
3112
3067
|
if (!await J(i)) return;
|
|
3113
3068
|
let a = await y.readFile(i, "utf-8");
|
|
3114
|
-
for (let t of e) a.includes(`from "${t.from}"`) || (a =
|
|
3069
|
+
for (let t of e) a.includes(`from "${t.from}"`) || (a = Oi(a, t), a = ki(a, t));
|
|
3115
3070
|
await y.writeFile(i, a, "utf-8");
|
|
3116
3071
|
}
|
|
3117
|
-
function
|
|
3072
|
+
function Oi(e, t) {
|
|
3118
3073
|
let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("import ");
|
|
3119
3074
|
if (r !== -1) {
|
|
3120
3075
|
let t = e.indexOf("\n", e.indexOf(";", r));
|
|
@@ -3122,38 +3077,38 @@ function Pi(e, t) {
|
|
|
3122
3077
|
}
|
|
3123
3078
|
return e.indexOf("type "), n + "\n\n" + e;
|
|
3124
3079
|
}
|
|
3125
|
-
function
|
|
3080
|
+
function ki(e, t) {
|
|
3126
3081
|
let n = ` { id: "${t.id}", execute: (ctx) => ${t.import}(ctx) },`, r = e.match(/export const steps:\s*Step\[\]\s*=\s*\[/);
|
|
3127
3082
|
if (!r) return e;
|
|
3128
|
-
let i = e.indexOf(r[0]) + r[0].length, a =
|
|
3083
|
+
let i = e.indexOf(r[0]) + r[0].length, a = Ai(e, i - 1);
|
|
3129
3084
|
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);
|
|
3130
3085
|
}
|
|
3131
|
-
function
|
|
3086
|
+
function Ai(e, t) {
|
|
3132
3087
|
let n = 0;
|
|
3133
3088
|
for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
|
|
3134
3089
|
else if (e[r] === "]" && (n--, n === 0)) return r;
|
|
3135
3090
|
return -1;
|
|
3136
3091
|
}
|
|
3137
|
-
var
|
|
3138
|
-
async function
|
|
3139
|
-
await
|
|
3092
|
+
var ji = "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";
|
|
3093
|
+
async function Mi(e) {
|
|
3094
|
+
await Pi({
|
|
3140
3095
|
...e,
|
|
3141
3096
|
arrayName: "navbarActions"
|
|
3142
3097
|
});
|
|
3143
3098
|
}
|
|
3144
|
-
async function
|
|
3145
|
-
await
|
|
3099
|
+
async function Ni(e) {
|
|
3100
|
+
await Pi({
|
|
3146
3101
|
...e,
|
|
3147
3102
|
arrayName: "userMenuActions"
|
|
3148
3103
|
});
|
|
3149
3104
|
}
|
|
3150
|
-
async function
|
|
3151
|
-
let a =
|
|
3152
|
-
await J(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s =
|
|
3153
|
-
for (let n of e) s =
|
|
3105
|
+
async function Pi({ actions: e, arrayName: t, paths: n, projectRoot: r, slot: i }) {
|
|
3106
|
+
let a = Wr(i, n), o = T.resolve(r, a, "src/constants/navbar-actions.tsx"), s;
|
|
3107
|
+
await J(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s = ji);
|
|
3108
|
+
for (let n of e) s = Fi(s, n), s = Ii(s, n, t);
|
|
3154
3109
|
await y.writeFile(o, s, "utf-8");
|
|
3155
3110
|
}
|
|
3156
|
-
function
|
|
3111
|
+
function Fi(e, t) {
|
|
3157
3112
|
let n = `import { ${t.import} } from "${t.from}";`;
|
|
3158
3113
|
if (e.includes(n)) return e;
|
|
3159
3114
|
let r = e.lastIndexOf("import ");
|
|
@@ -3161,38 +3116,38 @@ function Vi(e, t) {
|
|
|
3161
3116
|
let i = e.indexOf("\n", r);
|
|
3162
3117
|
return i === -1 ? e + "\n" + n : e.slice(0, i + 1) + n + "\n" + e.slice(i + 1);
|
|
3163
3118
|
}
|
|
3164
|
-
function
|
|
3119
|
+
function Ii(e, t, n) {
|
|
3165
3120
|
let r = e.match(RegExp(`export const ${n}:\\s*NavbarAction\\[\\]\\s*=\\s*\\[`));
|
|
3166
3121
|
if (!r) return e;
|
|
3167
|
-
let i = e.indexOf(r[0]) + r[0].length, a =
|
|
3122
|
+
let i = e.indexOf(r[0]) + r[0].length, a = Li(e, i - 1);
|
|
3168
3123
|
if (a === -1) return e;
|
|
3169
3124
|
let o = e.slice(i, a);
|
|
3170
3125
|
if (o.includes(`id: "${t.id}"`)) return e;
|
|
3171
3126
|
let s = ` { id: "${t.id}", component: ${t.import} },`;
|
|
3172
3127
|
return o.trim() === "" ? e.slice(0, a) + "\n" + s + "\n" + e.slice(a) : e.slice(0, a) + s + "\n" + e.slice(a);
|
|
3173
3128
|
}
|
|
3174
|
-
function
|
|
3129
|
+
function Li(e, t) {
|
|
3175
3130
|
let n = 0;
|
|
3176
3131
|
for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
|
|
3177
3132
|
else if (e[r] === "]" && (n--, n === 0)) return r;
|
|
3178
3133
|
return -1;
|
|
3179
3134
|
}
|
|
3180
|
-
var
|
|
3135
|
+
var Ri = new Set([
|
|
3181
3136
|
".ts",
|
|
3182
3137
|
".tsx",
|
|
3183
3138
|
".js",
|
|
3184
3139
|
".jsx"
|
|
3185
3140
|
]);
|
|
3186
|
-
async function
|
|
3141
|
+
async function zi(e) {
|
|
3187
3142
|
let { files: t, paths: n, projectRoot: r, projectName: i } = e;
|
|
3188
3143
|
if (i === "hype-stack") return;
|
|
3189
3144
|
let a = `@${i}/`;
|
|
3190
3145
|
await Promise.all(t.map(async (e) => {
|
|
3191
|
-
let t =
|
|
3192
|
-
i?.isDirectory() ? await
|
|
3146
|
+
let t = Ir(e.target, n, r), i = await y.stat(t).catch(() => null);
|
|
3147
|
+
i?.isDirectory() ? await Hi(t, a) : i?.isFile() && Ri.has(T.extname(t)) && await Ui(t, a);
|
|
3193
3148
|
}));
|
|
3194
3149
|
}
|
|
3195
|
-
var
|
|
3150
|
+
var Bi = new Set([
|
|
3196
3151
|
".git",
|
|
3197
3152
|
"node_modules",
|
|
3198
3153
|
"dist",
|
|
@@ -3201,43 +3156,43 @@ var Ki = new Set([
|
|
|
3201
3156
|
".next",
|
|
3202
3157
|
"coverage"
|
|
3203
3158
|
]);
|
|
3204
|
-
async function
|
|
3205
|
-
t !== "hype-stack" && await
|
|
3159
|
+
async function Vi(e, t) {
|
|
3160
|
+
t !== "hype-stack" && await Hi(e, `@${t}/`);
|
|
3206
3161
|
}
|
|
3207
|
-
async function
|
|
3162
|
+
async function Hi(e, t) {
|
|
3208
3163
|
let n = await y.readdir(e, { withFileTypes: !0 });
|
|
3209
3164
|
await Promise.all(n.map(async (n) => {
|
|
3210
3165
|
let r = T.join(e, n.name);
|
|
3211
3166
|
if (n.isDirectory()) {
|
|
3212
|
-
if (
|
|
3213
|
-
await
|
|
3214
|
-
} else n.isFile() &&
|
|
3167
|
+
if (Bi.has(n.name)) return;
|
|
3168
|
+
await Hi(r, t);
|
|
3169
|
+
} else n.isFile() && Ri.has(T.extname(n.name)) && await Ui(r, t);
|
|
3215
3170
|
}));
|
|
3216
3171
|
}
|
|
3217
|
-
async function
|
|
3172
|
+
async function Ui(e, t) {
|
|
3218
3173
|
let n = await y.readFile(e, "utf-8");
|
|
3219
|
-
if (!n.includes(
|
|
3220
|
-
let r = n
|
|
3221
|
-
await y.writeFile(e, r, "utf-8");
|
|
3174
|
+
if (!n.includes(Vr)) return;
|
|
3175
|
+
let r = Ur(n, t);
|
|
3176
|
+
r !== n && await y.writeFile(e, r, "utf-8");
|
|
3222
3177
|
}
|
|
3223
3178
|
//#endregion
|
|
3224
3179
|
//#region src/core/installer.ts
|
|
3225
|
-
function
|
|
3180
|
+
function Wi(e, t) {
|
|
3226
3181
|
return e.slot ? t ? t.includes(e.slot) : e.slot === "frontend" : !0;
|
|
3227
3182
|
}
|
|
3228
|
-
async function
|
|
3183
|
+
async function Gi(e, t) {
|
|
3229
3184
|
if ((await y.stat(e)).isDirectory()) {
|
|
3230
3185
|
await y.mkdir(t, { recursive: !0 });
|
|
3231
3186
|
let n = await y.readdir(e, { withFileTypes: !0 });
|
|
3232
|
-
for (let r of n) await
|
|
3187
|
+
for (let r of n) await Gi(T.join(e, r.name), T.join(t, r.name));
|
|
3233
3188
|
} else await y.mkdir(T.dirname(t), { recursive: !0 }), await y.copyFile(e, t);
|
|
3234
3189
|
}
|
|
3235
|
-
async function
|
|
3190
|
+
async function Ki(e) {
|
|
3236
3191
|
let { src: t, dest: n, projectRoot: r, skip: i } = e;
|
|
3237
3192
|
if ((await y.stat(t)).isDirectory()) {
|
|
3238
3193
|
await y.mkdir(n, { recursive: !0 });
|
|
3239
3194
|
let e = await y.readdir(t, { withFileTypes: !0 });
|
|
3240
|
-
return (await Promise.all(e.map((e) =>
|
|
3195
|
+
return (await Promise.all(e.map((e) => Ki({
|
|
3241
3196
|
src: T.join(t, e.name),
|
|
3242
3197
|
dest: T.join(n, e.name),
|
|
3243
3198
|
projectRoot: r,
|
|
@@ -3246,8 +3201,8 @@ async function Qi(e) {
|
|
|
3246
3201
|
}
|
|
3247
3202
|
return i.has(t) ? [] : (await y.mkdir(T.dirname(n), { recursive: !0 }), await y.copyFile(t, n), [T.relative(r, n)]);
|
|
3248
3203
|
}
|
|
3249
|
-
async function
|
|
3250
|
-
let { file: t, packDir: n, paths: r, projectRoot: i } = e, a =
|
|
3204
|
+
async function qi(e) {
|
|
3205
|
+
let { file: t, packDir: n, paths: r, projectRoot: i } = e, a = Lr(t.source, n), o = Ir(t.target, r, i);
|
|
3251
3206
|
return {
|
|
3252
3207
|
sourcePath: a,
|
|
3253
3208
|
targetPath: o,
|
|
@@ -3255,8 +3210,8 @@ async function $i(e) {
|
|
|
3255
3210
|
targetExists: await J(o) || await ar(o)
|
|
3256
3211
|
};
|
|
3257
3212
|
}
|
|
3258
|
-
async function
|
|
3259
|
-
let { file: t, packDir: n, paths: r, projectRoot: i } = e, { sourcePath: a, targetPath: o, sourceExists: s, targetExists: c } = await
|
|
3213
|
+
async function Ji(e) {
|
|
3214
|
+
let { file: t, packDir: n, paths: r, projectRoot: i } = e, { sourcePath: a, targetPath: o, sourceExists: s, targetExists: c } = await qi({
|
|
3260
3215
|
file: t,
|
|
3261
3216
|
packDir: n,
|
|
3262
3217
|
paths: r,
|
|
@@ -3271,8 +3226,8 @@ async function ea(e) {
|
|
|
3271
3226
|
default: return `${t.target}: Unknown strategy: ${String(t.strategy)}`;
|
|
3272
3227
|
}
|
|
3273
3228
|
}
|
|
3274
|
-
async function
|
|
3275
|
-
let { file: t, packDir: n, paths: r, projectRoot: i, force: a, overwrite: o } = e, { sourcePath: s, targetPath: c, sourceExists: l, targetExists: u } = await
|
|
3229
|
+
async function Yi(e) {
|
|
3230
|
+
let { file: t, packDir: n, paths: r, projectRoot: i, force: a, overwrite: o } = e, { sourcePath: s, targetPath: c, sourceExists: l, targetExists: u } = await qi({
|
|
3276
3231
|
file: t,
|
|
3277
3232
|
packDir: n,
|
|
3278
3233
|
paths: r,
|
|
@@ -3290,7 +3245,7 @@ async function ta(e) {
|
|
|
3290
3245
|
status: "skipped",
|
|
3291
3246
|
path: t.target,
|
|
3292
3247
|
reason: "Already exists"
|
|
3293
|
-
} : (await
|
|
3248
|
+
} : (await Gi(s, c), {
|
|
3294
3249
|
status: "installed",
|
|
3295
3250
|
path: t.target
|
|
3296
3251
|
});
|
|
@@ -3299,16 +3254,16 @@ async function ta(e) {
|
|
|
3299
3254
|
status: "skipped",
|
|
3300
3255
|
path: t.target,
|
|
3301
3256
|
reason: "Already exists (skip-if-exists)"
|
|
3302
|
-
} : (await
|
|
3257
|
+
} : (await Gi(s, c), {
|
|
3303
3258
|
status: "installed",
|
|
3304
3259
|
path: t.target
|
|
3305
3260
|
});
|
|
3306
|
-
case "override": return await
|
|
3261
|
+
case "override": return await Gi(s, c), {
|
|
3307
3262
|
status: "installed",
|
|
3308
3263
|
path: t.target
|
|
3309
3264
|
};
|
|
3310
3265
|
case "merge": {
|
|
3311
|
-
if (!u) return await
|
|
3266
|
+
if (!u) return await Gi(s, c), {
|
|
3312
3267
|
status: "installed",
|
|
3313
3268
|
path: t.target
|
|
3314
3269
|
};
|
|
@@ -3338,15 +3293,15 @@ async function ta(e) {
|
|
|
3338
3293
|
};
|
|
3339
3294
|
}
|
|
3340
3295
|
}
|
|
3341
|
-
async function
|
|
3296
|
+
async function Xi(e) {
|
|
3342
3297
|
let { packs: t, config: n, projectRoot: r, slotsByPack: i } = e, a = n.paths;
|
|
3343
3298
|
if (!a) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
|
|
3344
3299
|
let o = [], s = /* @__PURE__ */ new Set();
|
|
3345
3300
|
for (let e of t) {
|
|
3346
3301
|
let t = i?.get(e.manifest.name);
|
|
3347
3302
|
for (let n of e.manifest.files) {
|
|
3348
|
-
if (n.strategy !== "create" || !
|
|
3349
|
-
let { targetPath: i, targetExists: c } = await
|
|
3303
|
+
if (n.strategy !== "create" || !Wi(n, t)) continue;
|
|
3304
|
+
let { targetPath: i, targetExists: c } = await qi({
|
|
3350
3305
|
file: n,
|
|
3351
3306
|
packDir: e.packDir,
|
|
3352
3307
|
paths: a,
|
|
@@ -3361,13 +3316,13 @@ async function na(e) {
|
|
|
3361
3316
|
}
|
|
3362
3317
|
return o;
|
|
3363
3318
|
}
|
|
3364
|
-
async function
|
|
3319
|
+
async function Zi(e) {
|
|
3365
3320
|
let { manifest: t, config: n, projectRoot: r, force: i, packDir: a, slots: o } = e, s = n.paths;
|
|
3366
3321
|
if (!s) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
|
|
3367
3322
|
let c = [];
|
|
3368
3323
|
for (let e of t.files) {
|
|
3369
|
-
if (!
|
|
3370
|
-
let t = await
|
|
3324
|
+
if (!Wi(e, o)) continue;
|
|
3325
|
+
let t = await Ji({
|
|
3371
3326
|
file: e,
|
|
3372
3327
|
packDir: a,
|
|
3373
3328
|
paths: s,
|
|
@@ -3378,16 +3333,16 @@ async function ra(e) {
|
|
|
3378
3333
|
}
|
|
3379
3334
|
return c;
|
|
3380
3335
|
}
|
|
3381
|
-
async function
|
|
3336
|
+
async function Qi(e) {
|
|
3382
3337
|
let { manifest: t, config: n, projectRoot: r, force: i, overwrite: a, packDir: o, slots: s } = e, c = n.paths;
|
|
3383
3338
|
if (!c) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
|
|
3384
3339
|
let l = {
|
|
3385
3340
|
installed: [],
|
|
3386
3341
|
skipped: [],
|
|
3387
3342
|
errors: []
|
|
3388
|
-
}, u = t.files.filter((e) =>
|
|
3343
|
+
}, u = t.files.filter((e) => Wi(e, s));
|
|
3389
3344
|
for (let e of u) {
|
|
3390
|
-
let t = await
|
|
3345
|
+
let t = await Yi({
|
|
3391
3346
|
file: e,
|
|
3392
3347
|
packDir: o,
|
|
3393
3348
|
paths: c,
|
|
@@ -3407,40 +3362,40 @@ async function ia(e) {
|
|
|
3407
3362
|
break;
|
|
3408
3363
|
}
|
|
3409
3364
|
}
|
|
3410
|
-
await
|
|
3365
|
+
await zi({
|
|
3411
3366
|
files: u,
|
|
3412
3367
|
paths: c,
|
|
3413
3368
|
projectRoot: r,
|
|
3414
3369
|
projectName: n.name
|
|
3415
|
-
}), t.env && t.env.length > 0 && await
|
|
3370
|
+
}), t.env && t.env.length > 0 && await Gr(t.env, c, r), t.routes && t.routes.length > 0 && await Zr(t.routes, c, r), t.context && t.context.length > 0 && await ei(t.context, c, r), t.sockets && t.sockets.length > 0 && await ci(t.sockets, c, r), t.sdkConfigurations && t.sdkConfigurations.length > 0 && await fi(t.sdkConfigurations, c, r), t.enums && t.enums.length > 0 && await oi(t.enums, c, r), t.frontendRoutes && t.frontendRoutes.length > 0 && await hi(t.frontendRoutes, c, r);
|
|
3416
3371
|
let d = s && s.length > 0 ? s : ["frontend"];
|
|
3417
|
-
for (let e of d) t.nav && t.nav.length > 0 && await
|
|
3372
|
+
for (let e of d) t.nav && t.nav.length > 0 && await yi({
|
|
3418
3373
|
entries: t.nav,
|
|
3419
3374
|
paths: c,
|
|
3420
3375
|
projectRoot: r,
|
|
3421
3376
|
slot: e
|
|
3422
|
-
}), t.navbarActions && t.navbarActions.length > 0 && await
|
|
3377
|
+
}), t.navbarActions && t.navbarActions.length > 0 && await Mi({
|
|
3423
3378
|
actions: t.navbarActions,
|
|
3424
3379
|
paths: c,
|
|
3425
3380
|
projectRoot: r,
|
|
3426
3381
|
slot: e
|
|
3427
|
-
}), t.userMenuActions && t.userMenuActions.length > 0 && await
|
|
3382
|
+
}), t.userMenuActions && t.userMenuActions.length > 0 && await Ni({
|
|
3428
3383
|
actions: t.userMenuActions,
|
|
3429
3384
|
paths: c,
|
|
3430
3385
|
projectRoot: r,
|
|
3431
3386
|
slot: e
|
|
3432
3387
|
});
|
|
3433
|
-
return t.onboardingSteps && t.onboardingSteps.length > 0 && await
|
|
3388
|
+
return t.onboardingSteps && t.onboardingSteps.length > 0 && await Di(t.onboardingSteps, c, r), t.postLoginRedirect && await bi({
|
|
3434
3389
|
postLoginRedirect: t.postLoginRedirect,
|
|
3435
3390
|
paths: c,
|
|
3436
3391
|
projectRoot: r,
|
|
3437
3392
|
slot: d[0]
|
|
3438
3393
|
}), l;
|
|
3439
3394
|
}
|
|
3440
|
-
async function
|
|
3395
|
+
async function $i(e) {
|
|
3441
3396
|
let { packs: t, config: n, projectRoot: r, force: i, overwrite: a, slotsByPack: o } = e, s = [];
|
|
3442
3397
|
for (let e of t) {
|
|
3443
|
-
let t = o?.get(e.manifest.name), a = await
|
|
3398
|
+
let t = o?.get(e.manifest.name), a = await Zi({
|
|
3444
3399
|
manifest: e.manifest,
|
|
3445
3400
|
config: n,
|
|
3446
3401
|
projectRoot: r,
|
|
@@ -3460,7 +3415,7 @@ async function aa(e) {
|
|
|
3460
3415
|
};
|
|
3461
3416
|
let c = [], l = [], u = [], d = [], f = n;
|
|
3462
3417
|
for (let e of t) {
|
|
3463
|
-
let t = o?.get(e.manifest.name), n = await
|
|
3418
|
+
let t = o?.get(e.manifest.name), n = await Qi({
|
|
3464
3419
|
manifest: e.manifest,
|
|
3465
3420
|
config: f,
|
|
3466
3421
|
projectRoot: r,
|
|
@@ -3469,7 +3424,7 @@ async function aa(e) {
|
|
|
3469
3424
|
packDir: e.packDir,
|
|
3470
3425
|
slots: t
|
|
3471
3426
|
});
|
|
3472
|
-
c.push(...n.installed), l.push(...n.skipped), u.push(...n.errors), f = await
|
|
3427
|
+
c.push(...n.installed), l.push(...n.skipped), u.push(...n.errors), f = await ea(f, e.manifest, r), d.push(e.manifest.name);
|
|
3473
3428
|
}
|
|
3474
3429
|
return {
|
|
3475
3430
|
installed: c,
|
|
@@ -3480,8 +3435,8 @@ async function aa(e) {
|
|
|
3480
3435
|
config: f
|
|
3481
3436
|
};
|
|
3482
3437
|
}
|
|
3483
|
-
async function
|
|
3484
|
-
let r = typeof t == "string" ? t : t.name, i = typeof t == "string" ? [] :
|
|
3438
|
+
async function ea(e, t, n) {
|
|
3439
|
+
let r = typeof t == "string" ? t : t.name, i = typeof t == "string" ? [] : Cr(t.env), a = wr([...e.onboarding?.envSections ?? [], ...i]), o = {
|
|
3485
3440
|
...e,
|
|
3486
3441
|
installedPacks: [...e.installedPacks ?? [], r],
|
|
3487
3442
|
onboarding: {
|
|
@@ -3489,19 +3444,19 @@ async function oa(e, t, n) {
|
|
|
3489
3444
|
envSections: a
|
|
3490
3445
|
}
|
|
3491
3446
|
};
|
|
3492
|
-
return await
|
|
3447
|
+
return await kr(n, o), o;
|
|
3493
3448
|
}
|
|
3494
|
-
async function
|
|
3449
|
+
async function ta(e) {
|
|
3495
3450
|
let { manifest: t, config: n, projectRoot: r, templateDir: i } = e, a = n.paths;
|
|
3496
3451
|
if (!a) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
|
|
3497
|
-
let o = [], s = [], c = t.files.filter((e) => e.strategy === "merge"), l = new Set(c.map((e) =>
|
|
3452
|
+
let o = [], s = [], c = t.files.filter((e) => e.strategy === "merge"), l = new Set(c.map((e) => Lr(e.source, i))), u = T.join(i, "files");
|
|
3498
3453
|
if (await ar(u)) {
|
|
3499
3454
|
let e = await y.readdir(u, { withFileTypes: !0 });
|
|
3500
3455
|
for (let t of e) {
|
|
3501
3456
|
if (!t.isDirectory()) continue;
|
|
3502
3457
|
let e = a[t.name]?.root;
|
|
3503
3458
|
if (!e) continue;
|
|
3504
|
-
let n = await
|
|
3459
|
+
let n = await Ki({
|
|
3505
3460
|
src: T.join(u, t.name),
|
|
3506
3461
|
dest: T.resolve(r, e),
|
|
3507
3462
|
projectRoot: r,
|
|
@@ -3511,7 +3466,7 @@ async function sa(e) {
|
|
|
3511
3466
|
}
|
|
3512
3467
|
}
|
|
3513
3468
|
for (let e of c) {
|
|
3514
|
-
let t = await
|
|
3469
|
+
let t = await Yi({
|
|
3515
3470
|
file: e,
|
|
3516
3471
|
packDir: i,
|
|
3517
3472
|
paths: a,
|
|
@@ -3521,12 +3476,12 @@ async function sa(e) {
|
|
|
3521
3476
|
});
|
|
3522
3477
|
t.status === "installed" ? o.push(t.path) : t.status === "error" && s.push(`${t.path}: ${t.reason}`);
|
|
3523
3478
|
}
|
|
3524
|
-
let d = T.join(
|
|
3525
|
-
return await J(f) && await J(p) && await y.rm(p, { force: !0 }), t.frontendRoutes && t.frontendRoutes.length > 0 && await
|
|
3479
|
+
let d = T.join(Ir("{{frontend.root}}", a, r), "src", "routes"), f = T.join(d, "(public)", "index.tsx"), p = T.join(d, "(private)", "index.tsx");
|
|
3480
|
+
return await J(f) && await J(p) && await y.rm(p, { force: !0 }), t.frontendRoutes && t.frontendRoutes.length > 0 && await hi(t.frontendRoutes, a, r), t.nav && t.nav.length > 0 && await yi({
|
|
3526
3481
|
entries: t.nav,
|
|
3527
3482
|
paths: a,
|
|
3528
3483
|
projectRoot: r
|
|
3529
|
-
}), t.postLoginRedirect && await
|
|
3484
|
+
}), t.postLoginRedirect && await bi({
|
|
3530
3485
|
postLoginRedirect: t.postLoginRedirect,
|
|
3531
3486
|
paths: a,
|
|
3532
3487
|
projectRoot: r
|
|
@@ -3537,32 +3492,32 @@ async function sa(e) {
|
|
|
3537
3492
|
}
|
|
3538
3493
|
//#endregion
|
|
3539
3494
|
//#region src/core/pack-categories.ts
|
|
3540
|
-
var
|
|
3495
|
+
var na = [
|
|
3541
3496
|
"starter",
|
|
3542
3497
|
"layout",
|
|
3543
3498
|
"feature"
|
|
3544
|
-
],
|
|
3499
|
+
], ra = {
|
|
3545
3500
|
starter: "Starter",
|
|
3546
3501
|
layout: "Layout",
|
|
3547
3502
|
feature: "Features"
|
|
3548
|
-
},
|
|
3549
|
-
function
|
|
3503
|
+
}, ia = new Set(["starter", "layout"]), aa = "starter-saas-betterauth", oa = "layout-basic";
|
|
3504
|
+
function sa(e, t = {}) {
|
|
3550
3505
|
let n = [];
|
|
3551
|
-
for (let r of
|
|
3506
|
+
for (let r of na) {
|
|
3552
3507
|
let i = e.filter((e) => e.category === r);
|
|
3553
3508
|
if (i.length === 0) continue;
|
|
3554
|
-
let a =
|
|
3509
|
+
let a = ia.has(r) ? "single" : "multiple";
|
|
3555
3510
|
if (r === "layout") {
|
|
3556
|
-
n.push(
|
|
3511
|
+
n.push(la("frontend", i)), t.adminAvailable && n.push(la("admin", i));
|
|
3557
3512
|
continue;
|
|
3558
3513
|
}
|
|
3559
3514
|
if (r === "starter") {
|
|
3560
|
-
n.push(
|
|
3515
|
+
n.push(ca(i));
|
|
3561
3516
|
continue;
|
|
3562
3517
|
}
|
|
3563
3518
|
n.push({
|
|
3564
3519
|
category: r,
|
|
3565
|
-
label:
|
|
3520
|
+
label: ra[r],
|
|
3566
3521
|
mode: a,
|
|
3567
3522
|
packs: i,
|
|
3568
3523
|
preselect: null
|
|
@@ -3570,33 +3525,33 @@ function pa(e, t = {}) {
|
|
|
3570
3525
|
}
|
|
3571
3526
|
return n;
|
|
3572
3527
|
}
|
|
3573
|
-
function
|
|
3574
|
-
let t = e.some((e) => e.name ===
|
|
3528
|
+
function ca(e) {
|
|
3529
|
+
let t = e.some((e) => e.name === aa);
|
|
3575
3530
|
return {
|
|
3576
3531
|
category: "starter",
|
|
3577
|
-
label:
|
|
3532
|
+
label: ra.starter,
|
|
3578
3533
|
mode: "single",
|
|
3579
3534
|
packs: e,
|
|
3580
|
-
preselect: t ?
|
|
3535
|
+
preselect: t ? aa : null
|
|
3581
3536
|
};
|
|
3582
3537
|
}
|
|
3583
|
-
function
|
|
3584
|
-
let n = t.some((e) => e.name ===
|
|
3538
|
+
function la(e, t) {
|
|
3539
|
+
let n = t.some((e) => e.name === oa);
|
|
3585
3540
|
return {
|
|
3586
3541
|
category: "layout",
|
|
3587
3542
|
label: e === "admin" ? "Admin Layout" : "Layout",
|
|
3588
3543
|
mode: "single",
|
|
3589
3544
|
packs: t,
|
|
3590
|
-
preselect: n ?
|
|
3545
|
+
preselect: n ? oa : null,
|
|
3591
3546
|
slot: e
|
|
3592
3547
|
};
|
|
3593
3548
|
}
|
|
3594
3549
|
//#endregion
|
|
3595
3550
|
//#region src/ui/logger.ts
|
|
3596
|
-
var
|
|
3597
|
-
function
|
|
3551
|
+
var ua = [he.orangeBright, he.skyBlue];
|
|
3552
|
+
function da(e) {
|
|
3598
3553
|
let t = e.map((e, t) => {
|
|
3599
|
-
let n =
|
|
3554
|
+
let n = ua[t % ua.length];
|
|
3600
3555
|
return `${z.bold(n(`${t + 1}.`))} ${z.bold(e)}`;
|
|
3601
3556
|
}).join("\n");
|
|
3602
3557
|
s.note(t, "Next steps");
|
|
@@ -3606,13 +3561,13 @@ function Z() {
|
|
|
3606
3561
|
}
|
|
3607
3562
|
//#endregion
|
|
3608
3563
|
//#region src/core/post-setup.ts
|
|
3609
|
-
async function
|
|
3564
|
+
async function fa() {
|
|
3610
3565
|
return (await q("docker", ["info"], { cwd: process.cwd() })).exitCode === 0;
|
|
3611
3566
|
}
|
|
3612
|
-
async function
|
|
3567
|
+
async function pa(e) {
|
|
3613
3568
|
return J(`${e}/apps/backend/.env`);
|
|
3614
3569
|
}
|
|
3615
|
-
async function
|
|
3570
|
+
async function ma(e, t, n) {
|
|
3616
3571
|
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({
|
|
3617
3572
|
message: r,
|
|
3618
3573
|
initialValue: !0
|
|
@@ -3625,13 +3580,13 @@ async function ba(e, t, n) {
|
|
|
3625
3580
|
"up",
|
|
3626
3581
|
"-d"
|
|
3627
3582
|
], { cwd: `${e}/apps/backend` });
|
|
3628
|
-
return o.exitCode === 0 ? (a.stop(z.success("Docker services started")), !0) : (a.error("Failed to start Docker services"),
|
|
3583
|
+
return o.exitCode === 0 ? (a.stop(z.success("Docker services started")), !0) : (a.error("Failed to start Docker services"), ha(o), !1);
|
|
3629
3584
|
}
|
|
3630
|
-
function
|
|
3585
|
+
function ha(e) {
|
|
3631
3586
|
let t = (e.stderr || e.stdout).trim();
|
|
3632
3587
|
t && s.log.warn(z.muted(t));
|
|
3633
3588
|
}
|
|
3634
|
-
async function
|
|
3589
|
+
async function ga(e, t = 15, n = 2e3) {
|
|
3635
3590
|
for (let r = 0; r < t; r++) {
|
|
3636
3591
|
if ((await q("docker", [
|
|
3637
3592
|
"compose",
|
|
@@ -3646,8 +3601,8 @@ async function Sa(e, t = 15, n = 2e3) {
|
|
|
3646
3601
|
}
|
|
3647
3602
|
return !1;
|
|
3648
3603
|
}
|
|
3649
|
-
var
|
|
3650
|
-
async function
|
|
3604
|
+
var _a = "Database schema is up to date";
|
|
3605
|
+
async function va(e) {
|
|
3651
3606
|
let t = await q("pnpm", [
|
|
3652
3607
|
"--filter",
|
|
3653
3608
|
"@internal/backend",
|
|
@@ -3656,9 +3611,9 @@ async function wa(e) {
|
|
|
3656
3611
|
"migrate",
|
|
3657
3612
|
"status"
|
|
3658
3613
|
], { cwd: e });
|
|
3659
|
-
return t.exitCode === 0 ? `${t.stdout}\n${t.stderr}`.includes(
|
|
3614
|
+
return t.exitCode === 0 ? `${t.stdout}\n${t.stderr}`.includes(_a) : !1;
|
|
3660
3615
|
}
|
|
3661
|
-
async function
|
|
3616
|
+
async function ya(e) {
|
|
3662
3617
|
let t = s.spinner();
|
|
3663
3618
|
t.start("Running database migrations...");
|
|
3664
3619
|
let n = await q("pnpm", [
|
|
@@ -3666,15 +3621,15 @@ async function Ta(e) {
|
|
|
3666
3621
|
"@internal/backend",
|
|
3667
3622
|
"migration:latest"
|
|
3668
3623
|
], { cwd: e });
|
|
3669
|
-
return n.exitCode === 0 ? (t.stop(z.success("Database migrations applied")), !0) : (t.error("Migrations failed"),
|
|
3624
|
+
return n.exitCode === 0 ? (t.stop(z.success("Database migrations applied")), !0) : (t.error("Migrations failed"), ha(n), s.log.warn(z.muted("Run `pnpm --filter @internal/backend migration:latest` manually to apply migrations.")), !1);
|
|
3670
3625
|
}
|
|
3671
|
-
async function
|
|
3672
|
-
if (!await
|
|
3626
|
+
async function ba(e, t, n = {}) {
|
|
3627
|
+
if (!await ma(e, t, await fa())) return !1;
|
|
3673
3628
|
let r = s.spinner();
|
|
3674
|
-
return r.start("Waiting for Postgres to be ready..."), await
|
|
3629
|
+
return r.start("Waiting for Postgres to be ready..."), await ga(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);
|
|
3675
3630
|
}
|
|
3676
|
-
async function
|
|
3677
|
-
if (!await
|
|
3631
|
+
async function xa(e, t, n = {}) {
|
|
3632
|
+
if (!await ba(e, t, n)) return;
|
|
3678
3633
|
let r = t ? !0 : await s.confirm({
|
|
3679
3634
|
message: `Run database migrations with ${z.command("prisma migrate deploy")}?`,
|
|
3680
3635
|
initialValue: !0
|
|
@@ -3683,21 +3638,21 @@ async function Da(e, t, n = {}) {
|
|
|
3683
3638
|
s.log.info(z.muted("Skipping database migrations."));
|
|
3684
3639
|
return;
|
|
3685
3640
|
}
|
|
3686
|
-
await
|
|
3641
|
+
await ya(e);
|
|
3687
3642
|
}
|
|
3688
|
-
async function
|
|
3689
|
-
if (!await
|
|
3643
|
+
async function Sa(e, t, n = {}) {
|
|
3644
|
+
if (!await pa(e)) {
|
|
3690
3645
|
s.log.warn(`${z.path(".env")} not found in ${z.path("apps/backend")}. Skipping Docker and migrations - configure it first.`);
|
|
3691
3646
|
return;
|
|
3692
3647
|
}
|
|
3693
|
-
await
|
|
3648
|
+
await xa(e, t, n);
|
|
3694
3649
|
}
|
|
3695
|
-
async function
|
|
3696
|
-
return await
|
|
3650
|
+
async function Ca(e, t, n = {}) {
|
|
3651
|
+
return await pa(e) ? ba(e, t, n) : (s.log.warn(`${z.path(".env")} not found in ${z.path("apps/backend")}. Skipping Docker - configure it first.`), !1);
|
|
3697
3652
|
}
|
|
3698
3653
|
//#endregion
|
|
3699
3654
|
//#region src/core/resolve.ts
|
|
3700
|
-
function
|
|
3655
|
+
function wa(e) {
|
|
3701
3656
|
let t = /* @__PURE__ */ new Map();
|
|
3702
3657
|
for (let n of e) t.set(n.name, {
|
|
3703
3658
|
name: n.name,
|
|
@@ -3705,7 +3660,7 @@ function Aa(e) {
|
|
|
3705
3660
|
});
|
|
3706
3661
|
return t;
|
|
3707
3662
|
}
|
|
3708
|
-
function
|
|
3663
|
+
function Ta(e, t, n = /* @__PURE__ */ new Set()) {
|
|
3709
3664
|
let r = /* @__PURE__ */ new Set();
|
|
3710
3665
|
function i(e) {
|
|
3711
3666
|
if (n.has(e)) return [];
|
|
@@ -3719,10 +3674,10 @@ function ja(e, t, n = /* @__PURE__ */ new Set()) {
|
|
|
3719
3674
|
}
|
|
3720
3675
|
return i(e);
|
|
3721
3676
|
}
|
|
3722
|
-
function
|
|
3677
|
+
function Ea(e, t, n = []) {
|
|
3723
3678
|
let r = new Set(n), i = new Set(n), a = [];
|
|
3724
3679
|
for (let n of e) {
|
|
3725
|
-
let e =
|
|
3680
|
+
let e = Ta(n, t, new Set(i));
|
|
3726
3681
|
for (let t of e) i.has(t) || (i.add(t), a.push(t));
|
|
3727
3682
|
}
|
|
3728
3683
|
return {
|
|
@@ -3730,7 +3685,7 @@ function Ma(e, t, n = []) {
|
|
|
3730
3685
|
alreadyInstalled: e.filter((e) => r.has(e))
|
|
3731
3686
|
};
|
|
3732
3687
|
}
|
|
3733
|
-
function
|
|
3688
|
+
function Da(e) {
|
|
3734
3689
|
let { order: t, graph: n, isLocked: r, installed: i = [] } = e, a = new Set(i), o = /* @__PURE__ */ new Set();
|
|
3735
3690
|
for (let e of t) {
|
|
3736
3691
|
let t = n.get(e)?.dependencies.some((e) => !a.has(e) && o.has(e)) ?? !1;
|
|
@@ -3743,7 +3698,7 @@ function Na(e) {
|
|
|
3743
3698
|
}
|
|
3744
3699
|
//#endregion
|
|
3745
3700
|
//#region src/core/variants.ts
|
|
3746
|
-
function
|
|
3701
|
+
function Oa(e, t = {}) {
|
|
3747
3702
|
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
3748
3703
|
for (let i of e) {
|
|
3749
3704
|
let e = t[i.family] ?? i.default;
|
|
@@ -3755,14 +3710,14 @@ function Pa(e, t = {}) {
|
|
|
3755
3710
|
familyOf: r
|
|
3756
3711
|
};
|
|
3757
3712
|
}
|
|
3758
|
-
function
|
|
3713
|
+
function ka(e, t, n) {
|
|
3759
3714
|
return [...e.map((e) => n.chosen.get(e.family) ?? e.default), ...t];
|
|
3760
3715
|
}
|
|
3761
|
-
function
|
|
3716
|
+
function Aa(e, t) {
|
|
3762
3717
|
let n = t.familyOf.get(e);
|
|
3763
3718
|
return n ? t.chosen.get(n) ?? e : e;
|
|
3764
3719
|
}
|
|
3765
|
-
function
|
|
3720
|
+
function ja(e, t) {
|
|
3766
3721
|
let n = /* @__PURE__ */ new Map();
|
|
3767
3722
|
for (let t of e) t.family && n.set(t.name, t.family);
|
|
3768
3723
|
let r = new Set(t), i = /* @__PURE__ */ new Map();
|
|
@@ -3778,65 +3733,65 @@ function La(e, t) {
|
|
|
3778
3733
|
familyOf: n
|
|
3779
3734
|
};
|
|
3780
3735
|
}
|
|
3781
|
-
function
|
|
3736
|
+
function Ma(e, t) {
|
|
3782
3737
|
return e.map((e) => ({
|
|
3783
3738
|
...e,
|
|
3784
|
-
dependencies: e.dependencies.map((e) =>
|
|
3739
|
+
dependencies: e.dependencies.map((e) => Aa(e, t))
|
|
3785
3740
|
}));
|
|
3786
3741
|
}
|
|
3787
3742
|
//#endregion
|
|
3788
3743
|
//#region src/ui/banner.ts
|
|
3789
|
-
var
|
|
3744
|
+
var Na = [
|
|
3790
3745
|
" ██╗ ██╗ ██╗ ██╗ ██████╗ ███████╗",
|
|
3791
3746
|
" ██║ ██║ ╚██╗ ██╔╝ ██╔══██╗ ██╔════╝",
|
|
3792
3747
|
" ███████║ ╚████╔╝ ██████╔╝ █████╗ ",
|
|
3793
3748
|
" ██╔══██║ ╚██╔╝ ██╔═══╝ ██╔══╝ ",
|
|
3794
3749
|
" ██║ ██║ ██║ ██║ ███████╗",
|
|
3795
3750
|
" ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝"
|
|
3796
|
-
],
|
|
3751
|
+
], Pa = [
|
|
3797
3752
|
" ███████╗ ████████╗ █████╗ ██████╗ ██╗ ██╗",
|
|
3798
3753
|
" ██╔════╝ ╚══██╔══╝ ██╔══██╗ ██╔════╝ ██║ ██╔╝",
|
|
3799
3754
|
" ███████╗ ██║ ███████║ ██║ █████╔╝ ",
|
|
3800
3755
|
" ╚════██║ ██║ ██╔══██║ ██║ ██╔═██╗ ",
|
|
3801
3756
|
" ███████║ ██║ ██║ ██║ ╚██████╗ ██║ ██╗",
|
|
3802
3757
|
" ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝"
|
|
3803
|
-
],
|
|
3758
|
+
], Fa = [
|
|
3804
3759
|
253,
|
|
3805
3760
|
176,
|
|
3806
3761
|
21
|
|
3807
|
-
],
|
|
3762
|
+
], Ia = [
|
|
3808
3763
|
245,
|
|
3809
3764
|
76,
|
|
3810
3765
|
2
|
|
3811
|
-
],
|
|
3766
|
+
], La = 5, Ra = [
|
|
3812
3767
|
17,
|
|
3813
3768
|
103,
|
|
3814
3769
|
248
|
|
3815
|
-
],
|
|
3770
|
+
], za = [
|
|
3816
3771
|
42,
|
|
3817
3772
|
160,
|
|
3818
3773
|
250
|
|
3819
|
-
],
|
|
3820
|
-
function
|
|
3774
|
+
], Ba = .2;
|
|
3775
|
+
function Va() {
|
|
3821
3776
|
console.log();
|
|
3822
|
-
for (let e of be(
|
|
3823
|
-
start:
|
|
3824
|
-
end:
|
|
3825
|
-
angle:
|
|
3777
|
+
for (let e of be(Na, {
|
|
3778
|
+
start: Fa,
|
|
3779
|
+
end: Ia,
|
|
3780
|
+
angle: La
|
|
3826
3781
|
})) console.log(b.bold(e));
|
|
3827
|
-
for (let e of be(
|
|
3828
|
-
start:
|
|
3829
|
-
end:
|
|
3830
|
-
angle:
|
|
3782
|
+
for (let e of be(Pa, {
|
|
3783
|
+
start: Ra,
|
|
3784
|
+
end: za,
|
|
3785
|
+
angle: Ba
|
|
3831
3786
|
})) console.log(b.bold(e));
|
|
3832
3787
|
console.log(), console.log(` ${B.spark} ${b.dim("v" + A)} ${b.dim("·")} ${ve("Ship web + desktop apps from one codebase")}`), console.log();
|
|
3833
3788
|
}
|
|
3834
|
-
function
|
|
3789
|
+
function Ha() {
|
|
3835
3790
|
console.log(), console.log(` ${B.bolt} ${he.orange("Hype")}${he.skyBlue("Stack")} ${b.dim("v" + A)}`), console.log();
|
|
3836
3791
|
}
|
|
3837
3792
|
//#endregion
|
|
3838
3793
|
//#region src/ui/pack-multiselect.ts
|
|
3839
|
-
var
|
|
3794
|
+
var Ua = class extends O {
|
|
3840
3795
|
options;
|
|
3841
3796
|
cursor = 0;
|
|
3842
3797
|
selected;
|
|
@@ -3940,44 +3895,44 @@ var Ya = class extends O {
|
|
|
3940
3895
|
}
|
|
3941
3896
|
}
|
|
3942
3897
|
};
|
|
3943
|
-
function
|
|
3944
|
-
return new
|
|
3898
|
+
function Wa(e) {
|
|
3899
|
+
return new Ua(e).prompt();
|
|
3945
3900
|
}
|
|
3946
3901
|
//#endregion
|
|
3947
3902
|
//#region src/utils/naming.ts
|
|
3948
|
-
function
|
|
3903
|
+
function Ga(e) {
|
|
3949
3904
|
return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
3950
3905
|
}
|
|
3951
|
-
function
|
|
3906
|
+
function Ka(e) {
|
|
3952
3907
|
return e.split(/[-_]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
|
|
3953
3908
|
}
|
|
3954
3909
|
//#endregion
|
|
3955
3910
|
//#region src/utils/validate.ts
|
|
3956
|
-
function
|
|
3911
|
+
function qa(e) {
|
|
3957
3912
|
if (!e.trim()) return "Project name cannot be empty";
|
|
3958
3913
|
if (e.length > 214) return "Project name is too long (max 214 characters)";
|
|
3959
|
-
let t =
|
|
3914
|
+
let t = Ga(e);
|
|
3960
3915
|
if (!re.test(t)) return "Project name must contain at least one letter or number";
|
|
3961
3916
|
}
|
|
3962
3917
|
//#endregion
|
|
3963
3918
|
//#region src/core/apply-mode.ts
|
|
3964
|
-
var
|
|
3965
|
-
function
|
|
3966
|
-
return e.replace(
|
|
3919
|
+
var Ja = "src/hooks/use-theme.ts", Ya = /(\bexport\s+const\s+defaultTheme\s*=\s*)(["'])(?:light|dark)\2/;
|
|
3920
|
+
function Xa(e, t) {
|
|
3921
|
+
return e.replace(Ya, (e, n, r) => `${n}${r}${t}${r}`);
|
|
3967
3922
|
}
|
|
3968
|
-
async function
|
|
3969
|
-
let n = T.resolve(e,
|
|
3923
|
+
async function Za(e, t) {
|
|
3924
|
+
let n = T.resolve(e, Ja), r;
|
|
3970
3925
|
try {
|
|
3971
3926
|
r = await y.readFile(n, "utf-8");
|
|
3972
3927
|
} catch {
|
|
3973
3928
|
return !1;
|
|
3974
3929
|
}
|
|
3975
|
-
let i =
|
|
3930
|
+
let i = Xa(r, t);
|
|
3976
3931
|
return i === r || await y.writeFile(n, i, "utf-8"), !0;
|
|
3977
3932
|
}
|
|
3978
3933
|
//#endregion
|
|
3979
3934
|
//#region src/core/apply-theme.ts
|
|
3980
|
-
function
|
|
3935
|
+
function Qa(e, t) {
|
|
3981
3936
|
let n = 0;
|
|
3982
3937
|
for (; n < e.length;) {
|
|
3983
3938
|
let r = e.indexOf(t, n);
|
|
@@ -4000,47 +3955,47 @@ function io(e, t) {
|
|
|
4000
3955
|
}
|
|
4001
3956
|
return null;
|
|
4002
3957
|
}
|
|
4003
|
-
function
|
|
3958
|
+
function $a(e, t) {
|
|
4004
3959
|
let n = e;
|
|
4005
3960
|
for (let [e, r] of Object.entries(t)) {
|
|
4006
|
-
let t = RegExp(`(^[ \\t]*--${
|
|
3961
|
+
let t = RegExp(`(^[ \\t]*--${eo(e)}[ \\t]*:[ \\t]*)([^;\\n]*);`, "m");
|
|
4007
3962
|
n = n.replace(t, (e, t) => `${t}${r};`);
|
|
4008
3963
|
}
|
|
4009
3964
|
return n;
|
|
4010
3965
|
}
|
|
4011
|
-
function
|
|
3966
|
+
function eo(e) {
|
|
4012
3967
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4013
3968
|
}
|
|
4014
|
-
function
|
|
4015
|
-
let n =
|
|
3969
|
+
function to(e, t) {
|
|
3970
|
+
let n = Qa(e, ":root"), r = Qa(e, ".dark"), i = e;
|
|
4016
3971
|
if (n) {
|
|
4017
3972
|
let e = i.slice(0, n.bodyStart), r = i.slice(n.bodyStart, n.bodyEnd), a = i.slice(n.bodyEnd);
|
|
4018
|
-
i = e +
|
|
3973
|
+
i = e + $a(r, t.light) + a;
|
|
4019
3974
|
}
|
|
4020
3975
|
if (r) {
|
|
4021
|
-
let e =
|
|
3976
|
+
let e = Qa(i, ".dark");
|
|
4022
3977
|
if (e) {
|
|
4023
3978
|
let n = i.slice(0, e.bodyStart), r = i.slice(e.bodyStart, e.bodyEnd), a = i.slice(e.bodyEnd);
|
|
4024
|
-
i = n +
|
|
3979
|
+
i = n + $a(r, t.dark) + a;
|
|
4025
3980
|
}
|
|
4026
3981
|
}
|
|
4027
3982
|
return i;
|
|
4028
3983
|
}
|
|
4029
|
-
var
|
|
4030
|
-
async function
|
|
4031
|
-
let n = T.resolve(e,
|
|
3984
|
+
var no = "assets/styles.css";
|
|
3985
|
+
async function ro(e, t) {
|
|
3986
|
+
let n = T.resolve(e, no), r;
|
|
4032
3987
|
try {
|
|
4033
3988
|
r = await y.readFile(n, "utf-8");
|
|
4034
3989
|
} catch {
|
|
4035
3990
|
return !1;
|
|
4036
3991
|
}
|
|
4037
|
-
let i =
|
|
3992
|
+
let i = to(r, t);
|
|
4038
3993
|
return i === r || await y.writeFile(n, i, "utf-8"), !0;
|
|
4039
3994
|
}
|
|
4040
3995
|
//#endregion
|
|
4041
3996
|
//#region src/core/clone.ts
|
|
4042
|
-
async function
|
|
4043
|
-
let t = await ee(
|
|
3997
|
+
async function io(e) {
|
|
3998
|
+
let t = await ee(te, {
|
|
4044
3999
|
dir: e,
|
|
4045
4000
|
force: !0
|
|
4046
4001
|
});
|
|
@@ -4051,7 +4006,7 @@ async function uo(e) {
|
|
|
4051
4006
|
}
|
|
4052
4007
|
//#endregion
|
|
4053
4008
|
//#region src/core/editor-config.ts
|
|
4054
|
-
function
|
|
4009
|
+
function ao(e) {
|
|
4055
4010
|
let t = {
|
|
4056
4011
|
globs: [],
|
|
4057
4012
|
alwaysApply: !1
|
|
@@ -4086,10 +4041,10 @@ function fo(e) {
|
|
|
4086
4041
|
content: i
|
|
4087
4042
|
};
|
|
4088
4043
|
}
|
|
4089
|
-
function
|
|
4044
|
+
function oo(e) {
|
|
4090
4045
|
return e.frontmatter.globs.length > 0 ? `---\npaths:\n${e.frontmatter.globs.map((e) => ` - "${e}"`).join("\n")}\n---\n\n${e.content}` : e.content;
|
|
4091
4046
|
}
|
|
4092
|
-
function
|
|
4047
|
+
function so(e) {
|
|
4093
4048
|
let t;
|
|
4094
4049
|
t = e.frontmatter.alwaysApply ? "always_on" : e.frontmatter.globs.length > 0 ? "glob" : "model_decision";
|
|
4095
4050
|
let n = [`trigger: ${t}`];
|
|
@@ -4099,30 +4054,30 @@ function mo(e) {
|
|
|
4099
4054
|
}
|
|
4100
4055
|
return e.frontmatter.description && n.push(`description: ${e.frontmatter.description}`), `---\n${n.join("\n")}\n---\n\n${e.content}`;
|
|
4101
4056
|
}
|
|
4102
|
-
function
|
|
4057
|
+
function co(e) {
|
|
4103
4058
|
return e.frontmatter.globs.length > 0 ? `---\napplyTo: "${e.frontmatter.globs.join(", ")}"\n---\n\n${e.content}` : e.content;
|
|
4104
4059
|
}
|
|
4105
|
-
var
|
|
4060
|
+
var lo = {
|
|
4106
4061
|
claude: {
|
|
4107
4062
|
rulesDir: ".claude/rules",
|
|
4108
4063
|
extension: ".md",
|
|
4109
|
-
convert:
|
|
4064
|
+
convert: oo
|
|
4110
4065
|
},
|
|
4111
4066
|
windsurf: {
|
|
4112
4067
|
rulesDir: ".windsurf/rules",
|
|
4113
4068
|
extension: ".md",
|
|
4114
|
-
convert:
|
|
4069
|
+
convert: so
|
|
4115
4070
|
},
|
|
4116
4071
|
copilot: {
|
|
4117
4072
|
rulesDir: ".github/instructions",
|
|
4118
4073
|
extension: ".instructions.md",
|
|
4119
|
-
convert:
|
|
4074
|
+
convert: co
|
|
4120
4075
|
}
|
|
4121
4076
|
};
|
|
4122
|
-
async function
|
|
4077
|
+
async function uo(e) {
|
|
4123
4078
|
let t = T.join(e, ae), n = (await y.readdir(t, { withFileTypes: !0 }).catch(() => [])).filter((e) => e.isFile() && e.name.endsWith(".mdc"));
|
|
4124
4079
|
return await Promise.all(n.map(async (e) => {
|
|
4125
|
-
let n = T.join(t, e.name), { frontmatter: r, content: i } =
|
|
4080
|
+
let n = T.join(t, e.name), { frontmatter: r, content: i } = ao(await y.readFile(n, "utf-8"));
|
|
4126
4081
|
return {
|
|
4127
4082
|
frontmatter: r,
|
|
4128
4083
|
content: i,
|
|
@@ -4130,9 +4085,9 @@ async function _o(e) {
|
|
|
4130
4085
|
};
|
|
4131
4086
|
}));
|
|
4132
4087
|
}
|
|
4133
|
-
async function
|
|
4088
|
+
async function fo(e, t) {
|
|
4134
4089
|
if (t === "cursor") return;
|
|
4135
|
-
let n =
|
|
4090
|
+
let n = lo[t], r = await uo(e), i = T.join(e, n.rulesDir);
|
|
4136
4091
|
await y.mkdir(i, { recursive: !0 }), await Promise.all(r.map((e) => {
|
|
4137
4092
|
let t = n.convert(e), r = e.filename.replace(/\.mdc$/, n.extension);
|
|
4138
4093
|
return y.writeFile(T.join(i, r), t, "utf-8");
|
|
@@ -4140,21 +4095,21 @@ async function vo(e, t) {
|
|
|
4140
4095
|
}
|
|
4141
4096
|
//#endregion
|
|
4142
4097
|
//#region src/core/env-files.ts
|
|
4143
|
-
var
|
|
4098
|
+
var po = [
|
|
4144
4099
|
"apps",
|
|
4145
4100
|
"packages",
|
|
4146
4101
|
"libs",
|
|
4147
4102
|
"shared"
|
|
4148
4103
|
];
|
|
4149
|
-
async function
|
|
4150
|
-
let t = await
|
|
4104
|
+
async function mo(e) {
|
|
4105
|
+
let t = await ho(e);
|
|
4151
4106
|
return (await Promise.all(t.map(async (t) => {
|
|
4152
4107
|
let n = T.join(T.dirname(t), ".env");
|
|
4153
4108
|
return await J(n) ? null : (await y.copyFile(t, n), T.relative(e, n));
|
|
4154
4109
|
}))).filter((e) => e !== null).sort();
|
|
4155
4110
|
}
|
|
4156
|
-
async function
|
|
4157
|
-
let t = [T.join(e, ".env.example")], n = await Promise.all(
|
|
4111
|
+
async function ho(e) {
|
|
4112
|
+
let t = [T.join(e, ".env.example")], n = await Promise.all(po.map(async (t) => {
|
|
4158
4113
|
let n = T.join(e, t);
|
|
4159
4114
|
return (await y.readdir(n, { withFileTypes: !0 }).catch(() => [])).filter((e) => e.isDirectory()).map((e) => T.join(n, e.name, ".env.example"));
|
|
4160
4115
|
}));
|
|
@@ -4162,11 +4117,11 @@ async function xo(e) {
|
|
|
4162
4117
|
}
|
|
4163
4118
|
//#endregion
|
|
4164
4119
|
//#region src/core/post-clone.ts
|
|
4165
|
-
var Q = "@hype-stack/",
|
|
4166
|
-
async function
|
|
4120
|
+
var Q = "@hype-stack/", go = "hype-stack", _o = "@hype-stack/cli";
|
|
4121
|
+
async function vo(e) {
|
|
4167
4122
|
await ur(T.join(e, ".git"));
|
|
4168
4123
|
}
|
|
4169
|
-
async function
|
|
4124
|
+
async function yo(e) {
|
|
4170
4125
|
await q("git", ["init"], { cwd: e }), await q("git", ["add", "."], { cwd: e }), await q("git", [
|
|
4171
4126
|
"-c",
|
|
4172
4127
|
"user.name=Hype Stack CLI",
|
|
@@ -4177,22 +4132,19 @@ async function wo(e) {
|
|
|
4177
4132
|
"Initial commit from Hype Stack CLI"
|
|
4178
4133
|
], { cwd: e });
|
|
4179
4134
|
}
|
|
4180
|
-
async function
|
|
4181
|
-
let n = `@${t}/`, r = await
|
|
4135
|
+
async function bo(e, t) {
|
|
4136
|
+
let n = `@${t}/`, r = await Oo(e);
|
|
4182
4137
|
for (let e of r) {
|
|
4183
4138
|
let t = await sr(e);
|
|
4184
4139
|
if (!t) continue;
|
|
4185
4140
|
let r = !1;
|
|
4186
|
-
t.name?.startsWith(Q) && (t.name = t.name.replace(Q, n), r = !0),
|
|
4187
|
-
let i = await y.readFile(e, "utf-8");
|
|
4188
|
-
|
|
4189
|
-
let t = i.replaceAll(Q, n);
|
|
4190
|
-
await y.writeFile(e, t, "utf-8");
|
|
4191
|
-
} else r && await cr(e, t);
|
|
4141
|
+
t.name?.startsWith(Q) && (t.name = t.name.replace(Q, n), r = !0), To(t.dependencies, n) && (r = !0), To(t.devDependencies, n) && (r = !0), t.nx && Eo(t.nx, n) && (r = !0);
|
|
4142
|
+
let i = await y.readFile(e, "utf-8"), a = Ur(i, n);
|
|
4143
|
+
a === i ? r && await cr(e, t) : await y.writeFile(e, a, "utf-8");
|
|
4192
4144
|
}
|
|
4193
|
-
await
|
|
4145
|
+
await Vi(e, t), await Co(e, t), await Do(e, t);
|
|
4194
4146
|
}
|
|
4195
|
-
var
|
|
4147
|
+
var xo = new Set([
|
|
4196
4148
|
".git",
|
|
4197
4149
|
"node_modules",
|
|
4198
4150
|
"dist",
|
|
@@ -4200,10 +4152,10 @@ var Eo = new Set([
|
|
|
4200
4152
|
".nx",
|
|
4201
4153
|
".next",
|
|
4202
4154
|
"coverage"
|
|
4203
|
-
]),
|
|
4204
|
-
async function
|
|
4205
|
-
if (t ===
|
|
4206
|
-
let n = await
|
|
4155
|
+
]), So = /^(docker-compose|compose)(\.[\w.-]+)?\.ya?ml$/;
|
|
4156
|
+
async function Co(e, t) {
|
|
4157
|
+
if (t === go) return;
|
|
4158
|
+
let n = await wo(e);
|
|
4207
4159
|
await Promise.all(n.map(async (e) => {
|
|
4208
4160
|
let n = await y.readFile(e, "utf-8").catch(() => null);
|
|
4209
4161
|
if (!n || !/^name:[ \t]*hype-stack/m.test(n)) return;
|
|
@@ -4211,23 +4163,23 @@ async function Oo(e, t) {
|
|
|
4211
4163
|
await y.writeFile(e, r, "utf-8");
|
|
4212
4164
|
}));
|
|
4213
4165
|
}
|
|
4214
|
-
async function
|
|
4166
|
+
async function wo(e) {
|
|
4215
4167
|
let t = await y.readdir(e, { withFileTypes: !0 }).catch(() => []);
|
|
4216
4168
|
return (await Promise.all(t.map(async (t) => {
|
|
4217
4169
|
let n = T.join(e, t.name);
|
|
4218
|
-
return t.isDirectory() ?
|
|
4170
|
+
return t.isDirectory() ? xo.has(t.name) ? [] : wo(n) : t.isFile() && So.test(t.name) ? [n] : [];
|
|
4219
4171
|
}))).flat();
|
|
4220
4172
|
}
|
|
4221
|
-
function
|
|
4173
|
+
function To(e, t) {
|
|
4222
4174
|
if (!e) return !1;
|
|
4223
4175
|
let n = !1;
|
|
4224
|
-
for (let r of Object.keys(e)) if (r.startsWith(Q)) {
|
|
4176
|
+
for (let r of Object.keys(e)) if (r !== _o && r.startsWith(Q)) {
|
|
4225
4177
|
let i = r.replace(Q, t);
|
|
4226
4178
|
e[i] = e[r], delete e[r], n = !0;
|
|
4227
4179
|
}
|
|
4228
4180
|
return n;
|
|
4229
4181
|
}
|
|
4230
|
-
function
|
|
4182
|
+
function Eo(e, t) {
|
|
4231
4183
|
if (!e) return !1;
|
|
4232
4184
|
let n = !1;
|
|
4233
4185
|
if (e.implicitDependencies &&= e.implicitDependencies.map((e) => e.startsWith(Q) ? (n = !0, e.replace(Q, t)) : e), e.targets) {
|
|
@@ -4235,13 +4187,13 @@ function jo(e, t) {
|
|
|
4235
4187
|
}
|
|
4236
4188
|
return n;
|
|
4237
4189
|
}
|
|
4238
|
-
async function
|
|
4190
|
+
async function Do(e, t) {
|
|
4239
4191
|
let n = T.join(e, "packages/enums/src/app/index.ts"), r = await y.readFile(n, "utf-8").catch(() => null);
|
|
4240
4192
|
if (!r) return;
|
|
4241
|
-
let i =
|
|
4193
|
+
let i = Ka(t), a = r.replaceAll(`id: "${go}"`, `id: "${t}"`).replaceAll(`name: "${go}"`, `name: "${t}"`).replace(/name: "Hype Stack"/, `name: "${i}"`).replace(/description: ".*?"/, `description: "${i} application"`);
|
|
4242
4194
|
await y.writeFile(n, a, "utf-8");
|
|
4243
4195
|
}
|
|
4244
|
-
async function
|
|
4196
|
+
async function Oo(e) {
|
|
4245
4197
|
let t = [], n = T.join(e, "package.json");
|
|
4246
4198
|
(await y.stat(n).catch(() => null))?.isFile() && t.push(n);
|
|
4247
4199
|
for (let n of [
|
|
@@ -4261,7 +4213,7 @@ async function No(e) {
|
|
|
4261
4213
|
}
|
|
4262
4214
|
//#endregion
|
|
4263
4215
|
//#region src/core/readme.ts
|
|
4264
|
-
var
|
|
4216
|
+
var ko = {
|
|
4265
4217
|
cursor: {
|
|
4266
4218
|
label: "Cursor",
|
|
4267
4219
|
rulesDir: ".cursor/rules"
|
|
@@ -4278,21 +4230,21 @@ var Po = {
|
|
|
4278
4230
|
label: "GitHub Copilot",
|
|
4279
4231
|
rulesDir: ".github/instructions"
|
|
4280
4232
|
}
|
|
4281
|
-
},
|
|
4233
|
+
}, Ao = {
|
|
4282
4234
|
backend: "Hono API server (Postgres, Prisma, Kysely, Valkey cache, WorkOS auth)",
|
|
4283
4235
|
frontend: "React + Vite app talking to the backend through the typed HyperFetch SDK"
|
|
4284
|
-
},
|
|
4236
|
+
}, jo = {
|
|
4285
4237
|
enums: "Shared enums and app config used across apps",
|
|
4286
4238
|
cli: "Project tooling and code generators"
|
|
4287
4239
|
};
|
|
4288
|
-
function
|
|
4240
|
+
function Mo(e, t) {
|
|
4289
4241
|
return Object.entries(e).toSorted(([e], [t]) => e.localeCompare(t)).map(([e, n]) => {
|
|
4290
4242
|
let r = t[e];
|
|
4291
4243
|
return r ? `- \`${n}\` - ${r}` : `- \`${n}\``;
|
|
4292
4244
|
});
|
|
4293
4245
|
}
|
|
4294
|
-
function
|
|
4295
|
-
let { projectName: t, editor: n, workspace: r } = e, i =
|
|
4246
|
+
function No(e) {
|
|
4247
|
+
let { projectName: t, editor: n, workspace: r } = e, i = Ka(t), a = ko[n], o = !!r.apps.backend, s = Mo(r.apps, Ao), c = Mo(r.packages, jo), l = [];
|
|
4296
4248
|
s.length > 0 && l.push(...s), c.length > 0 && l.push(...c), l.push("- `stack.json` - Hype Stack workspace config (apps, paths, installed packs)");
|
|
4297
4249
|
let u = [];
|
|
4298
4250
|
u.push(`# ${i}`), u.push([
|
|
@@ -4395,13 +4347,13 @@ function Ro(e) {
|
|
|
4395
4347
|
"stays useful."
|
|
4396
4348
|
].join("\n")), u.join("\n\n") + "\n";
|
|
4397
4349
|
}
|
|
4398
|
-
async function
|
|
4350
|
+
async function Po(e, t) {
|
|
4399
4351
|
let n = T.join(e, "README.md");
|
|
4400
|
-
await y.writeFile(n,
|
|
4352
|
+
await y.writeFile(n, No(t), "utf-8");
|
|
4401
4353
|
}
|
|
4402
4354
|
//#endregion
|
|
4403
4355
|
//#region src/core/tracking.ts
|
|
4404
|
-
async function
|
|
4356
|
+
async function Fo(e) {
|
|
4405
4357
|
try {
|
|
4406
4358
|
let t = {
|
|
4407
4359
|
"X-Device-Id": Xn(),
|
|
@@ -4415,7 +4367,7 @@ async function Bo(e) {
|
|
|
4415
4367
|
}
|
|
4416
4368
|
//#endregion
|
|
4417
4369
|
//#region src/core/npm-deps.ts
|
|
4418
|
-
function
|
|
4370
|
+
function Io(e, t) {
|
|
4419
4371
|
let n = [], r = [];
|
|
4420
4372
|
if (!e) return {
|
|
4421
4373
|
errors: n,
|
|
@@ -4446,7 +4398,7 @@ function Vo(e, t) {
|
|
|
4446
4398
|
operations: r
|
|
4447
4399
|
};
|
|
4448
4400
|
}
|
|
4449
|
-
function
|
|
4401
|
+
function Lo(e) {
|
|
4450
4402
|
let t = {};
|
|
4451
4403
|
for (let n of e) if (n) for (let [e, r] of Object.entries(n)) t[e] = {
|
|
4452
4404
|
...t[e],
|
|
@@ -4454,7 +4406,7 @@ function Ho(e) {
|
|
|
4454
4406
|
};
|
|
4455
4407
|
return t;
|
|
4456
4408
|
}
|
|
4457
|
-
async function
|
|
4409
|
+
async function Ro(e, t, n = q) {
|
|
4458
4410
|
let r = [];
|
|
4459
4411
|
for (let i of e) {
|
|
4460
4412
|
let e = T.join(t, i.relativeDir);
|
|
@@ -4490,14 +4442,14 @@ async function Uo(e, t, n = q) {
|
|
|
4490
4442
|
function $(e) {
|
|
4491
4443
|
return e instanceof Error ? e.message : String(e);
|
|
4492
4444
|
}
|
|
4493
|
-
async function
|
|
4445
|
+
async function zo(e, t, n) {
|
|
4494
4446
|
let r = e.filter((e) => e.tier === "paid" && !t.has(e.name)).map((e) => e.name);
|
|
4495
|
-
return r.length === 0 ? {} :
|
|
4447
|
+
return r.length === 0 ? {} : Br(r, n).catch(() => ({}));
|
|
4496
4448
|
}
|
|
4497
|
-
function
|
|
4449
|
+
function Bo(e, t) {
|
|
4498
4450
|
return e === "free" ? z.success("free") : e === "owned" ? z.accent("owned") : `${z.highlight(`$${t}`)} ${z.muted("locked")}`;
|
|
4499
4451
|
}
|
|
4500
|
-
async function
|
|
4452
|
+
async function Vo(e, t, n) {
|
|
4501
4453
|
let r = e.filter((e) => t(e)), i = e.filter((e) => !t(e));
|
|
4502
4454
|
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) => ({
|
|
4503
4455
|
name: e.name,
|
|
@@ -4505,7 +4457,7 @@ async function Ko(e, t, n) {
|
|
|
4505
4457
|
price: e.price
|
|
4506
4458
|
})));
|
|
4507
4459
|
}
|
|
4508
|
-
function
|
|
4460
|
+
function Ho(e, t) {
|
|
4509
4461
|
let n = e.map((e, n) => {
|
|
4510
4462
|
let r = t.get(e), i = r ? r.displayName : e;
|
|
4511
4463
|
return ` ${z.muted(`${n + 1}.`)} ${z.brand(i)}`;
|
|
@@ -4516,10 +4468,10 @@ function qo(e, t) {
|
|
|
4516
4468
|
...n
|
|
4517
4469
|
].join("\n"), "Install Plan");
|
|
4518
4470
|
}
|
|
4519
|
-
async function
|
|
4471
|
+
async function Uo(e, t) {
|
|
4520
4472
|
let n = [];
|
|
4521
4473
|
for (let r of e) {
|
|
4522
|
-
let e = await
|
|
4474
|
+
let e = await Pr(r), i = await Fr(r, t);
|
|
4523
4475
|
if (i.status === "denied") throw Error(`Access to "${r}" was denied (${i.reason}). Try 'npx @hype-stack/cli login' or check your license.`);
|
|
4524
4476
|
n.push({
|
|
4525
4477
|
manifest: e,
|
|
@@ -4528,21 +4480,21 @@ async function Jo(e, t) {
|
|
|
4528
4480
|
}
|
|
4529
4481
|
return n;
|
|
4530
4482
|
}
|
|
4531
|
-
async function
|
|
4532
|
-
let { prepared: t, paths: n, cwd: r, spinner: i } = e, a =
|
|
4483
|
+
async function Wo(e) {
|
|
4484
|
+
let { prepared: t, paths: n, cwd: r, spinner: i } = e, a = Io(Lo(t.map((e) => e.manifest.dependencies_npm)), n);
|
|
4533
4485
|
if (a.errors.length > 0) {
|
|
4534
4486
|
for (let e of a.errors) s.log.error(e);
|
|
4535
4487
|
return;
|
|
4536
4488
|
}
|
|
4537
4489
|
if (a.operations.length === 0) return;
|
|
4538
4490
|
i.start("Installing npm dependencies...");
|
|
4539
|
-
let o = await
|
|
4491
|
+
let o = await Ro(a.operations, r);
|
|
4540
4492
|
if (i.stop(o.ok ? "npm dependencies installed" : "npm dependency installation failed"), !o.ok) for (let e of o.errors) s.log.error(e);
|
|
4541
4493
|
}
|
|
4542
|
-
function
|
|
4543
|
-
|
|
4494
|
+
function Go() {
|
|
4495
|
+
da([`${z.command("npx @hype-stack/cli onboard")} ${z.muted("(set up env vars + run migrations)")}`, `${z.command("pnpm dev")} ${z.muted("(start frontend + backend)")}`]);
|
|
4544
4496
|
}
|
|
4545
|
-
function
|
|
4497
|
+
function Ko(e) {
|
|
4546
4498
|
if (e.length === 0) return;
|
|
4547
4499
|
let t = e.map((e) => {
|
|
4548
4500
|
let t = e.replace(/^\{\{[^}]+\}\}\//, "");
|
|
@@ -4550,10 +4502,10 @@ function Zo(e) {
|
|
|
4550
4502
|
});
|
|
4551
4503
|
s.note(t.join("\n"), "Skipped (already exist)");
|
|
4552
4504
|
}
|
|
4553
|
-
async function
|
|
4505
|
+
async function qo(e) {
|
|
4554
4506
|
let { prepared: t, config: n, cwd: r, force: i, yes: a, slotsByPack: o } = e, c = /* @__PURE__ */ new Set();
|
|
4555
4507
|
if (i) return c;
|
|
4556
|
-
let l = await
|
|
4508
|
+
let l = await Xi({
|
|
4557
4509
|
packs: t,
|
|
4558
4510
|
config: n,
|
|
4559
4511
|
projectRoot: r,
|
|
@@ -4580,7 +4532,7 @@ async function Qo(e) {
|
|
|
4580
4532
|
}
|
|
4581
4533
|
//#endregion
|
|
4582
4534
|
//#region src/ui/swatch.ts
|
|
4583
|
-
function
|
|
4535
|
+
function Jo(e) {
|
|
4584
4536
|
let t = e.trim().match(/^oklch\(([^)]+)\)$/i);
|
|
4585
4537
|
if (!t) return null;
|
|
4586
4538
|
let n = t[1].trim().split(/\s+/);
|
|
@@ -4599,56 +4551,56 @@ function $o(e) {
|
|
|
4599
4551
|
h: a
|
|
4600
4552
|
};
|
|
4601
4553
|
}
|
|
4602
|
-
function
|
|
4554
|
+
function Yo(e) {
|
|
4603
4555
|
return Math.min(255, Math.max(0, Math.round(e)));
|
|
4604
4556
|
}
|
|
4605
|
-
function
|
|
4557
|
+
function Xo(e) {
|
|
4606
4558
|
return e <= .0031308 ? 12.92 * e : 1.055 * e ** (1 / 2.4) - .055;
|
|
4607
4559
|
}
|
|
4608
|
-
function
|
|
4560
|
+
function Zo({ l: e, c: t, h: n }) {
|
|
4609
4561
|
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;
|
|
4610
4562
|
return [
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4563
|
+
Yo(Xo(f) * 255),
|
|
4564
|
+
Yo(Xo(p) * 255),
|
|
4565
|
+
Yo(Xo(m) * 255)
|
|
4614
4566
|
];
|
|
4615
4567
|
}
|
|
4616
|
-
var
|
|
4617
|
-
function
|
|
4568
|
+
var Qo = "\x1B[49m";
|
|
4569
|
+
function $o(e, t) {
|
|
4618
4570
|
let n = e[t];
|
|
4619
4571
|
if (!n) return b.dim(" ");
|
|
4620
|
-
let r =
|
|
4572
|
+
let r = Jo(n);
|
|
4621
4573
|
if (!r) return b.dim(" ");
|
|
4622
|
-
let [i, a, o] =
|
|
4623
|
-
return `\x1b[48;2;${i};${a};${o}m ${
|
|
4574
|
+
let [i, a, o] = Zo(r);
|
|
4575
|
+
return `\x1b[48;2;${i};${a};${o}m ${Qo}`;
|
|
4624
4576
|
}
|
|
4625
|
-
var
|
|
4577
|
+
var es = [
|
|
4626
4578
|
"primary",
|
|
4627
4579
|
"secondary",
|
|
4628
4580
|
"accent"
|
|
4629
4581
|
];
|
|
4630
|
-
function
|
|
4631
|
-
return
|
|
4582
|
+
function ts(e) {
|
|
4583
|
+
return es.map((t) => $o(e, t)).join("");
|
|
4632
4584
|
}
|
|
4633
|
-
function
|
|
4634
|
-
return `${
|
|
4585
|
+
function ns(e) {
|
|
4586
|
+
return `${ts(e.light)} ${b.dim("·")} ${ts(e.dark)}`;
|
|
4635
4587
|
}
|
|
4636
4588
|
//#endregion
|
|
4637
4589
|
//#region src/commands/create.ts
|
|
4638
|
-
async function
|
|
4639
|
-
e.skipBanner ||
|
|
4590
|
+
async function rs(e) {
|
|
4591
|
+
e.skipBanner || Va(), s.intro(z.brandBold("Create a new Hype Stack project"));
|
|
4640
4592
|
let o = e.yes === !0, c, l;
|
|
4641
4593
|
if (o && e.name) {
|
|
4642
|
-
let t =
|
|
4643
|
-
t && (s.log.error(t), Z()), l = e.name, c =
|
|
4594
|
+
let t = qa(e.name);
|
|
4595
|
+
t && (s.log.error(t), Z()), l = e.name, c = Ga(e.name);
|
|
4644
4596
|
} else {
|
|
4645
4597
|
let t = await s.text({
|
|
4646
4598
|
message: "What is your project named?",
|
|
4647
4599
|
placeholder: "my-app",
|
|
4648
4600
|
initialValue: e.name ?? "",
|
|
4649
|
-
validate: (e) =>
|
|
4601
|
+
validate: (e) => qa(e ?? "")
|
|
4650
4602
|
});
|
|
4651
|
-
s.isCancel(t) && Z(), l = t, c =
|
|
4603
|
+
s.isCancel(t) && Z(), l = t, c = Ga(l);
|
|
4652
4604
|
}
|
|
4653
4605
|
l.trim() !== c && s.log.info(z.muted(`Using "${z.highlight(c)}" as the project name`));
|
|
4654
4606
|
let u;
|
|
@@ -4692,7 +4644,7 @@ async function cs(e) {
|
|
|
4692
4644
|
message: "Pick a color theme",
|
|
4693
4645
|
options: r.map((e) => ({
|
|
4694
4646
|
value: e.name,
|
|
4695
|
-
label: `${
|
|
4647
|
+
label: `${ns(e)} ${e.label}`
|
|
4696
4648
|
})),
|
|
4697
4649
|
initialValue: h
|
|
4698
4650
|
});
|
|
@@ -4710,31 +4662,31 @@ async function cs(e) {
|
|
|
4710
4662
|
(s.isCancel(e) || !e) && Z();
|
|
4711
4663
|
}
|
|
4712
4664
|
let _ = s.spinner();
|
|
4713
|
-
_.start("Cloning Hype Stack template..."), await
|
|
4665
|
+
_.start("Cloning Hype Stack template..."), await io(d), _.stop(z.success("Template cloned"));
|
|
4714
4666
|
let v = s.spinner();
|
|
4715
|
-
v.start("Setting up project..."), await
|
|
4716
|
-
let y = await
|
|
4717
|
-
await
|
|
4667
|
+
v.start("Setting up project..."), await vo(d), await bo(d, c), await fo(d, p);
|
|
4668
|
+
let y = await Ar(d), b = Mr(c, y);
|
|
4669
|
+
await kr(d, b), await Po(d, {
|
|
4718
4670
|
projectName: c,
|
|
4719
4671
|
editor: p,
|
|
4720
4672
|
workspace: y
|
|
4721
4673
|
});
|
|
4722
4674
|
let x = T.resolve(d, b.paths?.frontend.root ?? "apps/frontend");
|
|
4723
|
-
a(g) && (await
|
|
4675
|
+
a(g) && (await ro(x, i(g)) || s.log.warn(z.muted(`Could not find ${z.path("assets/styles.css")} to apply the ${g} theme`))), await Za(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"));
|
|
4724
4676
|
let S = s.spinner();
|
|
4725
4677
|
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.")));
|
|
4726
4678
|
let C = s.spinner();
|
|
4727
|
-
C.start("Initializing git repository..."), await
|
|
4679
|
+
C.start("Initializing git repository..."), await yo(d), C.stop(z.success("Git repository initialized with clean history"));
|
|
4728
4680
|
let w = s.spinner();
|
|
4729
4681
|
w.start("Creating .env files from examples...");
|
|
4730
|
-
let E = await
|
|
4682
|
+
let E = await mo(d);
|
|
4731
4683
|
if (E.length > 0) {
|
|
4732
4684
|
let e = E.length;
|
|
4733
4685
|
w.stop(z.success(`Created ${e} .env file${e === 1 ? "" : "s"} from examples`));
|
|
4734
4686
|
} else w.stop(z.muted("No .env.example files to copy"));
|
|
4735
4687
|
s.log.success(`${z.brandBold("Hype Stack")} project ${z.highlight(c)} is ready!`);
|
|
4736
4688
|
let D = T.relative(process.cwd(), d) || ".", O = [`${z.command(`cd ${D}`)}`];
|
|
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`),
|
|
4689
|
+
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`), da(O);
|
|
4738
4690
|
let k = e.setup === !1;
|
|
4739
4691
|
if (e.deferSetup) s.log.info(z.muted("Docker and migrations will run after your packs are installed."));
|
|
4740
4692
|
else {
|
|
@@ -4742,20 +4694,20 @@ async function cs(e) {
|
|
|
4742
4694
|
message: "Would you like to start Docker services and run database migrations now?",
|
|
4743
4695
|
initialValue: !0
|
|
4744
4696
|
}));
|
|
4745
|
-
s.isCancel(e) && Z(), e ? await
|
|
4697
|
+
s.isCancel(e) && Z(), e ? await Sa(d, o) : s.log.info(z.muted("Docker and migrations can run later via `npx @hype-stack/cli onboard`.")), Go();
|
|
4746
4698
|
}
|
|
4747
|
-
return await
|
|
4699
|
+
return await Fo("project_create"), s.outro(z.muted("Happy building!")), d;
|
|
4748
4700
|
}
|
|
4749
4701
|
//#endregion
|
|
4750
4702
|
//#region src/commands/init.ts
|
|
4751
|
-
async function
|
|
4703
|
+
async function is(e) {
|
|
4752
4704
|
let t = e.cwd ?? process.cwd(), n = e.silent ?? !1;
|
|
4753
|
-
if (n || (
|
|
4705
|
+
if (n || (Ha(), s.intro(z.brandBold("Initialize Hype Stack configuration"))), !await Nr(t)) {
|
|
4754
4706
|
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.`));
|
|
4755
4707
|
return;
|
|
4756
4708
|
}
|
|
4757
|
-
if (await
|
|
4758
|
-
let e = await
|
|
4709
|
+
if (await Or(t)) {
|
|
4710
|
+
let e = await Dr(t);
|
|
4759
4711
|
if (e && !n) {
|
|
4760
4712
|
s.log.info(`Found existing ${z.path("stack.json")} for project ${z.highlight(e.name)}`);
|
|
4761
4713
|
let t = await s.confirm({
|
|
@@ -4768,7 +4720,7 @@ async function ls(e) {
|
|
|
4768
4720
|
}
|
|
4769
4721
|
}
|
|
4770
4722
|
}
|
|
4771
|
-
let r = await
|
|
4723
|
+
let r = await Ar(t);
|
|
4772
4724
|
if (!n) {
|
|
4773
4725
|
let e = Object.entries(r.apps), t = Object.entries(r.packages);
|
|
4774
4726
|
if (e.length > 0) {
|
|
@@ -4787,28 +4739,28 @@ async function ls(e) {
|
|
|
4787
4739
|
message: "Project name for stack.json?",
|
|
4788
4740
|
placeholder: i,
|
|
4789
4741
|
initialValue: i,
|
|
4790
|
-
validate: (e) =>
|
|
4742
|
+
validate: (e) => qa(e ?? "")
|
|
4791
4743
|
});
|
|
4792
|
-
s.isCancel(e) && Z(), a =
|
|
4744
|
+
s.isCancel(e) && Z(), a = Ga(e);
|
|
4793
4745
|
}
|
|
4794
|
-
await
|
|
4746
|
+
await kr(t, Mr(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.")));
|
|
4795
4747
|
}
|
|
4796
|
-
async function
|
|
4797
|
-
if (await
|
|
4748
|
+
async function as(e, t = {}, n) {
|
|
4749
|
+
if (await Or(e)) return {
|
|
4798
4750
|
projectRoot: e,
|
|
4799
4751
|
scaffolded: !1
|
|
4800
4752
|
};
|
|
4801
|
-
let r = t.runInit ?? ((e) =>
|
|
4753
|
+
let r = t.runInit ?? ((e) => is({
|
|
4802
4754
|
cwd: e,
|
|
4803
4755
|
silent: !0
|
|
4804
|
-
})), i = t.runCreate ?? ((e, t) =>
|
|
4756
|
+
})), i = t.runCreate ?? ((e, t) => rs({
|
|
4805
4757
|
parentDirectory: e,
|
|
4806
4758
|
deferSetup: !0,
|
|
4807
4759
|
skipBanner: !0,
|
|
4808
4760
|
defaultTheme: t?.defaultTheme,
|
|
4809
4761
|
defaultMode: t?.defaultMode
|
|
4810
4762
|
}));
|
|
4811
|
-
if (await
|
|
4763
|
+
if (await Nr(e)) {
|
|
4812
4764
|
s.log.warn(`No ${z.path("stack.json")} found in ${z.path(e)}.`);
|
|
4813
4765
|
let t = await s.confirm({
|
|
4814
4766
|
message: `Create ${z.path("stack.json")} now?`,
|
|
@@ -4816,7 +4768,7 @@ async function us(e, t = {}, n) {
|
|
|
4816
4768
|
});
|
|
4817
4769
|
if (s.isCancel(t) || !t) return null;
|
|
4818
4770
|
await r(e);
|
|
4819
|
-
let n = await
|
|
4771
|
+
let n = await Or(e);
|
|
4820
4772
|
return n && s.log.success(`${z.path("stack.json")} created`), n ? {
|
|
4821
4773
|
projectRoot: e,
|
|
4822
4774
|
scaffolded: !1
|
|
@@ -4834,19 +4786,19 @@ async function us(e, t = {}, n) {
|
|
|
4834
4786
|
});
|
|
4835
4787
|
if (s.isCancel(o) || !o) return null;
|
|
4836
4788
|
let c = await i(e, n);
|
|
4837
|
-
return await
|
|
4789
|
+
return await Or(c) ? {
|
|
4838
4790
|
projectRoot: c,
|
|
4839
4791
|
scaffolded: !0
|
|
4840
4792
|
} : null;
|
|
4841
4793
|
}
|
|
4842
4794
|
//#endregion
|
|
4843
4795
|
//#region src/commands/compose.ts
|
|
4844
|
-
async function
|
|
4796
|
+
async function os(e = {}) {
|
|
4845
4797
|
let t = e.cwd ?? process.cwd();
|
|
4846
|
-
|
|
4847
|
-
let n = await
|
|
4798
|
+
Va();
|
|
4799
|
+
let n = await as(t), r = n?.projectRoot ?? null, i = n?.scaffolded ?? !1, a;
|
|
4848
4800
|
try {
|
|
4849
|
-
a = await
|
|
4801
|
+
a = await Dr(r ?? t);
|
|
4850
4802
|
} catch (e) {
|
|
4851
4803
|
s.cancel(`Could not parse ${z.path("stack.json")}: ${$(e)} Run 'npx @hype-stack/cli init' to regenerate it.`), process.exit(1);
|
|
4852
4804
|
}
|
|
@@ -4857,18 +4809,18 @@ async function ds(e = {}) {
|
|
|
4857
4809
|
c.start("Loading packs...");
|
|
4858
4810
|
let l;
|
|
4859
4811
|
try {
|
|
4860
|
-
l = await
|
|
4812
|
+
l = await zr();
|
|
4861
4813
|
} catch (e) {
|
|
4862
4814
|
c.stop("Failed to load packs"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${$(e)}`), process.exit(1);
|
|
4863
4815
|
}
|
|
4864
4816
|
c.stop("Packs loaded");
|
|
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
|
|
4817
|
+
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 zo(l, d, {
|
|
4866
4818
|
token: m,
|
|
4867
4819
|
key: p
|
|
4868
4820
|
}), g = (e) => {
|
|
4869
4821
|
let t = f.get(e);
|
|
4870
4822
|
return !t || t.tier === "free" ? "free" : h[e]?.owned ? "owned" : "locked";
|
|
4871
|
-
}, _ = (e) => !d.has(e) && g(e) === "locked", v = await
|
|
4823
|
+
}, _ = (e) => !d.has(e) && g(e) === "locked", v = await ss({
|
|
4872
4824
|
packs: l,
|
|
4873
4825
|
installedSet: d,
|
|
4874
4826
|
stateOf: g,
|
|
@@ -4879,9 +4831,9 @@ async function ds(e = {}) {
|
|
|
4879
4831
|
s.outro(z.muted("No packs selected. Nothing to do."));
|
|
4880
4832
|
return;
|
|
4881
4833
|
}
|
|
4882
|
-
let b =
|
|
4834
|
+
let b = us(v), x = ds(v), S = ja(l, b), C = wa(Ma(l, S)), w;
|
|
4883
4835
|
try {
|
|
4884
|
-
w =
|
|
4836
|
+
w = Ea(b, C, u);
|
|
4885
4837
|
} catch (e) {
|
|
4886
4838
|
s.cancel($(e)), process.exit(1);
|
|
4887
4839
|
}
|
|
@@ -4889,7 +4841,7 @@ async function ds(e = {}) {
|
|
|
4889
4841
|
s.note(`${w.alreadyInstalled.join(", ")} already installed.`, "Nothing to do"), s.outro(z.muted("Your selection is already part of the project."));
|
|
4890
4842
|
return;
|
|
4891
4843
|
}
|
|
4892
|
-
let T =
|
|
4844
|
+
let T = Da({
|
|
4893
4845
|
order: w.order,
|
|
4894
4846
|
graph: C,
|
|
4895
4847
|
isLocked: _,
|
|
@@ -4897,28 +4849,28 @@ async function ds(e = {}) {
|
|
|
4897
4849
|
});
|
|
4898
4850
|
if (T.blocked.length > 0 && !m && !p) {
|
|
4899
4851
|
let e = await nr();
|
|
4900
|
-
e && (m = e, h = await
|
|
4852
|
+
e && (m = e, h = await zo(l, d, {
|
|
4901
4853
|
token: m,
|
|
4902
4854
|
key: p
|
|
4903
|
-
}), T =
|
|
4855
|
+
}), T = Da({
|
|
4904
4856
|
order: w.order,
|
|
4905
4857
|
graph: C,
|
|
4906
4858
|
isLocked: _,
|
|
4907
4859
|
installed: u
|
|
4908
4860
|
}));
|
|
4909
4861
|
}
|
|
4910
|
-
if (T.blocked.length > 0 && await
|
|
4862
|
+
if (T.blocked.length > 0 && await Vo(T.blocked, _, f), T.installable.length === 0) {
|
|
4911
4863
|
s.outro(z.muted("Nothing left to install once locked packs are removed."));
|
|
4912
4864
|
return;
|
|
4913
4865
|
}
|
|
4914
|
-
if (
|
|
4866
|
+
if (Ho(T.installable, f), !e.yes) {
|
|
4915
4867
|
let e = await s.confirm({ message: `Install ${T.installable.length} pack${T.installable.length === 1 ? "" : "s"}?` });
|
|
4916
4868
|
(s.isCancel(e) || !e) && (s.cancel("Installation cancelled."), process.exit(0));
|
|
4917
4869
|
}
|
|
4918
4870
|
c.start("Downloading packs...");
|
|
4919
4871
|
let E;
|
|
4920
4872
|
try {
|
|
4921
|
-
E = await
|
|
4873
|
+
E = await Uo(T.installable, {
|
|
4922
4874
|
token: m,
|
|
4923
4875
|
key: p
|
|
4924
4876
|
});
|
|
@@ -4926,7 +4878,7 @@ async function ds(e = {}) {
|
|
|
4926
4878
|
c.stop("Download failed"), s.cancel($(e)), process.exit(1);
|
|
4927
4879
|
}
|
|
4928
4880
|
c.stop(`Downloaded ${E.length} pack${E.length === 1 ? "" : "s"}`);
|
|
4929
|
-
let D = await
|
|
4881
|
+
let D = await qo({
|
|
4930
4882
|
prepared: E,
|
|
4931
4883
|
config: a,
|
|
4932
4884
|
cwd: o,
|
|
@@ -4936,7 +4888,7 @@ async function ds(e = {}) {
|
|
|
4936
4888
|
});
|
|
4937
4889
|
try {
|
|
4938
4890
|
c.start("Installing pack files...");
|
|
4939
|
-
let t = await
|
|
4891
|
+
let t = await $i({
|
|
4940
4892
|
packs: E,
|
|
4941
4893
|
config: a,
|
|
4942
4894
|
projectRoot: o,
|
|
@@ -4949,22 +4901,22 @@ async function ds(e = {}) {
|
|
|
4949
4901
|
for (let e of t.errors) s.log.error(e);
|
|
4950
4902
|
s.cancel("No files were written. Fix the errors above (or pass --force for existing files) and try again."), process.exit(1);
|
|
4951
4903
|
}
|
|
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)`),
|
|
4904
|
+
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)`), Ko(t.skipped));
|
|
4953
4905
|
for (let e of t.errors) s.log.error(e);
|
|
4954
|
-
await
|
|
4906
|
+
await Wo({
|
|
4955
4907
|
prepared: E,
|
|
4956
4908
|
paths: a.paths,
|
|
4957
4909
|
cwd: o,
|
|
4958
4910
|
spinner: c
|
|
4959
4911
|
});
|
|
4960
4912
|
let n;
|
|
4961
|
-
i && (n = await
|
|
4913
|
+
i && (n = await Ca(o, e.yes ?? !1)), await pr({
|
|
4962
4914
|
projectRoot: o,
|
|
4963
4915
|
paths: a.paths,
|
|
4964
4916
|
skipPrompts: e.yes ?? !1,
|
|
4965
4917
|
dbReady: n,
|
|
4966
4918
|
freshScaffold: i
|
|
4967
|
-
}),
|
|
4919
|
+
}), Go(), s.outro(z.brand(`Installed ${t.appliedPacks.join(", ")}.`));
|
|
4968
4920
|
} finally {
|
|
4969
4921
|
await Promise.all(E.map((e) => y.rm(e.packDir, {
|
|
4970
4922
|
recursive: !0,
|
|
@@ -4972,10 +4924,10 @@ async function ds(e = {}) {
|
|
|
4972
4924
|
})));
|
|
4973
4925
|
}
|
|
4974
4926
|
}
|
|
4975
|
-
async function
|
|
4927
|
+
async function ss(e) {
|
|
4976
4928
|
let { packs: t, installedSet: n, stateOf: r, options: i, adminAvailable: a } = e;
|
|
4977
4929
|
if (i.packs && i.packs.length > 0) {
|
|
4978
|
-
let e = i.packs.map(
|
|
4930
|
+
let e = i.packs.map(ls), n = e.filter((e) => !t.some((t) => t.name === e.name));
|
|
4979
4931
|
return n.length > 0 && (s.cancel(`Unknown pack${n.length === 1 ? "" : "s"}: ${n.map((e) => e.name).join(", ")}`), process.exit(1)), e;
|
|
4980
4932
|
}
|
|
4981
4933
|
let o = t.filter((e) => n.has(e.name));
|
|
@@ -4984,13 +4936,13 @@ async function fs(e) {
|
|
|
4984
4936
|
if (c.length === 0) return s.outro(z.muted("Every available pack is already installed.")), [];
|
|
4985
4937
|
let l = ce();
|
|
4986
4938
|
s.note(c.map((e) => ` ${B.arrow} ${z.highlight(e.displayName)} ${ge(`${l}/packs/${e.name}`)}`).join("\n"), "Browse packs");
|
|
4987
|
-
let u =
|
|
4939
|
+
let u = sa(c, { adminAvailable: a }), d = [];
|
|
4988
4940
|
for (let e of u) {
|
|
4989
4941
|
let t = e.packs.map((e) => {
|
|
4990
4942
|
let t = r(e.name);
|
|
4991
4943
|
return {
|
|
4992
4944
|
value: e.name,
|
|
4993
|
-
label: `${e.displayName} ${
|
|
4945
|
+
label: `${e.displayName} ${Bo(t, e.price)}`,
|
|
4994
4946
|
hint: e.description
|
|
4995
4947
|
};
|
|
4996
4948
|
});
|
|
@@ -5007,7 +4959,7 @@ async function fs(e) {
|
|
|
5007
4959
|
});
|
|
5008
4960
|
continue;
|
|
5009
4961
|
}
|
|
5010
|
-
let n = await
|
|
4962
|
+
let n = await Wa({
|
|
5011
4963
|
message: `Select ${e.label.toLowerCase()} to add (optional)`,
|
|
5012
4964
|
options: t,
|
|
5013
4965
|
required: !1
|
|
@@ -5017,20 +4969,20 @@ async function fs(e) {
|
|
|
5017
4969
|
}
|
|
5018
4970
|
return d;
|
|
5019
4971
|
}
|
|
5020
|
-
var
|
|
5021
|
-
function
|
|
5022
|
-
let t = e.match(
|
|
4972
|
+
var cs = /@(frontend|admin)$/;
|
|
4973
|
+
function ls(e) {
|
|
4974
|
+
let t = e.match(cs);
|
|
5023
4975
|
return t ? {
|
|
5024
4976
|
name: e.slice(0, -t[0].length),
|
|
5025
4977
|
slot: t[1]
|
|
5026
4978
|
} : { name: e };
|
|
5027
4979
|
}
|
|
5028
|
-
function
|
|
4980
|
+
function us(e) {
|
|
5029
4981
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
5030
4982
|
for (let r of e) t.has(r.name) || (t.add(r.name), n.push(r.name));
|
|
5031
4983
|
return n;
|
|
5032
4984
|
}
|
|
5033
|
-
function
|
|
4985
|
+
function ds(e) {
|
|
5034
4986
|
let t = /* @__PURE__ */ new Map();
|
|
5035
4987
|
for (let n of e) {
|
|
5036
4988
|
if (!n.slot) continue;
|
|
@@ -5041,8 +4993,8 @@ function gs(e) {
|
|
|
5041
4993
|
}
|
|
5042
4994
|
//#endregion
|
|
5043
4995
|
//#region src/commands/login.ts
|
|
5044
|
-
async function
|
|
5045
|
-
|
|
4996
|
+
async function fs() {
|
|
4997
|
+
Ha(), s.intro(z.brandBold("Log in to Hype Stack")), s.log.step("Opening your browser to sign in...");
|
|
5046
4998
|
let e;
|
|
5047
4999
|
try {
|
|
5048
5000
|
e = await tr({ onUrl: (e) => {
|
|
@@ -5055,8 +5007,8 @@ async function _s() {
|
|
|
5055
5007
|
}
|
|
5056
5008
|
//#endregion
|
|
5057
5009
|
//#region src/commands/logout.ts
|
|
5058
|
-
async function
|
|
5059
|
-
|
|
5010
|
+
async function ps() {
|
|
5011
|
+
Ha(), s.intro(z.brandBold("Log out of Hype Stack"));
|
|
5060
5012
|
let e = I(), t = await Kn(e);
|
|
5061
5013
|
if (!t) {
|
|
5062
5014
|
s.outro(z.muted("You're not logged in."));
|
|
@@ -5066,7 +5018,7 @@ async function vs() {
|
|
|
5066
5018
|
}
|
|
5067
5019
|
//#endregion
|
|
5068
5020
|
//#region src/core/onboard-env.ts
|
|
5069
|
-
function
|
|
5021
|
+
function ms(e) {
|
|
5070
5022
|
let t = [], n = "";
|
|
5071
5023
|
for (let r of e.split(/\r?\n/)) {
|
|
5072
5024
|
let e = r.trim();
|
|
@@ -5092,7 +5044,14 @@ function ys(e) {
|
|
|
5092
5044
|
}
|
|
5093
5045
|
return t;
|
|
5094
5046
|
}
|
|
5095
|
-
function
|
|
5047
|
+
function hs(e) {
|
|
5048
|
+
let t = e.trim();
|
|
5049
|
+
if (t === "") return "";
|
|
5050
|
+
if (t.length <= 4) return "•".repeat(t.length);
|
|
5051
|
+
let n = Math.min(t.length - 4, 8);
|
|
5052
|
+
return `${"•".repeat(n)}${t.slice(-4)}`;
|
|
5053
|
+
}
|
|
5054
|
+
function gs(e, t, n) {
|
|
5096
5055
|
let r = e.split(/\r?\n/), i = !1, a = r.map((e) => {
|
|
5097
5056
|
if (i) return e;
|
|
5098
5057
|
let r = e.trim();
|
|
@@ -5102,48 +5061,48 @@ function bs(e, t, n) {
|
|
|
5102
5061
|
});
|
|
5103
5062
|
return i ? a.join("\n") : e + `${e.length > 0 && !e.endsWith("\n") ? "\n" : ""}${t}=${n}\n`;
|
|
5104
5063
|
}
|
|
5105
|
-
async function
|
|
5064
|
+
async function _s(e) {
|
|
5106
5065
|
return await J(e) ? y.readFile(e, "utf-8") : "";
|
|
5107
5066
|
}
|
|
5108
|
-
async function
|
|
5067
|
+
async function vs(e) {
|
|
5109
5068
|
let t = T.join(T.dirname(e), ".env");
|
|
5110
5069
|
return await J(t) || await y.copyFile(e, t), t;
|
|
5111
5070
|
}
|
|
5112
|
-
async function
|
|
5113
|
-
let r =
|
|
5071
|
+
async function ys(e, t, n) {
|
|
5072
|
+
let r = gs(await _s(e), t, n);
|
|
5114
5073
|
await y.writeFile(e, r, "utf-8");
|
|
5115
5074
|
}
|
|
5116
5075
|
//#endregion
|
|
5117
5076
|
//#region src/commands/onboard.ts
|
|
5118
|
-
async function
|
|
5077
|
+
async function bs(e = {}) {
|
|
5119
5078
|
let t = e.cwd ?? process.cwd();
|
|
5120
|
-
|
|
5079
|
+
Va(), s.intro(z.brandBold("Onboard your stack"));
|
|
5121
5080
|
let n;
|
|
5122
5081
|
try {
|
|
5123
|
-
n = await
|
|
5082
|
+
n = await Dr(t);
|
|
5124
5083
|
} catch {
|
|
5125
5084
|
n = null;
|
|
5126
5085
|
}
|
|
5127
5086
|
n || (s.cancel(`${z.path("stack.json")} not found. Run ${z.command("npx @hype-stack/cli init")} first.`), process.exit(1));
|
|
5128
|
-
let r = n.installedPacks ?? [], i = n.onboarding?.envSections ?? [], a = await
|
|
5087
|
+
let r = n.installedPacks ?? [], i = n.onboarding?.envSections ?? [], a = await ho(t);
|
|
5129
5088
|
a.length === 0 && s.log.warn(z.muted("No .env.example files found; skipping env setup."));
|
|
5130
|
-
for (let n of a) await
|
|
5089
|
+
for (let n of a) await xs({
|
|
5131
5090
|
examplePath: n,
|
|
5132
5091
|
projectRoot: t,
|
|
5133
5092
|
skipPrompts: e.yes ?? !1,
|
|
5134
5093
|
installedEnvSections: i
|
|
5135
5094
|
});
|
|
5136
|
-
let o =
|
|
5137
|
-
o.length > 0 && s.note(o.map((e) => ` ${z.muted("·")} ${e}`).join("\n"), "Tips"), e.skipMigrations || await
|
|
5095
|
+
let o = Er(r);
|
|
5096
|
+
o.length > 0 && s.note(o.map((e) => ` ${z.muted("·")} ${e}`).join("\n"), "Tips"), e.skipMigrations || await ws(t, e.yes ?? !1), s.outro(z.brand(`All set. Run ${z.command("pnpm dev")} to start your app.`));
|
|
5138
5097
|
}
|
|
5139
|
-
async function
|
|
5140
|
-
let { examplePath: t, projectRoot: n, skipPrompts: r, installedEnvSections: i } = e, a = T.relative(n, t) || t, o = await
|
|
5098
|
+
async function xs(e) {
|
|
5099
|
+
let { examplePath: t, projectRoot: n, skipPrompts: r, installedEnvSections: i } = e, a = T.relative(n, t) || t, o = await vs(t), c = await _s(o), l = ms(await y.readFile(t, "utf-8")), u = z.path(a);
|
|
5141
5100
|
s.log.step(`Env: ${u}`);
|
|
5142
5101
|
for (let e of l) {
|
|
5143
5102
|
if (e.vars.length === 0) continue;
|
|
5144
|
-
if (!
|
|
5103
|
+
if (!Sr(e.section, i)) {
|
|
5145
5104
|
let t = e.section ? z.bold(e.section) : z.bold("Variables");
|
|
5146
|
-
s.log.info(`${t} ${z.muted("skipped (
|
|
5105
|
+
s.log.info(`${t} ${z.muted("skipped (not owned by an installed pack)")}`);
|
|
5147
5106
|
continue;
|
|
5148
5107
|
}
|
|
5149
5108
|
let t = xr(e.section), n = e.section ? z.bold(e.section) : z.bold("Variables");
|
|
@@ -5153,7 +5112,7 @@ async function Ts(e) {
|
|
|
5153
5112
|
s.log.info(`${z.label(n.key)} ${z.muted("skipped (non-interactive)")}`);
|
|
5154
5113
|
continue;
|
|
5155
5114
|
}
|
|
5156
|
-
let e =
|
|
5115
|
+
let e = hs(Ss(c, n.key)), i = await s.text({
|
|
5157
5116
|
message: `${z.label(n.key)}`,
|
|
5158
5117
|
placeholder: e ? `${e} ${z.muted("(Enter keeps this)")}` : t.hint
|
|
5159
5118
|
});
|
|
@@ -5163,31 +5122,31 @@ async function Ts(e) {
|
|
|
5163
5122
|
s.log.info(z.muted(`${n.key} unchanged.`));
|
|
5164
5123
|
continue;
|
|
5165
5124
|
}
|
|
5166
|
-
await
|
|
5125
|
+
await ys(o, n.key, a), s.log.success(`${n.key} saved`);
|
|
5167
5126
|
}
|
|
5168
5127
|
}
|
|
5169
5128
|
}
|
|
5170
|
-
function
|
|
5129
|
+
function Ss(e, t) {
|
|
5171
5130
|
for (let n of e.split(/\r?\n/)) {
|
|
5172
|
-
let e = n.match(RegExp(`^${
|
|
5131
|
+
let e = n.match(RegExp(`^${Cs(t)}\\s*=\\s*(.*)$`));
|
|
5173
5132
|
if (e) return e[1].trim();
|
|
5174
5133
|
}
|
|
5175
5134
|
return "";
|
|
5176
5135
|
}
|
|
5177
|
-
function
|
|
5136
|
+
function Cs(e) {
|
|
5178
5137
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5179
5138
|
}
|
|
5180
|
-
async function
|
|
5181
|
-
if (!await
|
|
5139
|
+
async function ws(e, t) {
|
|
5140
|
+
if (!await fa() && !await ma(e, t, !1)) {
|
|
5182
5141
|
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")}.`));
|
|
5183
5142
|
return;
|
|
5184
5143
|
}
|
|
5185
5144
|
let n = s.spinner();
|
|
5186
|
-
if (n.start("Waiting for Postgres to be ready..."), !await
|
|
5145
|
+
if (n.start("Waiting for Postgres to be ready..."), !await ga(e)) {
|
|
5187
5146
|
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")}`));
|
|
5188
5147
|
return;
|
|
5189
5148
|
}
|
|
5190
|
-
if (n.stop(z.success("Postgres is ready")), await
|
|
5149
|
+
if (n.stop(z.success("Postgres is ready")), await va(e)) {
|
|
5191
5150
|
s.log.info(z.muted("Migrations already applied, skipping."));
|
|
5192
5151
|
return;
|
|
5193
5152
|
}
|
|
@@ -5199,20 +5158,20 @@ async function Os(e, t) {
|
|
|
5199
5158
|
s.log.info(z.muted("Skipping database migrations."));
|
|
5200
5159
|
return;
|
|
5201
5160
|
}
|
|
5202
|
-
await
|
|
5161
|
+
await ya(e);
|
|
5203
5162
|
}
|
|
5204
5163
|
//#endregion
|
|
5205
5164
|
//#region src/core/templates.ts
|
|
5206
|
-
var
|
|
5165
|
+
var Ts = K.createRequest()({
|
|
5207
5166
|
endpoint: "/templates/list",
|
|
5208
5167
|
method: "GET"
|
|
5209
5168
|
});
|
|
5210
|
-
async function
|
|
5211
|
-
let { data: e, error: t } = await
|
|
5169
|
+
async function Es() {
|
|
5170
|
+
let { data: e, error: t } = await Ts.send();
|
|
5212
5171
|
if (t || !e) throw Error(`Failed to fetch template list: ${String(t)}`);
|
|
5213
5172
|
return e.templates;
|
|
5214
5173
|
}
|
|
5215
|
-
async function
|
|
5174
|
+
async function Ds(e) {
|
|
5216
5175
|
let { data: t, error: n, status: r } = await K.createRequest()({
|
|
5217
5176
|
endpoint: `/templates/${encodeURIComponent(e)}/manifest`,
|
|
5218
5177
|
method: "GET"
|
|
@@ -5221,7 +5180,7 @@ async function js(e) {
|
|
|
5221
5180
|
if (n || !t) throw Error(`Failed to load manifest for template "${e}": ${String(n)}`);
|
|
5222
5181
|
return t;
|
|
5223
5182
|
}
|
|
5224
|
-
async function
|
|
5183
|
+
async function Os(e, t = {}) {
|
|
5225
5184
|
let n = K.createRequest()({
|
|
5226
5185
|
endpoint: `/templates/${encodeURIComponent(e)}/download`,
|
|
5227
5186
|
method: "POST"
|
|
@@ -5249,21 +5208,21 @@ async function Ms(e, t = {}) {
|
|
|
5249
5208
|
}
|
|
5250
5209
|
//#endregion
|
|
5251
5210
|
//#region src/commands/template.ts
|
|
5252
|
-
async function
|
|
5211
|
+
async function ks(t = {}) {
|
|
5253
5212
|
let n = t.cwd ?? process.cwd();
|
|
5254
|
-
|
|
5213
|
+
Va();
|
|
5255
5214
|
let r = s.spinner();
|
|
5256
5215
|
r.start("Loading packs...");
|
|
5257
5216
|
let o;
|
|
5258
5217
|
try {
|
|
5259
|
-
o = await
|
|
5218
|
+
o = await zr();
|
|
5260
5219
|
} catch (e) {
|
|
5261
5220
|
r.stop("Failed to load packs"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${$(e)}`), process.exit(1);
|
|
5262
5221
|
}
|
|
5263
5222
|
r.stop("Packs loaded"), r.start("Loading templates...");
|
|
5264
5223
|
let c;
|
|
5265
5224
|
try {
|
|
5266
|
-
c = await
|
|
5225
|
+
c = await Es();
|
|
5267
5226
|
} catch (e) {
|
|
5268
5227
|
r.stop("Failed to load templates"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${$(e)}`), process.exit(1);
|
|
5269
5228
|
}
|
|
@@ -5286,75 +5245,75 @@ async function Ns(t = {}) {
|
|
|
5286
5245
|
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}`);
|
|
5287
5246
|
let d;
|
|
5288
5247
|
try {
|
|
5289
|
-
d = await
|
|
5248
|
+
d = await Ds(u.id);
|
|
5290
5249
|
} catch (e) {
|
|
5291
5250
|
s.cancel($(e)), process.exit(1);
|
|
5292
5251
|
}
|
|
5293
|
-
let f = await
|
|
5252
|
+
let f = await as(n, {}, {
|
|
5294
5253
|
defaultTheme: d.theme,
|
|
5295
5254
|
defaultMode: d.defaultMode
|
|
5296
5255
|
}), p = f?.projectRoot ?? null, m = f?.scaffolded ?? !1, h;
|
|
5297
5256
|
try {
|
|
5298
|
-
h = await
|
|
5257
|
+
h = await Dr(p ?? n);
|
|
5299
5258
|
} catch (e) {
|
|
5300
5259
|
s.cancel(`Could not parse ${z.path("stack.json")}: ${$(e)} Run 'npx @hype-stack/cli init' to regenerate it.`), process.exit(1);
|
|
5301
5260
|
}
|
|
5302
5261
|
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));
|
|
5303
5262
|
let g = p ?? n;
|
|
5304
5263
|
s.intro(z.brandBold("Install a template"));
|
|
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
|
|
5264
|
+
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 As(u, t.variants, t.yes ?? !1), w = Oa(u.slots, C), E = ka(u.slots, u.packs, w), D = await js({
|
|
5306
5265
|
packs: o,
|
|
5307
5266
|
templatePacks: E,
|
|
5308
5267
|
installedSet: v,
|
|
5309
5268
|
options: t
|
|
5310
5269
|
}), O = [...E, ...D.filter((e) => !E.includes(e))], k = O.filter((e) => !b.has(e));
|
|
5311
5270
|
k.length > 0 && (s.cancel(`Unknown pack${k.length === 1 ? "" : "s"}: ${k.join(", ")}`), process.exit(1));
|
|
5312
|
-
let ee =
|
|
5271
|
+
let ee = Ma(o, w), A = wa(ee), te;
|
|
5313
5272
|
try {
|
|
5314
|
-
|
|
5273
|
+
te = Ea(O, A, _);
|
|
5315
5274
|
} catch (e) {
|
|
5316
5275
|
s.cancel($(e)), process.exit(1);
|
|
5317
5276
|
}
|
|
5318
|
-
if (
|
|
5277
|
+
if (te.order.length === 0) {
|
|
5319
5278
|
s.outro(z.muted("Every pack in this template is already installed."));
|
|
5320
5279
|
return;
|
|
5321
5280
|
}
|
|
5322
|
-
let
|
|
5281
|
+
let j = await zo(ee, v, {
|
|
5323
5282
|
token: S,
|
|
5324
5283
|
key: x
|
|
5325
5284
|
}), ne = (e) => {
|
|
5326
5285
|
let t = b.get(e);
|
|
5327
|
-
return !t || t.tier === "free" ? "free" :
|
|
5328
|
-
}, M = (e) => !v.has(e) && ne(e) === "locked", N =
|
|
5329
|
-
order:
|
|
5286
|
+
return !t || t.tier === "free" ? "free" : j[e]?.owned ? "owned" : "locked";
|
|
5287
|
+
}, M = (e) => !v.has(e) && ne(e) === "locked", N = Da({
|
|
5288
|
+
order: te.order,
|
|
5330
5289
|
graph: A,
|
|
5331
5290
|
isLocked: M,
|
|
5332
5291
|
installed: _
|
|
5333
5292
|
});
|
|
5334
5293
|
if (N.blocked.length > 0 && !S && !x) {
|
|
5335
5294
|
let e = await nr();
|
|
5336
|
-
e && (S = e,
|
|
5295
|
+
e && (S = e, j = await zo(ee, v, {
|
|
5337
5296
|
token: S,
|
|
5338
5297
|
key: x
|
|
5339
|
-
}), N =
|
|
5340
|
-
order:
|
|
5298
|
+
}), N = Da({
|
|
5299
|
+
order: te.order,
|
|
5341
5300
|
graph: A,
|
|
5342
5301
|
isLocked: M,
|
|
5343
5302
|
installed: _
|
|
5344
5303
|
}));
|
|
5345
5304
|
}
|
|
5346
|
-
if (N.blocked.length > 0 && await
|
|
5305
|
+
if (N.blocked.length > 0 && await Vo(N.blocked, M, b), N.installable.length === 0) {
|
|
5347
5306
|
s.outro(z.muted("Nothing left to install once locked packs are removed."));
|
|
5348
5307
|
return;
|
|
5349
5308
|
}
|
|
5350
|
-
if (
|
|
5309
|
+
if (Ho(N.installable, b), !t.yes) {
|
|
5351
5310
|
let e = await s.confirm({ message: `Install template ${z.brandBold(u.name)} (${N.installable.length} pack${N.installable.length === 1 ? "" : "s"})?` });
|
|
5352
5311
|
(s.isCancel(e) || !e) && (s.cancel("Installation cancelled."), process.exit(0));
|
|
5353
5312
|
}
|
|
5354
5313
|
r.start("Downloading packs...");
|
|
5355
5314
|
let P;
|
|
5356
5315
|
try {
|
|
5357
|
-
P = await
|
|
5316
|
+
P = await Uo(N.installable, {
|
|
5358
5317
|
token: S,
|
|
5359
5318
|
key: x
|
|
5360
5319
|
});
|
|
@@ -5362,7 +5321,7 @@ async function Ns(t = {}) {
|
|
|
5362
5321
|
r.stop("Download failed"), s.cancel($(e)), process.exit(1);
|
|
5363
5322
|
}
|
|
5364
5323
|
r.stop(`Downloaded ${P.length} pack${P.length === 1 ? "" : "s"}`);
|
|
5365
|
-
let re = await
|
|
5324
|
+
let re = await qo({
|
|
5366
5325
|
prepared: P,
|
|
5367
5326
|
config: h,
|
|
5368
5327
|
cwd: g,
|
|
@@ -5371,7 +5330,7 @@ async function Ns(t = {}) {
|
|
|
5371
5330
|
}), F = null;
|
|
5372
5331
|
try {
|
|
5373
5332
|
r.start("Installing pack files...");
|
|
5374
|
-
let n = await
|
|
5333
|
+
let n = await $i({
|
|
5375
5334
|
packs: P,
|
|
5376
5335
|
config: h,
|
|
5377
5336
|
projectRoot: g,
|
|
@@ -5383,15 +5342,15 @@ async function Ns(t = {}) {
|
|
|
5383
5342
|
for (let e of n.errors) s.log.error(e);
|
|
5384
5343
|
s.cancel("No files were written. Fix the errors above (or pass --force for existing files) and try again."), process.exit(1);
|
|
5385
5344
|
}
|
|
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)`),
|
|
5345
|
+
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)`), Ko(n.skipped));
|
|
5387
5346
|
for (let e of n.errors) s.log.error(e);
|
|
5388
5347
|
r.start("Applying template overrides...");
|
|
5389
|
-
let o = await
|
|
5348
|
+
let o = await Os(u.id, {
|
|
5390
5349
|
token: S,
|
|
5391
5350
|
licenseKey: x
|
|
5392
5351
|
});
|
|
5393
5352
|
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;
|
|
5394
|
-
let c = await
|
|
5353
|
+
let c = await ta({
|
|
5395
5354
|
manifest: d,
|
|
5396
5355
|
config: h,
|
|
5397
5356
|
projectRoot: g,
|
|
@@ -5401,11 +5360,11 @@ async function Ns(t = {}) {
|
|
|
5401
5360
|
for (let e of c.errors) s.log.error(e);
|
|
5402
5361
|
if (!m) {
|
|
5403
5362
|
let t = T.resolve(g, h.paths?.frontend.root ?? "apps/frontend"), n = d.theme ?? "zinc-mono";
|
|
5404
|
-
a(n) && (await
|
|
5363
|
+
a(n) && (await ro(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`)));
|
|
5405
5364
|
let r = d.defaultMode === "dark" || d.defaultMode === "light" ? d.defaultMode : e;
|
|
5406
|
-
await
|
|
5365
|
+
await Za(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`));
|
|
5407
5366
|
}
|
|
5408
|
-
await
|
|
5367
|
+
await Ms({
|
|
5409
5368
|
prepared: P,
|
|
5410
5369
|
templateNpm: d.dependencies_npm,
|
|
5411
5370
|
paths: h.paths,
|
|
@@ -5413,13 +5372,13 @@ async function Ns(t = {}) {
|
|
|
5413
5372
|
spinner: r
|
|
5414
5373
|
});
|
|
5415
5374
|
let l;
|
|
5416
|
-
m && (l = await
|
|
5375
|
+
m && (l = await Ca(g, t.yes ?? !1)), await pr({
|
|
5417
5376
|
projectRoot: g,
|
|
5418
5377
|
paths: h.paths,
|
|
5419
5378
|
skipPrompts: t.yes ?? !1,
|
|
5420
5379
|
dbReady: l,
|
|
5421
5380
|
freshScaffold: m
|
|
5422
|
-
}),
|
|
5381
|
+
}), Go(), s.outro(z.brand(`Installed template ${u.name}.`));
|
|
5423
5382
|
} finally {
|
|
5424
5383
|
await Promise.all(P.map((e) => y.rm(e.packDir, {
|
|
5425
5384
|
recursive: !0,
|
|
@@ -5430,7 +5389,7 @@ async function Ns(t = {}) {
|
|
|
5430
5389
|
});
|
|
5431
5390
|
}
|
|
5432
5391
|
}
|
|
5433
|
-
async function
|
|
5392
|
+
async function As(e, t, n) {
|
|
5434
5393
|
let r = {};
|
|
5435
5394
|
for (let i of e.slots) {
|
|
5436
5395
|
if (t?.[i.family]) {
|
|
@@ -5454,7 +5413,7 @@ async function Ps(e, t, n) {
|
|
|
5454
5413
|
}
|
|
5455
5414
|
return r;
|
|
5456
5415
|
}
|
|
5457
|
-
async function
|
|
5416
|
+
async function js(e) {
|
|
5458
5417
|
let { packs: t, templatePacks: n, installedSet: r, options: i } = e, a = new Set(n);
|
|
5459
5418
|
if (i.packs && i.packs.length > 0) {
|
|
5460
5419
|
let e = i.packs.filter((e) => !t.some((t) => t.name === e));
|
|
@@ -5465,7 +5424,7 @@ async function Fs(e) {
|
|
|
5465
5424
|
if (o.length === 0) return [];
|
|
5466
5425
|
let c = ce();
|
|
5467
5426
|
s.note(o.map((e) => ` ${B.arrow} ${z.highlight(e.displayName)} ${ge(`${c}/packs/${e.name}`)}`).join("\n"), "Browse packs");
|
|
5468
|
-
let l = await
|
|
5427
|
+
let l = await Wa({
|
|
5469
5428
|
message: "Add extra packs on top of the template (optional)",
|
|
5470
5429
|
options: o.map((e) => ({
|
|
5471
5430
|
value: e.name,
|
|
@@ -5476,25 +5435,25 @@ async function Fs(e) {
|
|
|
5476
5435
|
});
|
|
5477
5436
|
return m(l) && (s.cancel("Cancelled."), process.exit(0)), l;
|
|
5478
5437
|
}
|
|
5479
|
-
async function
|
|
5480
|
-
let { prepared: t, templateNpm: n, paths: r, cwd: i, spinner: a } = e, o =
|
|
5438
|
+
async function Ms(e) {
|
|
5439
|
+
let { prepared: t, templateNpm: n, paths: r, cwd: i, spinner: a } = e, o = Lo(t.map((e) => e.manifest.dependencies_npm)), c = Io(n ? Lo([o, n]) : o, r);
|
|
5481
5440
|
if (c.errors.length > 0) {
|
|
5482
5441
|
for (let e of c.errors) s.log.error(e);
|
|
5483
5442
|
return;
|
|
5484
5443
|
}
|
|
5485
5444
|
if (c.operations.length === 0) return;
|
|
5486
5445
|
a.start("Installing npm dependencies...");
|
|
5487
|
-
let l = await
|
|
5446
|
+
let l = await Ro(c.operations, i);
|
|
5488
5447
|
if (a.stop(l.ok ? "npm dependencies installed" : "npm dependency installation failed"), !l.ok) for (let e of l.errors) s.log.error(e);
|
|
5489
5448
|
}
|
|
5490
5449
|
//#endregion
|
|
5491
5450
|
//#region src/cli.ts
|
|
5492
|
-
function
|
|
5451
|
+
function Ns(e) {
|
|
5493
5452
|
if (!e) return;
|
|
5494
5453
|
let t = e.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
|
|
5495
5454
|
return t.length > 0 ? t : void 0;
|
|
5496
5455
|
}
|
|
5497
|
-
function
|
|
5456
|
+
function Ps(e) {
|
|
5498
5457
|
if (!e) return;
|
|
5499
5458
|
let t = {};
|
|
5500
5459
|
for (let n of e.split(",")) {
|
|
@@ -5503,10 +5462,10 @@ function Rs(e) {
|
|
|
5503
5462
|
}
|
|
5504
5463
|
return Object.keys(t).length > 0 ? t : void 0;
|
|
5505
5464
|
}
|
|
5506
|
-
function
|
|
5465
|
+
function Fs() {
|
|
5507
5466
|
let e = new o();
|
|
5508
5467
|
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) => {
|
|
5509
|
-
await
|
|
5468
|
+
await rs({
|
|
5510
5469
|
name: e.name,
|
|
5511
5470
|
directory: e.directory,
|
|
5512
5471
|
install: e.install,
|
|
@@ -5516,38 +5475,38 @@ function zs() {
|
|
|
5516
5475
|
setup: e.setup
|
|
5517
5476
|
});
|
|
5518
5477
|
}), e.command("init").description("Initialize stack.json in the current project").action(async () => {
|
|
5519
|
-
await
|
|
5478
|
+
await is({});
|
|
5520
5479
|
}), 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) => {
|
|
5521
|
-
await
|
|
5480
|
+
await bs({
|
|
5522
5481
|
cwd: e.cwd,
|
|
5523
5482
|
yes: e.yes,
|
|
5524
5483
|
skipMigrations: e.skipMigrations
|
|
5525
5484
|
});
|
|
5526
5485
|
}), 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) => {
|
|
5527
|
-
await
|
|
5528
|
-
packs:
|
|
5486
|
+
await os({
|
|
5487
|
+
packs: Ns(e.packs),
|
|
5529
5488
|
force: e.force,
|
|
5530
5489
|
yes: e.yes,
|
|
5531
5490
|
licenseKey: e.key ?? e.licenseKey,
|
|
5532
5491
|
cwd: e.cwd
|
|
5533
5492
|
});
|
|
5534
5493
|
}), 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) => {
|
|
5535
|
-
await
|
|
5494
|
+
await ks({
|
|
5536
5495
|
templateId: e,
|
|
5537
|
-
variants:
|
|
5538
|
-
packs:
|
|
5496
|
+
variants: Ps(t.variants),
|
|
5497
|
+
packs: Ns(t.packs),
|
|
5539
5498
|
force: t.force,
|
|
5540
5499
|
yes: t.yes,
|
|
5541
5500
|
licenseKey: t.key ?? t.licenseKey,
|
|
5542
5501
|
cwd: t.cwd
|
|
5543
5502
|
});
|
|
5544
5503
|
}), e.command("login").description("Log in via your browser to install packs your organization owns").action(async () => {
|
|
5545
|
-
await
|
|
5504
|
+
await fs();
|
|
5546
5505
|
}), e.command("logout").description("Log out and remove the saved CLI token").action(async () => {
|
|
5547
|
-
await
|
|
5506
|
+
await ps();
|
|
5548
5507
|
}), e.command("auth").description("Alias for `login`").action(async () => {
|
|
5549
|
-
await
|
|
5508
|
+
await fs();
|
|
5550
5509
|
}), e;
|
|
5551
5510
|
}
|
|
5552
5511
|
//#endregion
|
|
5553
|
-
export {
|
|
5512
|
+
export { as as a, os as i, ps as n, is as o, fs as r, rs as s, Fs as t };
|