@hype-stack/cli 0.5.13 → 0.5.14
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-Cm8dj5Gp.js → cli-B8l-9vsh.js} +431 -396
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/template.d.ts.map +1 -1
- package/dist/config/bin.js +1 -1
- package/dist/constants/themes.d.ts.map +1 -1
- package/dist/core/apply-radius.d.ts +28 -0
- package/dist/core/apply-radius.d.ts.map +1 -0
- package/dist/core/codemods.d.ts +6 -0
- package/dist/core/codemods.d.ts.map +1 -1
- package/dist/core/installer.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/themes.js +1 -21
- package/dist/types/types.d.ts +14 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ import { Prompt as O } from "@clack/core";
|
|
|
13
13
|
import { styleText as k } from "node:util";
|
|
14
14
|
import { downloadTemplate as ee } from "giget";
|
|
15
15
|
//#region src/constants/constants.ts
|
|
16
|
-
var A = "0.5.
|
|
16
|
+
var A = "0.5.14", te = "gh:BetterTyped/hype-stack", ne = "stack.json", re = "/schema/stack.json", j = "https://api.hype-stack.dev", M = "HYPE_STACK_API_URL", N = "https://www.hype-stack.dev", ie = /^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/, P = [
|
|
17
17
|
{
|
|
18
18
|
value: "cursor",
|
|
19
19
|
label: "Cursor",
|
|
@@ -3014,15 +3014,17 @@ var xi = "import { type LucideIcon } from \"lucide-react\";\n\n/* --------------
|
|
|
3014
3014
|
secondary: "secondaryNav",
|
|
3015
3015
|
tertiary: "tertiaryNav",
|
|
3016
3016
|
settings: "settingsNav"
|
|
3017
|
-
};
|
|
3018
|
-
async function Ci(e) {
|
|
3019
|
-
let { entries: t, paths: n, projectRoot: r, slot: i = "frontend" } = e, a = Jr(i, n), o = T.resolve(r, a, "src/constants/nav.constants.ts"), s;
|
|
3020
|
-
await Y(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s = xi);
|
|
3021
|
-
for (let e of t) s.includes(`label: "${e.label}"`) || (s = Ei(s, e));
|
|
3022
|
-
for (let e of t.toReversed()) s.includes(`label: "${e.label}"`) || (s = Oi(s, e));
|
|
3023
|
-
await y.writeFile(o, s, "utf-8");
|
|
3024
|
-
}
|
|
3017
|
+
}, Ci = new Set(["primary", "secondary"]);
|
|
3025
3018
|
async function wi(e) {
|
|
3019
|
+
let { entries: t, paths: n, projectRoot: r, slot: i = "frontend", override: a = !1 } = e, o = Jr(i, n), s = T.resolve(r, o, "src/constants/nav.constants.ts"), c;
|
|
3020
|
+
await Y(s) ? c = await y.readFile(s, "utf-8") : (await y.mkdir(T.dirname(s), { recursive: !0 }), c = xi);
|
|
3021
|
+
for (let e of t) !a && c.includes(`label: "${e.label}"`) || (c = Di(c, e));
|
|
3022
|
+
if (a) for (let e of t) c.includes(`label: "${e.label}"`) && (c = ji(c, e));
|
|
3023
|
+
for (let e of t) Ci.has(e.group) && (c.includes(`label: "${e.label}"`) || (c = ki(c, e, "append")));
|
|
3024
|
+
for (let e of t.toReversed()) Ci.has(e.group) || c.includes(`label: "${e.label}"`) || (c = ki(c, e, "prepend"));
|
|
3025
|
+
await y.writeFile(s, c, "utf-8");
|
|
3026
|
+
}
|
|
3027
|
+
async function Ti(e) {
|
|
3026
3028
|
let { postLoginRedirect: t, paths: n, projectRoot: r, slot: i = "frontend" } = e, a = Jr(i, n), o = T.resolve(r, a, "src/features/auth/constants/auth.constants.ts");
|
|
3027
3029
|
if (!await Y(o)) return;
|
|
3028
3030
|
let s = await y.readFile(o, "utf-8"), c = /export const POST_LOGIN_REDIRECT_PATH = "[^"]*";/;
|
|
@@ -3030,17 +3032,17 @@ async function wi(e) {
|
|
|
3030
3032
|
let l = s.replace(c, `export const POST_LOGIN_REDIRECT_PATH = "${t}";`);
|
|
3031
3033
|
await y.writeFile(o, l, "utf-8");
|
|
3032
3034
|
}
|
|
3033
|
-
function
|
|
3035
|
+
function Ei(e) {
|
|
3034
3036
|
let t = [e.icon];
|
|
3035
3037
|
if (e.items) for (let n of e.items) t.includes(n.icon) || t.push(n.icon);
|
|
3036
3038
|
return t;
|
|
3037
3039
|
}
|
|
3038
|
-
function
|
|
3039
|
-
let n =
|
|
3040
|
-
for (let e of n) r =
|
|
3040
|
+
function Di(e, t) {
|
|
3041
|
+
let n = Ei(t), r = e;
|
|
3042
|
+
for (let e of n) r = Oi(r, e);
|
|
3041
3043
|
return r;
|
|
3042
3044
|
}
|
|
3043
|
-
function
|
|
3045
|
+
function Oi(e, t) {
|
|
3044
3046
|
let n = e.match(/import \{([^}]+)\} from "lucide-react";/);
|
|
3045
3047
|
if (!n) return e;
|
|
3046
3048
|
let r = n[1].split(",").map((e) => e.trim()).filter(Boolean);
|
|
@@ -3048,21 +3050,31 @@ function Di(e, t) {
|
|
|
3048
3050
|
let i = r.findIndex((e) => e.startsWith("type "));
|
|
3049
3051
|
return i === -1 ? r.push(t) : r.splice(i, 0, t), e.replace(n[0], `import { ${r.join(", ")} } from "lucide-react";`);
|
|
3050
3052
|
}
|
|
3051
|
-
function
|
|
3052
|
-
let
|
|
3053
|
-
if (!
|
|
3054
|
-
let
|
|
3055
|
-
if (!
|
|
3056
|
-
let
|
|
3057
|
-
return
|
|
3053
|
+
function ki(e, t, n) {
|
|
3054
|
+
let r = Si[t.group];
|
|
3055
|
+
if (!r) return e;
|
|
3056
|
+
let i = Mi(t), a = RegExp(`export const ${r}: NavEntry\\[\\] = \\[`), o = e.match(a);
|
|
3057
|
+
if (!o) return e;
|
|
3058
|
+
let s = e.indexOf(o[0]) + o[0].length, c = Ai(e, s - 1);
|
|
3059
|
+
return c === -1 ? e : e.slice(s, c).trim() === "" ? e.slice(0, s) + "\n" + i + "\n" + e.slice(s) : n === "append" ? e.slice(0, c) + i + "\n" + e.slice(c) : e.slice(0, s) + "\n" + i + e.slice(s);
|
|
3058
3060
|
}
|
|
3059
|
-
function
|
|
3061
|
+
function Ai(e, t) {
|
|
3060
3062
|
let n = 0;
|
|
3061
3063
|
for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
|
|
3062
3064
|
else if (e[r] === "]" && (n--, n === 0)) return r;
|
|
3063
3065
|
return -1;
|
|
3064
3066
|
}
|
|
3065
|
-
function
|
|
3067
|
+
function ji(e, t) {
|
|
3068
|
+
let n = e.indexOf(`label: "${t.label}"`);
|
|
3069
|
+
if (n === -1) return e;
|
|
3070
|
+
let r = e.lastIndexOf("{", n);
|
|
3071
|
+
if (r === -1) return e;
|
|
3072
|
+
let i = ci(e, r);
|
|
3073
|
+
if (i === -1) return e;
|
|
3074
|
+
let a = Mi(t).trimStart().replace(/,\s*$/, "");
|
|
3075
|
+
return e.slice(0, r) + a + e.slice(i + 1);
|
|
3076
|
+
}
|
|
3077
|
+
function Mi(e) {
|
|
3066
3078
|
let t = [];
|
|
3067
3079
|
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) {
|
|
3068
3080
|
t.push(" items: [");
|
|
@@ -3078,14 +3090,14 @@ function Ai(e) {
|
|
|
3078
3090
|
} else t.push(" items: [],");
|
|
3079
3091
|
return t.push(" },"), t.join("\n");
|
|
3080
3092
|
}
|
|
3081
|
-
async function
|
|
3093
|
+
async function Ni(e, t, n) {
|
|
3082
3094
|
let r = Z("{{backend.features}}", t), i = T.resolve(n, r, "organizations/modules/setup-organization/steps/index.ts");
|
|
3083
3095
|
if (!await Y(i)) return;
|
|
3084
3096
|
let a = await y.readFile(i, "utf-8");
|
|
3085
|
-
for (let t of e) a.includes(`from "${t.from}"`) || (a =
|
|
3097
|
+
for (let t of e) a.includes(`from "${t.from}"`) || (a = Pi(a, t), a = Fi(a, t));
|
|
3086
3098
|
await y.writeFile(i, a, "utf-8");
|
|
3087
3099
|
}
|
|
3088
|
-
function
|
|
3100
|
+
function Pi(e, t) {
|
|
3089
3101
|
let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("import ");
|
|
3090
3102
|
if (r !== -1) {
|
|
3091
3103
|
let t = e.indexOf("\n", e.indexOf(";", r));
|
|
@@ -3093,38 +3105,38 @@ function Mi(e, t) {
|
|
|
3093
3105
|
}
|
|
3094
3106
|
return e.indexOf("type "), n + "\n\n" + e;
|
|
3095
3107
|
}
|
|
3096
|
-
function
|
|
3108
|
+
function Fi(e, t) {
|
|
3097
3109
|
let n = ` { id: "${t.id}", execute: (ctx) => ${t.import}(ctx) },`, r = e.match(/export const steps:\s*Step\[\]\s*=\s*\[/);
|
|
3098
3110
|
if (!r) return e;
|
|
3099
|
-
let i = e.indexOf(r[0]) + r[0].length, a =
|
|
3111
|
+
let i = e.indexOf(r[0]) + r[0].length, a = Ii(e, i - 1);
|
|
3100
3112
|
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);
|
|
3101
3113
|
}
|
|
3102
|
-
function
|
|
3114
|
+
function Ii(e, t) {
|
|
3103
3115
|
let n = 0;
|
|
3104
3116
|
for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
|
|
3105
3117
|
else if (e[r] === "]" && (n--, n === 0)) return r;
|
|
3106
3118
|
return -1;
|
|
3107
3119
|
}
|
|
3108
|
-
var
|
|
3109
|
-
async function
|
|
3110
|
-
await
|
|
3120
|
+
var Li = "import { type ComponentType } from \"react\";\n\nexport type NavbarAction = {\n id: string;\n component: ComponentType;\n};\n\nexport const navbarActions: NavbarAction[] = [];\n\nexport const userMenuActions: NavbarAction[] = [];\n";
|
|
3121
|
+
async function Ri(e) {
|
|
3122
|
+
await Bi({
|
|
3111
3123
|
...e,
|
|
3112
3124
|
arrayName: "navbarActions"
|
|
3113
3125
|
});
|
|
3114
3126
|
}
|
|
3115
|
-
async function
|
|
3116
|
-
await
|
|
3127
|
+
async function zi(e) {
|
|
3128
|
+
await Bi({
|
|
3117
3129
|
...e,
|
|
3118
3130
|
arrayName: "userMenuActions"
|
|
3119
3131
|
});
|
|
3120
3132
|
}
|
|
3121
|
-
async function
|
|
3133
|
+
async function Bi({ actions: e, arrayName: t, paths: n, projectRoot: r, slot: i }) {
|
|
3122
3134
|
let a = Jr(i, n), o = T.resolve(r, a, "src/constants/navbar-actions.tsx"), s;
|
|
3123
|
-
await Y(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s =
|
|
3124
|
-
for (let n of e) s =
|
|
3135
|
+
await Y(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s = Li);
|
|
3136
|
+
for (let n of e) s = Vi(s, n), s = Hi(s, n, t);
|
|
3125
3137
|
await y.writeFile(o, s, "utf-8");
|
|
3126
3138
|
}
|
|
3127
|
-
function
|
|
3139
|
+
function Vi(e, t) {
|
|
3128
3140
|
let n = `import { ${t.import} } from "${t.from}";`;
|
|
3129
3141
|
if (e.includes(n)) return e;
|
|
3130
3142
|
let r = e.lastIndexOf("import ");
|
|
@@ -3132,38 +3144,38 @@ function zi(e, t) {
|
|
|
3132
3144
|
let i = e.indexOf("\n", r);
|
|
3133
3145
|
return i === -1 ? e + "\n" + n : e.slice(0, i + 1) + n + "\n" + e.slice(i + 1);
|
|
3134
3146
|
}
|
|
3135
|
-
function
|
|
3147
|
+
function Hi(e, t, n) {
|
|
3136
3148
|
let r = e.match(RegExp(`export const ${n}:\\s*NavbarAction\\[\\]\\s*=\\s*\\[`));
|
|
3137
3149
|
if (!r) return e;
|
|
3138
|
-
let i = e.indexOf(r[0]) + r[0].length, a =
|
|
3150
|
+
let i = e.indexOf(r[0]) + r[0].length, a = Ui(e, i - 1);
|
|
3139
3151
|
if (a === -1) return e;
|
|
3140
3152
|
let o = e.slice(i, a);
|
|
3141
3153
|
if (o.includes(`id: "${t.id}"`)) return e;
|
|
3142
3154
|
let s = ` { id: "${t.id}", component: ${t.import} },`;
|
|
3143
3155
|
return o.trim() === "" ? e.slice(0, a) + "\n" + s + "\n" + e.slice(a) : e.slice(0, a) + s + "\n" + e.slice(a);
|
|
3144
3156
|
}
|
|
3145
|
-
function
|
|
3157
|
+
function Ui(e, t) {
|
|
3146
3158
|
let n = 0;
|
|
3147
3159
|
for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
|
|
3148
3160
|
else if (e[r] === "]" && (n--, n === 0)) return r;
|
|
3149
3161
|
return -1;
|
|
3150
3162
|
}
|
|
3151
|
-
var
|
|
3163
|
+
var Wi = new Set([
|
|
3152
3164
|
".ts",
|
|
3153
3165
|
".tsx",
|
|
3154
3166
|
".js",
|
|
3155
3167
|
".jsx"
|
|
3156
3168
|
]);
|
|
3157
|
-
async function
|
|
3169
|
+
async function Gi(e) {
|
|
3158
3170
|
let { files: t, paths: n, projectRoot: r, projectName: i } = e;
|
|
3159
3171
|
if (i === "hype-stack") return;
|
|
3160
3172
|
let a = `@${i}/`;
|
|
3161
3173
|
await Promise.all(t.map(async (e) => {
|
|
3162
3174
|
let t = Br(e.target, n, r), i = await y.stat(t).catch(() => null);
|
|
3163
|
-
i?.isDirectory() ? await
|
|
3175
|
+
i?.isDirectory() ? await Ji(t, a) : i?.isFile() && Wi.has(T.extname(t)) && await Yi(t, a);
|
|
3164
3176
|
}));
|
|
3165
3177
|
}
|
|
3166
|
-
var
|
|
3178
|
+
var Ki = new Set([
|
|
3167
3179
|
".git",
|
|
3168
3180
|
"node_modules",
|
|
3169
3181
|
"dist",
|
|
@@ -3172,20 +3184,20 @@ var Wi = new Set([
|
|
|
3172
3184
|
".next",
|
|
3173
3185
|
"coverage"
|
|
3174
3186
|
]);
|
|
3175
|
-
async function
|
|
3176
|
-
t !== "hype-stack" && await
|
|
3187
|
+
async function qi(e, t) {
|
|
3188
|
+
t !== "hype-stack" && await Ji(e, `@${t}/`);
|
|
3177
3189
|
}
|
|
3178
|
-
async function
|
|
3190
|
+
async function Ji(e, t) {
|
|
3179
3191
|
let n = await y.readdir(e, { withFileTypes: !0 });
|
|
3180
3192
|
await Promise.all(n.map(async (n) => {
|
|
3181
3193
|
let r = T.join(e, n.name);
|
|
3182
3194
|
if (n.isDirectory()) {
|
|
3183
|
-
if (
|
|
3184
|
-
await
|
|
3185
|
-
} else n.isFile() &&
|
|
3195
|
+
if (Ki.has(n.name)) return;
|
|
3196
|
+
await Ji(r, t);
|
|
3197
|
+
} else n.isFile() && Wi.has(T.extname(n.name)) && await Yi(r, t);
|
|
3186
3198
|
}));
|
|
3187
3199
|
}
|
|
3188
|
-
async function
|
|
3200
|
+
async function Yi(e, t) {
|
|
3189
3201
|
let n = await y.readFile(e, "utf-8");
|
|
3190
3202
|
if (!n.includes(Gr)) return;
|
|
3191
3203
|
let r = qr(n, t);
|
|
@@ -3193,22 +3205,22 @@ async function qi(e, t) {
|
|
|
3193
3205
|
}
|
|
3194
3206
|
//#endregion
|
|
3195
3207
|
//#region src/core/installer.ts
|
|
3196
|
-
function
|
|
3208
|
+
function Xi(e, t) {
|
|
3197
3209
|
return e.slot ? t ? t.includes(e.slot) : e.slot === "frontend" : !0;
|
|
3198
3210
|
}
|
|
3199
|
-
async function
|
|
3211
|
+
async function Zi(e, t) {
|
|
3200
3212
|
if ((await y.stat(e)).isDirectory()) {
|
|
3201
3213
|
await y.mkdir(t, { recursive: !0 });
|
|
3202
3214
|
let n = await y.readdir(e, { withFileTypes: !0 });
|
|
3203
|
-
for (let r of n) await
|
|
3215
|
+
for (let r of n) await Zi(T.join(e, r.name), T.join(t, r.name));
|
|
3204
3216
|
} else await y.mkdir(T.dirname(t), { recursive: !0 }), await y.copyFile(e, t);
|
|
3205
3217
|
}
|
|
3206
|
-
async function
|
|
3218
|
+
async function Qi(e) {
|
|
3207
3219
|
let { src: t, dest: n, projectRoot: r, skip: i } = e;
|
|
3208
3220
|
if ((await y.stat(t)).isDirectory()) {
|
|
3209
3221
|
await y.mkdir(n, { recursive: !0 });
|
|
3210
3222
|
let e = await y.readdir(t, { withFileTypes: !0 });
|
|
3211
|
-
return (await Promise.all(e.map((e) =>
|
|
3223
|
+
return (await Promise.all(e.map((e) => Qi({
|
|
3212
3224
|
src: T.join(t, e.name),
|
|
3213
3225
|
dest: T.join(n, e.name),
|
|
3214
3226
|
projectRoot: r,
|
|
@@ -3217,7 +3229,7 @@ async function Xi(e) {
|
|
|
3217
3229
|
}
|
|
3218
3230
|
return i.has(t) ? [] : (await y.mkdir(T.dirname(n), { recursive: !0 }), await y.copyFile(t, n), [T.relative(r, n)]);
|
|
3219
3231
|
}
|
|
3220
|
-
async function
|
|
3232
|
+
async function $i(e) {
|
|
3221
3233
|
let { file: t, packDir: n, paths: r, projectRoot: i } = e, a = Vr(t.source, n), o = Br(t.target, r, i);
|
|
3222
3234
|
return {
|
|
3223
3235
|
sourcePath: a,
|
|
@@ -3226,8 +3238,8 @@ async function Zi(e) {
|
|
|
3226
3238
|
targetExists: await Y(o) || await lr(o)
|
|
3227
3239
|
};
|
|
3228
3240
|
}
|
|
3229
|
-
async function
|
|
3230
|
-
let { file: t, packDir: n, paths: r, projectRoot: i } = e, { sourcePath: a, targetPath: o, sourceExists: s, targetExists: c } = await
|
|
3241
|
+
async function ea(e) {
|
|
3242
|
+
let { file: t, packDir: n, paths: r, projectRoot: i } = e, { sourcePath: a, targetPath: o, sourceExists: s, targetExists: c } = await $i({
|
|
3231
3243
|
file: t,
|
|
3232
3244
|
packDir: n,
|
|
3233
3245
|
paths: r,
|
|
@@ -3242,8 +3254,8 @@ async function Qi(e) {
|
|
|
3242
3254
|
default: return `${t.target}: Unknown strategy: ${String(t.strategy)}`;
|
|
3243
3255
|
}
|
|
3244
3256
|
}
|
|
3245
|
-
async function
|
|
3246
|
-
let { file: t, packDir: n, paths: r, projectRoot: i, force: a, overwrite: o } = e, { sourcePath: s, targetPath: c, sourceExists: l, targetExists: u } = await
|
|
3257
|
+
async function ta(e) {
|
|
3258
|
+
let { file: t, packDir: n, paths: r, projectRoot: i, force: a, overwrite: o } = e, { sourcePath: s, targetPath: c, sourceExists: l, targetExists: u } = await $i({
|
|
3247
3259
|
file: t,
|
|
3248
3260
|
packDir: n,
|
|
3249
3261
|
paths: r,
|
|
@@ -3261,7 +3273,7 @@ async function $i(e) {
|
|
|
3261
3273
|
status: "skipped",
|
|
3262
3274
|
path: t.target,
|
|
3263
3275
|
reason: "Already exists"
|
|
3264
|
-
} : (await
|
|
3276
|
+
} : (await Zi(s, c), {
|
|
3265
3277
|
status: "installed",
|
|
3266
3278
|
path: t.target
|
|
3267
3279
|
});
|
|
@@ -3270,16 +3282,16 @@ async function $i(e) {
|
|
|
3270
3282
|
status: "skipped",
|
|
3271
3283
|
path: t.target,
|
|
3272
3284
|
reason: "Already exists (skip-if-exists)"
|
|
3273
|
-
} : (await
|
|
3285
|
+
} : (await Zi(s, c), {
|
|
3274
3286
|
status: "installed",
|
|
3275
3287
|
path: t.target
|
|
3276
3288
|
});
|
|
3277
|
-
case "override": return await
|
|
3289
|
+
case "override": return await Zi(s, c), {
|
|
3278
3290
|
status: "installed",
|
|
3279
3291
|
path: t.target
|
|
3280
3292
|
};
|
|
3281
3293
|
case "merge": {
|
|
3282
|
-
if (!u) return await
|
|
3294
|
+
if (!u) return await Zi(s, c), {
|
|
3283
3295
|
status: "installed",
|
|
3284
3296
|
path: t.target
|
|
3285
3297
|
};
|
|
@@ -3309,15 +3321,15 @@ async function $i(e) {
|
|
|
3309
3321
|
};
|
|
3310
3322
|
}
|
|
3311
3323
|
}
|
|
3312
|
-
async function
|
|
3324
|
+
async function na(e) {
|
|
3313
3325
|
let { packs: t, config: n, projectRoot: r, slotsByPack: i } = e, a = n.paths;
|
|
3314
3326
|
if (!a) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
|
|
3315
3327
|
let o = [], s = /* @__PURE__ */ new Set();
|
|
3316
3328
|
for (let e of t) {
|
|
3317
3329
|
let t = i?.get(e.manifest.name);
|
|
3318
3330
|
for (let n of e.manifest.files) {
|
|
3319
|
-
if (n.strategy !== "create" || !
|
|
3320
|
-
let { targetPath: i, targetExists: c } = await
|
|
3331
|
+
if (n.strategy !== "create" || !Xi(n, t)) continue;
|
|
3332
|
+
let { targetPath: i, targetExists: c } = await $i({
|
|
3321
3333
|
file: n,
|
|
3322
3334
|
packDir: e.packDir,
|
|
3323
3335
|
paths: a,
|
|
@@ -3332,13 +3344,13 @@ async function ea(e) {
|
|
|
3332
3344
|
}
|
|
3333
3345
|
return o;
|
|
3334
3346
|
}
|
|
3335
|
-
async function
|
|
3347
|
+
async function ra(e) {
|
|
3336
3348
|
let { manifest: t, config: n, projectRoot: r, force: i, packDir: a, slots: o } = e, s = n.paths;
|
|
3337
3349
|
if (!s) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
|
|
3338
3350
|
let c = [];
|
|
3339
3351
|
for (let e of t.files) {
|
|
3340
|
-
if (!
|
|
3341
|
-
let t = await
|
|
3352
|
+
if (!Xi(e, o)) continue;
|
|
3353
|
+
let t = await ea({
|
|
3342
3354
|
file: e,
|
|
3343
3355
|
packDir: a,
|
|
3344
3356
|
paths: s,
|
|
@@ -3349,16 +3361,16 @@ async function ta(e) {
|
|
|
3349
3361
|
}
|
|
3350
3362
|
return c;
|
|
3351
3363
|
}
|
|
3352
|
-
async function
|
|
3364
|
+
async function ia(e) {
|
|
3353
3365
|
let { manifest: t, config: n, projectRoot: r, force: i, overwrite: a, packDir: o, slots: s } = e, c = n.paths;
|
|
3354
3366
|
if (!c) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
|
|
3355
3367
|
let l = {
|
|
3356
3368
|
installed: [],
|
|
3357
3369
|
skipped: [],
|
|
3358
3370
|
errors: []
|
|
3359
|
-
}, u = t.files.filter((e) =>
|
|
3371
|
+
}, u = t.files.filter((e) => Xi(e, s));
|
|
3360
3372
|
for (let e of u) {
|
|
3361
|
-
let t = await
|
|
3373
|
+
let t = await ta({
|
|
3362
3374
|
file: e,
|
|
3363
3375
|
packDir: o,
|
|
3364
3376
|
paths: c,
|
|
@@ -3378,40 +3390,40 @@ async function na(e) {
|
|
|
3378
3390
|
break;
|
|
3379
3391
|
}
|
|
3380
3392
|
}
|
|
3381
|
-
await
|
|
3393
|
+
await Gi({
|
|
3382
3394
|
files: u,
|
|
3383
3395
|
paths: c,
|
|
3384
3396
|
projectRoot: r,
|
|
3385
3397
|
projectName: n.name
|
|
3386
3398
|
}), t.env && t.env.length > 0 && await Yr(t.env, c, r), t.routes && t.routes.length > 0 && await ti(t.routes, c, r), t.context && t.context.length > 0 && await ii(t.context, c, r), t.sockets && t.sockets.length > 0 && await fi(t.sockets, c, r), t.sdkConfigurations && t.sdkConfigurations.length > 0 && await gi(t.sdkConfigurations, c, r), t.enums && t.enums.length > 0 && await ui(t.enums, c, r), t.frontendRoutes && t.frontendRoutes.length > 0 && await yi(t.frontendRoutes, c, r);
|
|
3387
3399
|
let d = s && s.length > 0 ? s : ["frontend"];
|
|
3388
|
-
for (let e of d) t.nav && t.nav.length > 0 && await
|
|
3400
|
+
for (let e of d) t.nav && t.nav.length > 0 && await wi({
|
|
3389
3401
|
entries: t.nav,
|
|
3390
3402
|
paths: c,
|
|
3391
3403
|
projectRoot: r,
|
|
3392
3404
|
slot: e
|
|
3393
|
-
}), t.navbarActions && t.navbarActions.length > 0 && await
|
|
3405
|
+
}), t.navbarActions && t.navbarActions.length > 0 && await Ri({
|
|
3394
3406
|
actions: t.navbarActions,
|
|
3395
3407
|
paths: c,
|
|
3396
3408
|
projectRoot: r,
|
|
3397
3409
|
slot: e
|
|
3398
|
-
}), t.userMenuActions && t.userMenuActions.length > 0 && await
|
|
3410
|
+
}), t.userMenuActions && t.userMenuActions.length > 0 && await zi({
|
|
3399
3411
|
actions: t.userMenuActions,
|
|
3400
3412
|
paths: c,
|
|
3401
3413
|
projectRoot: r,
|
|
3402
3414
|
slot: e
|
|
3403
3415
|
});
|
|
3404
|
-
return t.onboardingSteps && t.onboardingSteps.length > 0 && await
|
|
3416
|
+
return t.onboardingSteps && t.onboardingSteps.length > 0 && await Ni(t.onboardingSteps, c, r), t.postLoginRedirect && await Ti({
|
|
3405
3417
|
postLoginRedirect: t.postLoginRedirect,
|
|
3406
3418
|
paths: c,
|
|
3407
3419
|
projectRoot: r,
|
|
3408
3420
|
slot: d[0]
|
|
3409
3421
|
}), l;
|
|
3410
3422
|
}
|
|
3411
|
-
async function
|
|
3423
|
+
async function aa(e) {
|
|
3412
3424
|
let { packs: t, config: n, projectRoot: r, force: i, overwrite: a, slotsByPack: o } = e, s = [];
|
|
3413
3425
|
for (let e of t) {
|
|
3414
|
-
let t = o?.get(e.manifest.name), a = await
|
|
3426
|
+
let t = o?.get(e.manifest.name), a = await ra({
|
|
3415
3427
|
manifest: e.manifest,
|
|
3416
3428
|
config: n,
|
|
3417
3429
|
projectRoot: r,
|
|
@@ -3431,7 +3443,7 @@ async function ra(e) {
|
|
|
3431
3443
|
};
|
|
3432
3444
|
let c = [], l = [], u = [], d = [], f = n;
|
|
3433
3445
|
for (let e of t) {
|
|
3434
|
-
let t = o?.get(e.manifest.name), n = await
|
|
3446
|
+
let t = o?.get(e.manifest.name), n = await ia({
|
|
3435
3447
|
manifest: e.manifest,
|
|
3436
3448
|
config: f,
|
|
3437
3449
|
projectRoot: r,
|
|
@@ -3440,7 +3452,7 @@ async function ra(e) {
|
|
|
3440
3452
|
packDir: e.packDir,
|
|
3441
3453
|
slots: t
|
|
3442
3454
|
});
|
|
3443
|
-
c.push(...n.installed), l.push(...n.skipped), u.push(...n.errors), f = await
|
|
3455
|
+
c.push(...n.installed), l.push(...n.skipped), u.push(...n.errors), f = await oa(f, e.manifest, r), d.push(e.manifest.name);
|
|
3444
3456
|
}
|
|
3445
3457
|
return {
|
|
3446
3458
|
installed: c,
|
|
@@ -3451,7 +3463,7 @@ async function ra(e) {
|
|
|
3451
3463
|
config: f
|
|
3452
3464
|
};
|
|
3453
3465
|
}
|
|
3454
|
-
async function
|
|
3466
|
+
async function oa(e, t, n) {
|
|
3455
3467
|
let r = typeof t == "string" ? t : t.name, i = typeof t == "string" ? [] : Dr(t.env), a = Or([...e.onboarding?.envSections ?? [], ...i]), o = {
|
|
3456
3468
|
...e,
|
|
3457
3469
|
installedPacks: [...e.installedPacks ?? [], r],
|
|
@@ -3462,7 +3474,7 @@ async function ia(e, t, n) {
|
|
|
3462
3474
|
};
|
|
3463
3475
|
return await Nr(n, o), o;
|
|
3464
3476
|
}
|
|
3465
|
-
async function
|
|
3477
|
+
async function sa(e) {
|
|
3466
3478
|
let { manifest: t, config: n, projectRoot: r, templateDir: i } = e, a = n.paths;
|
|
3467
3479
|
if (!a) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
|
|
3468
3480
|
let o = [], s = [], c = t.files.filter((e) => e.strategy === "merge"), l = new Set(c.map((e) => Vr(e.source, i))), u = T.join(i, "files");
|
|
@@ -3472,7 +3484,7 @@ async function aa(e) {
|
|
|
3472
3484
|
if (!t.isDirectory()) continue;
|
|
3473
3485
|
let e = a[t.name]?.root;
|
|
3474
3486
|
if (!e) continue;
|
|
3475
|
-
let n = await
|
|
3487
|
+
let n = await Qi({
|
|
3476
3488
|
src: T.join(u, t.name),
|
|
3477
3489
|
dest: T.resolve(r, e),
|
|
3478
3490
|
projectRoot: r,
|
|
@@ -3482,7 +3494,7 @@ async function aa(e) {
|
|
|
3482
3494
|
}
|
|
3483
3495
|
}
|
|
3484
3496
|
for (let e of c) {
|
|
3485
|
-
let t = await
|
|
3497
|
+
let t = await ta({
|
|
3486
3498
|
file: e,
|
|
3487
3499
|
packDir: i,
|
|
3488
3500
|
paths: a,
|
|
@@ -3493,11 +3505,12 @@ async function aa(e) {
|
|
|
3493
3505
|
t.status === "installed" ? o.push(t.path) : t.status === "error" && s.push(`${t.path}: ${t.reason}`);
|
|
3494
3506
|
}
|
|
3495
3507
|
let d = T.join(Br("{{frontend.root}}", a, r), "src", "routes"), f = T.join(d, "(public)", "index.tsx"), p = T.join(d, "(private)", "index.tsx");
|
|
3496
|
-
return await Y(f) && await Y(p) && await y.rm(p, { force: !0 }), t.frontendRoutes && t.frontendRoutes.length > 0 && await yi(t.frontendRoutes, a, r), t.nav && t.nav.length > 0 && await
|
|
3508
|
+
return await Y(f) && await Y(p) && await y.rm(p, { force: !0 }), t.frontendRoutes && t.frontendRoutes.length > 0 && await yi(t.frontendRoutes, a, r), t.nav && t.nav.length > 0 && await wi({
|
|
3497
3509
|
entries: t.nav,
|
|
3498
3510
|
paths: a,
|
|
3499
|
-
projectRoot: r
|
|
3500
|
-
|
|
3511
|
+
projectRoot: r,
|
|
3512
|
+
override: !0
|
|
3513
|
+
}), t.postLoginRedirect && await Ti({
|
|
3501
3514
|
postLoginRedirect: t.postLoginRedirect,
|
|
3502
3515
|
paths: a,
|
|
3503
3516
|
projectRoot: r
|
|
@@ -3508,32 +3521,32 @@ async function aa(e) {
|
|
|
3508
3521
|
}
|
|
3509
3522
|
//#endregion
|
|
3510
3523
|
//#region src/core/pack-categories.ts
|
|
3511
|
-
var
|
|
3524
|
+
var ca = [
|
|
3512
3525
|
"starter",
|
|
3513
3526
|
"layout",
|
|
3514
3527
|
"feature"
|
|
3515
|
-
],
|
|
3528
|
+
], la = {
|
|
3516
3529
|
starter: "Starter",
|
|
3517
3530
|
layout: "Layout",
|
|
3518
3531
|
feature: "Features"
|
|
3519
|
-
},
|
|
3520
|
-
function
|
|
3532
|
+
}, ua = new Set(["starter", "layout"]), da = "starter-saas-betterauth", fa = "layout-basic";
|
|
3533
|
+
function pa(e, t = {}) {
|
|
3521
3534
|
let n = [];
|
|
3522
|
-
for (let r of
|
|
3535
|
+
for (let r of ca) {
|
|
3523
3536
|
let i = e.filter((e) => e.category === r);
|
|
3524
3537
|
if (i.length === 0) continue;
|
|
3525
|
-
let a =
|
|
3538
|
+
let a = ua.has(r) ? "single" : "multiple";
|
|
3526
3539
|
if (r === "layout") {
|
|
3527
|
-
n.push(
|
|
3540
|
+
n.push(ha("frontend", i)), t.adminAvailable && n.push(ha("admin", i));
|
|
3528
3541
|
continue;
|
|
3529
3542
|
}
|
|
3530
3543
|
if (r === "starter") {
|
|
3531
|
-
n.push(
|
|
3544
|
+
n.push(ma(i));
|
|
3532
3545
|
continue;
|
|
3533
3546
|
}
|
|
3534
3547
|
n.push({
|
|
3535
3548
|
category: r,
|
|
3536
|
-
label:
|
|
3549
|
+
label: la[r],
|
|
3537
3550
|
mode: a,
|
|
3538
3551
|
packs: i,
|
|
3539
3552
|
preselect: null
|
|
@@ -3541,36 +3554,36 @@ function da(e, t = {}) {
|
|
|
3541
3554
|
}
|
|
3542
3555
|
return n;
|
|
3543
3556
|
}
|
|
3544
|
-
function
|
|
3545
|
-
let t = e.some((e) => e.name ===
|
|
3557
|
+
function ma(e) {
|
|
3558
|
+
let t = e.some((e) => e.name === da);
|
|
3546
3559
|
return {
|
|
3547
3560
|
category: "starter",
|
|
3548
|
-
label:
|
|
3561
|
+
label: la.starter,
|
|
3549
3562
|
mode: "single",
|
|
3550
3563
|
packs: e,
|
|
3551
|
-
preselect: t ?
|
|
3564
|
+
preselect: t ? da : null
|
|
3552
3565
|
};
|
|
3553
3566
|
}
|
|
3554
|
-
function
|
|
3555
|
-
let n = t.some((e) => e.name ===
|
|
3567
|
+
function ha(e, t) {
|
|
3568
|
+
let n = t.some((e) => e.name === fa);
|
|
3556
3569
|
return {
|
|
3557
3570
|
category: "layout",
|
|
3558
3571
|
label: e === "admin" ? "Admin Layout" : "Layout",
|
|
3559
3572
|
mode: "single",
|
|
3560
3573
|
packs: t,
|
|
3561
|
-
preselect: n ?
|
|
3574
|
+
preselect: n ? fa : null,
|
|
3562
3575
|
slot: e
|
|
3563
3576
|
};
|
|
3564
3577
|
}
|
|
3565
3578
|
//#endregion
|
|
3566
3579
|
//#region src/core/post-setup.ts
|
|
3567
|
-
async function
|
|
3580
|
+
async function ga() {
|
|
3568
3581
|
return (await J("docker", ["info"], { cwd: process.cwd() })).exitCode === 0;
|
|
3569
3582
|
}
|
|
3570
|
-
async function
|
|
3583
|
+
async function _a(e) {
|
|
3571
3584
|
return Y(`${e}/apps/backend/.env`);
|
|
3572
3585
|
}
|
|
3573
|
-
async function
|
|
3586
|
+
async function va(e, t, n) {
|
|
3574
3587
|
let r = n ? `Start services with ${L.command("docker compose up -d")}?` : `Docker is not running. Start services with ${L.command("docker compose up -d")}?`, i = t ? !0 : await s.confirm({
|
|
3575
3588
|
message: r,
|
|
3576
3589
|
initialValue: !0
|
|
@@ -3583,13 +3596,13 @@ async function ga(e, t, n) {
|
|
|
3583
3596
|
"up",
|
|
3584
3597
|
"-d"
|
|
3585
3598
|
], { cwd: `${e}/apps/backend` });
|
|
3586
|
-
return o.exitCode === 0 ? (a.stop(L.success("Docker services started")), !0) : (a.error("Failed to start Docker services"),
|
|
3599
|
+
return o.exitCode === 0 ? (a.stop(L.success("Docker services started")), !0) : (a.error("Failed to start Docker services"), ya(o), !1);
|
|
3587
3600
|
}
|
|
3588
|
-
function
|
|
3601
|
+
function ya(e) {
|
|
3589
3602
|
let t = (e.stderr || e.stdout).trim();
|
|
3590
3603
|
t && s.log.warn(L.muted(t));
|
|
3591
3604
|
}
|
|
3592
|
-
async function
|
|
3605
|
+
async function ba(e, t = 15, n = 2e3) {
|
|
3593
3606
|
for (let r = 0; r < t; r++) {
|
|
3594
3607
|
if ((await J("docker", [
|
|
3595
3608
|
"compose",
|
|
@@ -3604,8 +3617,8 @@ async function va(e, t = 15, n = 2e3) {
|
|
|
3604
3617
|
}
|
|
3605
3618
|
return !1;
|
|
3606
3619
|
}
|
|
3607
|
-
var
|
|
3608
|
-
async function
|
|
3620
|
+
var xa = "Database schema is up to date";
|
|
3621
|
+
async function Sa(e) {
|
|
3609
3622
|
let t = await J("pnpm", [
|
|
3610
3623
|
"--filter",
|
|
3611
3624
|
"@internal/backend",
|
|
@@ -3614,9 +3627,9 @@ async function ba(e) {
|
|
|
3614
3627
|
"migrate",
|
|
3615
3628
|
"status"
|
|
3616
3629
|
], { cwd: e });
|
|
3617
|
-
return t.exitCode === 0 ? `${t.stdout}\n${t.stderr}`.includes(
|
|
3630
|
+
return t.exitCode === 0 ? `${t.stdout}\n${t.stderr}`.includes(xa) : !1;
|
|
3618
3631
|
}
|
|
3619
|
-
async function
|
|
3632
|
+
async function Ca(e) {
|
|
3620
3633
|
let t = s.spinner();
|
|
3621
3634
|
t.start("Running database migrations...");
|
|
3622
3635
|
let n = await J("pnpm", [
|
|
@@ -3624,15 +3637,15 @@ async function xa(e) {
|
|
|
3624
3637
|
"@internal/backend",
|
|
3625
3638
|
"migration:latest"
|
|
3626
3639
|
], { cwd: e });
|
|
3627
|
-
return n.exitCode === 0 ? (t.stop(L.success("Database migrations applied")), !0) : (t.error("Migrations failed"),
|
|
3640
|
+
return n.exitCode === 0 ? (t.stop(L.success("Database migrations applied")), !0) : (t.error("Migrations failed"), ya(n), s.log.warn(L.muted("Run `pnpm --filter @internal/backend migration:latest` manually to apply migrations.")), !1);
|
|
3628
3641
|
}
|
|
3629
|
-
async function
|
|
3630
|
-
if (!await
|
|
3642
|
+
async function wa(e, t, n = {}) {
|
|
3643
|
+
if (!await va(e, t, await ga())) return !1;
|
|
3631
3644
|
let r = s.spinner();
|
|
3632
|
-
return r.start("Waiting for Postgres to be ready..."), await
|
|
3645
|
+
return r.start("Waiting for Postgres to be ready..."), await ba(e, n.postgresMaxAttempts ?? 15, n.postgresCheckIntervalMs ?? 2e3) ? (r.stop(L.success("Postgres is ready")), !0) : (r.error("Postgres health check timed out"), s.log.warn(L.muted("Run migrations manually once Postgres is ready: pnpm --filter @internal/backend migration:latest")), !1);
|
|
3633
3646
|
}
|
|
3634
|
-
async function
|
|
3635
|
-
if (!await
|
|
3647
|
+
async function Ta(e, t, n = {}) {
|
|
3648
|
+
if (!await wa(e, t, n)) return;
|
|
3636
3649
|
let r = t ? !0 : await s.confirm({
|
|
3637
3650
|
message: `Run database migrations with ${L.command("prisma migrate deploy")}?`,
|
|
3638
3651
|
initialValue: !0
|
|
@@ -3641,21 +3654,21 @@ async function Ca(e, t, n = {}) {
|
|
|
3641
3654
|
s.log.info(L.muted("Skipping database migrations."));
|
|
3642
3655
|
return;
|
|
3643
3656
|
}
|
|
3644
|
-
await
|
|
3657
|
+
await Ca(e);
|
|
3645
3658
|
}
|
|
3646
|
-
async function
|
|
3647
|
-
if (!await
|
|
3659
|
+
async function Ea(e, t, n = {}) {
|
|
3660
|
+
if (!await _a(e)) {
|
|
3648
3661
|
s.log.warn(`${L.path(".env")} not found in ${L.path("apps/backend")}. Skipping Docker and migrations - configure it first.`);
|
|
3649
3662
|
return;
|
|
3650
3663
|
}
|
|
3651
|
-
await
|
|
3664
|
+
await Ta(e, t, n);
|
|
3652
3665
|
}
|
|
3653
|
-
async function
|
|
3654
|
-
return await
|
|
3666
|
+
async function Da(e, t, n = {}) {
|
|
3667
|
+
return await _a(e) ? wa(e, t, n) : (s.log.warn(`${L.path(".env")} not found in ${L.path("apps/backend")}. Skipping Docker - configure it first.`), !1);
|
|
3655
3668
|
}
|
|
3656
3669
|
//#endregion
|
|
3657
3670
|
//#region src/core/resolve.ts
|
|
3658
|
-
function
|
|
3671
|
+
function Oa(e) {
|
|
3659
3672
|
let t = /* @__PURE__ */ new Map();
|
|
3660
3673
|
for (let n of e) t.set(n.name, {
|
|
3661
3674
|
name: n.name,
|
|
@@ -3663,7 +3676,7 @@ function Ea(e) {
|
|
|
3663
3676
|
});
|
|
3664
3677
|
return t;
|
|
3665
3678
|
}
|
|
3666
|
-
function
|
|
3679
|
+
function ka(e, t, n = /* @__PURE__ */ new Set()) {
|
|
3667
3680
|
let r = /* @__PURE__ */ new Set();
|
|
3668
3681
|
function i(e) {
|
|
3669
3682
|
if (n.has(e)) return [];
|
|
@@ -3677,10 +3690,10 @@ function Da(e, t, n = /* @__PURE__ */ new Set()) {
|
|
|
3677
3690
|
}
|
|
3678
3691
|
return i(e);
|
|
3679
3692
|
}
|
|
3680
|
-
function
|
|
3693
|
+
function Aa(e, t, n = []) {
|
|
3681
3694
|
let r = new Set(n), i = new Set(n), a = [];
|
|
3682
3695
|
for (let n of e) {
|
|
3683
|
-
let e =
|
|
3696
|
+
let e = ka(n, t, new Set(i));
|
|
3684
3697
|
for (let t of e) i.has(t) || (i.add(t), a.push(t));
|
|
3685
3698
|
}
|
|
3686
3699
|
return {
|
|
@@ -3688,7 +3701,7 @@ function Oa(e, t, n = []) {
|
|
|
3688
3701
|
alreadyInstalled: e.filter((e) => r.has(e))
|
|
3689
3702
|
};
|
|
3690
3703
|
}
|
|
3691
|
-
function
|
|
3704
|
+
function ja(e) {
|
|
3692
3705
|
let { order: t, graph: n, isLocked: r, installed: i = [] } = e, a = new Set(i), o = /* @__PURE__ */ new Set();
|
|
3693
3706
|
for (let e of t) {
|
|
3694
3707
|
let t = n.get(e)?.dependencies.some((e) => !a.has(e) && o.has(e)) ?? !1;
|
|
@@ -3701,7 +3714,7 @@ function ka(e) {
|
|
|
3701
3714
|
}
|
|
3702
3715
|
//#endregion
|
|
3703
3716
|
//#region src/core/variants.ts
|
|
3704
|
-
function
|
|
3717
|
+
function Ma(e, t = {}) {
|
|
3705
3718
|
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
3706
3719
|
for (let i of e) {
|
|
3707
3720
|
let e = t[i.family] ?? i.default;
|
|
@@ -3713,14 +3726,14 @@ function Aa(e, t = {}) {
|
|
|
3713
3726
|
familyOf: r
|
|
3714
3727
|
};
|
|
3715
3728
|
}
|
|
3716
|
-
function
|
|
3729
|
+
function Na(e, t, n) {
|
|
3717
3730
|
return [...e.map((e) => n.chosen.get(e.family) ?? e.default), ...t];
|
|
3718
3731
|
}
|
|
3719
|
-
function
|
|
3732
|
+
function Pa(e, t) {
|
|
3720
3733
|
let n = t.familyOf.get(e);
|
|
3721
3734
|
return n ? t.chosen.get(n) ?? e : e;
|
|
3722
3735
|
}
|
|
3723
|
-
function
|
|
3736
|
+
function Fa(e, t) {
|
|
3724
3737
|
let n = /* @__PURE__ */ new Map();
|
|
3725
3738
|
for (let t of e) t.family && n.set(t.name, t.family);
|
|
3726
3739
|
let r = new Set(t), i = /* @__PURE__ */ new Map();
|
|
@@ -3736,65 +3749,65 @@ function Na(e, t) {
|
|
|
3736
3749
|
familyOf: n
|
|
3737
3750
|
};
|
|
3738
3751
|
}
|
|
3739
|
-
function
|
|
3752
|
+
function Ia(e, t) {
|
|
3740
3753
|
return e.map((e) => ({
|
|
3741
3754
|
...e,
|
|
3742
|
-
dependencies: e.dependencies.map((e) =>
|
|
3755
|
+
dependencies: e.dependencies.map((e) => Pa(e, t))
|
|
3743
3756
|
}));
|
|
3744
3757
|
}
|
|
3745
3758
|
//#endregion
|
|
3746
3759
|
//#region src/ui/banner.ts
|
|
3747
|
-
var
|
|
3760
|
+
var La = [
|
|
3748
3761
|
" ██╗ ██╗ ██╗ ██╗ ██████╗ ███████╗",
|
|
3749
3762
|
" ██║ ██║ ╚██╗ ██╔╝ ██╔══██╗ ██╔════╝",
|
|
3750
3763
|
" ███████║ ╚████╔╝ ██████╔╝ █████╗ ",
|
|
3751
3764
|
" ██╔══██║ ╚██╔╝ ██╔═══╝ ██╔══╝ ",
|
|
3752
3765
|
" ██║ ██║ ██║ ██║ ███████╗",
|
|
3753
3766
|
" ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝"
|
|
3754
|
-
],
|
|
3767
|
+
], Ra = [
|
|
3755
3768
|
" ███████╗ ████████╗ █████╗ ██████╗ ██╗ ██╗",
|
|
3756
3769
|
" ██╔════╝ ╚══██╔══╝ ██╔══██╗ ██╔════╝ ██║ ██╔╝",
|
|
3757
3770
|
" ███████╗ ██║ ███████║ ██║ █████╔╝ ",
|
|
3758
3771
|
" ╚════██║ ██║ ██╔══██║ ██║ ██╔═██╗ ",
|
|
3759
3772
|
" ███████║ ██║ ██║ ██║ ╚██████╗ ██║ ██╗",
|
|
3760
3773
|
" ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝"
|
|
3761
|
-
],
|
|
3774
|
+
], za = [
|
|
3762
3775
|
253,
|
|
3763
3776
|
176,
|
|
3764
3777
|
21
|
|
3765
|
-
],
|
|
3778
|
+
], Ba = [
|
|
3766
3779
|
245,
|
|
3767
3780
|
76,
|
|
3768
3781
|
2
|
|
3769
|
-
],
|
|
3782
|
+
], Va = 5, Ha = [
|
|
3770
3783
|
17,
|
|
3771
3784
|
103,
|
|
3772
3785
|
248
|
|
3773
|
-
],
|
|
3786
|
+
], Ua = [
|
|
3774
3787
|
42,
|
|
3775
3788
|
160,
|
|
3776
3789
|
250
|
|
3777
|
-
],
|
|
3778
|
-
function
|
|
3790
|
+
], Wa = .2;
|
|
3791
|
+
function Ga() {
|
|
3779
3792
|
console.log();
|
|
3780
|
-
for (let e of Se(
|
|
3781
|
-
start:
|
|
3782
|
-
end:
|
|
3783
|
-
angle:
|
|
3793
|
+
for (let e of Se(La, {
|
|
3794
|
+
start: za,
|
|
3795
|
+
end: Ba,
|
|
3796
|
+
angle: Va
|
|
3784
3797
|
})) console.log(b.bold(e));
|
|
3785
|
-
for (let e of Se(
|
|
3786
|
-
start:
|
|
3787
|
-
end:
|
|
3788
|
-
angle:
|
|
3798
|
+
for (let e of Se(Ra, {
|
|
3799
|
+
start: Ha,
|
|
3800
|
+
end: Ua,
|
|
3801
|
+
angle: Wa
|
|
3789
3802
|
})) console.log(b.bold(e));
|
|
3790
3803
|
console.log(), console.log(` ${R.spark} ${b.dim("v" + A)} ${b.dim("·")} ${be("Ship web + desktop apps from one codebase")}`), console.log();
|
|
3791
3804
|
}
|
|
3792
|
-
function
|
|
3805
|
+
function Ka() {
|
|
3793
3806
|
console.log(), console.log(` ${R.bolt} ${_e.orange("Hype")}${_e.skyBlue("Stack")} ${b.dim("v" + A)}`), console.log();
|
|
3794
3807
|
}
|
|
3795
3808
|
//#endregion
|
|
3796
3809
|
//#region src/ui/pack-multiselect.ts
|
|
3797
|
-
var
|
|
3810
|
+
var qa = class extends O {
|
|
3798
3811
|
options;
|
|
3799
3812
|
cursor = 0;
|
|
3800
3813
|
selected;
|
|
@@ -3898,44 +3911,64 @@ var Ga = class extends O {
|
|
|
3898
3911
|
}
|
|
3899
3912
|
}
|
|
3900
3913
|
};
|
|
3901
|
-
function
|
|
3902
|
-
return new
|
|
3914
|
+
function Ja(e) {
|
|
3915
|
+
return new qa(e).prompt();
|
|
3903
3916
|
}
|
|
3904
3917
|
//#endregion
|
|
3905
3918
|
//#region src/utils/naming.ts
|
|
3906
|
-
function
|
|
3919
|
+
function Ya(e) {
|
|
3907
3920
|
return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
3908
3921
|
}
|
|
3909
|
-
function
|
|
3922
|
+
function Xa(e) {
|
|
3910
3923
|
return e.split(/[-_]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
|
|
3911
3924
|
}
|
|
3912
3925
|
//#endregion
|
|
3913
3926
|
//#region src/utils/validate.ts
|
|
3914
|
-
function
|
|
3927
|
+
function Za(e) {
|
|
3915
3928
|
if (!e.trim()) return "Project name cannot be empty";
|
|
3916
3929
|
if (e.length > 214) return "Project name is too long (max 214 characters)";
|
|
3917
|
-
let t =
|
|
3930
|
+
let t = Ya(e);
|
|
3918
3931
|
if (!ie.test(t)) return "Project name must contain at least one letter or number";
|
|
3919
3932
|
}
|
|
3920
3933
|
//#endregion
|
|
3921
3934
|
//#region src/core/apply-mode.ts
|
|
3922
|
-
var
|
|
3923
|
-
function
|
|
3924
|
-
return e.replace(
|
|
3935
|
+
var Qa = "src/hooks/use-theme.ts", $a = /(\bexport\s+const\s+defaultTheme\s*=\s*)(["'])(?:light|dark)\2/;
|
|
3936
|
+
function eo(e, t) {
|
|
3937
|
+
return e.replace($a, (e, n, r) => `${n}${r}${t}${r}`);
|
|
3938
|
+
}
|
|
3939
|
+
async function to(e, t) {
|
|
3940
|
+
let n = T.resolve(e, Qa), r;
|
|
3941
|
+
try {
|
|
3942
|
+
r = await y.readFile(n, "utf-8");
|
|
3943
|
+
} catch {
|
|
3944
|
+
return !1;
|
|
3945
|
+
}
|
|
3946
|
+
let i = eo(r, t);
|
|
3947
|
+
return i === r || await y.writeFile(n, i, "utf-8"), !0;
|
|
3948
|
+
}
|
|
3949
|
+
//#endregion
|
|
3950
|
+
//#region src/core/apply-radius.ts
|
|
3951
|
+
var no = /(^[ \t]*--radius(?![\w-])[ \t]*:[ \t]*)([^;\n]*);/gm;
|
|
3952
|
+
function ro(e) {
|
|
3953
|
+
return /^[0-9]*\.?[0-9]+(rem|em|px)$/.test(e.trim());
|
|
3925
3954
|
}
|
|
3926
|
-
|
|
3927
|
-
|
|
3955
|
+
function io(e, t) {
|
|
3956
|
+
return e.replace(no, (e, n) => `${n}${t};`);
|
|
3957
|
+
}
|
|
3958
|
+
var ao = "assets/styles.css";
|
|
3959
|
+
async function oo(e, t) {
|
|
3960
|
+
let n = T.resolve(e, ao), r;
|
|
3928
3961
|
try {
|
|
3929
3962
|
r = await y.readFile(n, "utf-8");
|
|
3930
3963
|
} catch {
|
|
3931
3964
|
return !1;
|
|
3932
3965
|
}
|
|
3933
|
-
let i =
|
|
3966
|
+
let i = io(r, t);
|
|
3934
3967
|
return i === r || await y.writeFile(n, i, "utf-8"), !0;
|
|
3935
3968
|
}
|
|
3936
3969
|
//#endregion
|
|
3937
3970
|
//#region src/core/apply-theme.ts
|
|
3938
|
-
function
|
|
3971
|
+
function so(e, t) {
|
|
3939
3972
|
let n = 0;
|
|
3940
3973
|
for (; n < e.length;) {
|
|
3941
3974
|
let r = e.indexOf(t, n);
|
|
@@ -3958,46 +3991,46 @@ function eo(e, t) {
|
|
|
3958
3991
|
}
|
|
3959
3992
|
return null;
|
|
3960
3993
|
}
|
|
3961
|
-
function
|
|
3994
|
+
function co(e, t) {
|
|
3962
3995
|
let n = e;
|
|
3963
3996
|
for (let [e, r] of Object.entries(t)) {
|
|
3964
|
-
let t = RegExp(`(^[ \\t]*--${
|
|
3997
|
+
let t = RegExp(`(^[ \\t]*--${lo(e)}[ \\t]*:[ \\t]*)([^;\\n]*);`, "m");
|
|
3965
3998
|
n = n.replace(t, (e, t) => `${t}${r};`);
|
|
3966
3999
|
}
|
|
3967
4000
|
return n;
|
|
3968
4001
|
}
|
|
3969
|
-
function
|
|
4002
|
+
function lo(e) {
|
|
3970
4003
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3971
4004
|
}
|
|
3972
|
-
function
|
|
3973
|
-
let n =
|
|
4005
|
+
function uo(e, t) {
|
|
4006
|
+
let n = so(e, ":root"), r = so(e, ".dark"), i = e;
|
|
3974
4007
|
if (n) {
|
|
3975
4008
|
let e = i.slice(0, n.bodyStart), r = i.slice(n.bodyStart, n.bodyEnd), a = i.slice(n.bodyEnd);
|
|
3976
|
-
i = e +
|
|
4009
|
+
i = e + co(r, t.light) + a;
|
|
3977
4010
|
}
|
|
3978
4011
|
if (r) {
|
|
3979
|
-
let e =
|
|
4012
|
+
let e = so(i, ".dark");
|
|
3980
4013
|
if (e) {
|
|
3981
4014
|
let n = i.slice(0, e.bodyStart), r = i.slice(e.bodyStart, e.bodyEnd), a = i.slice(e.bodyEnd);
|
|
3982
|
-
i = n +
|
|
4015
|
+
i = n + co(r, t.dark) + a;
|
|
3983
4016
|
}
|
|
3984
4017
|
}
|
|
3985
4018
|
return i;
|
|
3986
4019
|
}
|
|
3987
|
-
var
|
|
3988
|
-
async function
|
|
3989
|
-
let n = T.resolve(e,
|
|
4020
|
+
var fo = "assets/styles.css";
|
|
4021
|
+
async function po(e, t) {
|
|
4022
|
+
let n = T.resolve(e, fo), r;
|
|
3990
4023
|
try {
|
|
3991
4024
|
r = await y.readFile(n, "utf-8");
|
|
3992
4025
|
} catch {
|
|
3993
4026
|
return !1;
|
|
3994
4027
|
}
|
|
3995
|
-
let i =
|
|
4028
|
+
let i = uo(r, t);
|
|
3996
4029
|
return i === r || await y.writeFile(n, i, "utf-8"), !0;
|
|
3997
4030
|
}
|
|
3998
4031
|
//#endregion
|
|
3999
4032
|
//#region src/core/clone.ts
|
|
4000
|
-
async function
|
|
4033
|
+
async function mo(e) {
|
|
4001
4034
|
let t = await ee(te, {
|
|
4002
4035
|
dir: e,
|
|
4003
4036
|
force: !0
|
|
@@ -4009,7 +4042,7 @@ async function oo(e) {
|
|
|
4009
4042
|
}
|
|
4010
4043
|
//#endregion
|
|
4011
4044
|
//#region src/core/editor-config.ts
|
|
4012
|
-
function
|
|
4045
|
+
function ho(e) {
|
|
4013
4046
|
let t = {
|
|
4014
4047
|
globs: [],
|
|
4015
4048
|
alwaysApply: !1
|
|
@@ -4044,10 +4077,10 @@ function so(e) {
|
|
|
4044
4077
|
content: i
|
|
4045
4078
|
};
|
|
4046
4079
|
}
|
|
4047
|
-
function
|
|
4080
|
+
function go(e) {
|
|
4048
4081
|
return e.frontmatter.globs.length > 0 ? `---\npaths:\n${e.frontmatter.globs.map((e) => ` - "${e}"`).join("\n")}\n---\n\n${e.content}` : e.content;
|
|
4049
4082
|
}
|
|
4050
|
-
function
|
|
4083
|
+
function _o(e) {
|
|
4051
4084
|
let t;
|
|
4052
4085
|
t = e.frontmatter.alwaysApply ? "always_on" : e.frontmatter.globs.length > 0 ? "glob" : "model_decision";
|
|
4053
4086
|
let n = [`trigger: ${t}`];
|
|
@@ -4057,30 +4090,30 @@ function lo(e) {
|
|
|
4057
4090
|
}
|
|
4058
4091
|
return e.frontmatter.description && n.push(`description: ${e.frontmatter.description}`), `---\n${n.join("\n")}\n---\n\n${e.content}`;
|
|
4059
4092
|
}
|
|
4060
|
-
function
|
|
4093
|
+
function vo(e) {
|
|
4061
4094
|
return e.frontmatter.globs.length > 0 ? `---\napplyTo: "${e.frontmatter.globs.join(", ")}"\n---\n\n${e.content}` : e.content;
|
|
4062
4095
|
}
|
|
4063
|
-
var
|
|
4096
|
+
var yo = {
|
|
4064
4097
|
claude: {
|
|
4065
4098
|
rulesDir: ".claude/rules",
|
|
4066
4099
|
extension: ".md",
|
|
4067
|
-
convert:
|
|
4100
|
+
convert: go
|
|
4068
4101
|
},
|
|
4069
4102
|
windsurf: {
|
|
4070
4103
|
rulesDir: ".windsurf/rules",
|
|
4071
4104
|
extension: ".md",
|
|
4072
|
-
convert:
|
|
4105
|
+
convert: _o
|
|
4073
4106
|
},
|
|
4074
4107
|
copilot: {
|
|
4075
4108
|
rulesDir: ".github/instructions",
|
|
4076
4109
|
extension: ".instructions.md",
|
|
4077
|
-
convert:
|
|
4110
|
+
convert: vo
|
|
4078
4111
|
}
|
|
4079
4112
|
};
|
|
4080
|
-
async function
|
|
4113
|
+
async function bo(e) {
|
|
4081
4114
|
let t = T.join(e, oe), n = (await y.readdir(t, { withFileTypes: !0 }).catch(() => [])).filter((e) => e.isFile() && e.name.endsWith(".mdc"));
|
|
4082
4115
|
return await Promise.all(n.map(async (e) => {
|
|
4083
|
-
let n = T.join(t, e.name), { frontmatter: r, content: i } =
|
|
4116
|
+
let n = T.join(t, e.name), { frontmatter: r, content: i } = ho(await y.readFile(n, "utf-8"));
|
|
4084
4117
|
return {
|
|
4085
4118
|
frontmatter: r,
|
|
4086
4119
|
content: i,
|
|
@@ -4088,9 +4121,9 @@ async function po(e) {
|
|
|
4088
4121
|
};
|
|
4089
4122
|
}));
|
|
4090
4123
|
}
|
|
4091
|
-
async function
|
|
4124
|
+
async function xo(e, t) {
|
|
4092
4125
|
if (t === "cursor") return;
|
|
4093
|
-
let n =
|
|
4126
|
+
let n = yo[t], r = await bo(e), i = T.join(e, n.rulesDir);
|
|
4094
4127
|
await y.mkdir(i, { recursive: !0 }), await Promise.all(r.map((e) => {
|
|
4095
4128
|
let t = n.convert(e), r = e.filename.replace(/\.mdc$/, n.extension);
|
|
4096
4129
|
return y.writeFile(T.join(i, r), t, "utf-8");
|
|
@@ -4098,21 +4131,21 @@ async function mo(e, t) {
|
|
|
4098
4131
|
}
|
|
4099
4132
|
//#endregion
|
|
4100
4133
|
//#region src/core/env-files.ts
|
|
4101
|
-
var
|
|
4134
|
+
var So = [
|
|
4102
4135
|
"apps",
|
|
4103
4136
|
"packages",
|
|
4104
4137
|
"libs",
|
|
4105
4138
|
"shared"
|
|
4106
4139
|
];
|
|
4107
|
-
async function
|
|
4108
|
-
let t = await
|
|
4140
|
+
async function Co(e) {
|
|
4141
|
+
let t = await wo(e);
|
|
4109
4142
|
return (await Promise.all(t.map(async (t) => {
|
|
4110
4143
|
let n = T.join(T.dirname(t), ".env");
|
|
4111
4144
|
return await Y(n) ? null : (await y.copyFile(t, n), T.relative(e, n));
|
|
4112
4145
|
}))).filter((e) => e !== null).sort();
|
|
4113
4146
|
}
|
|
4114
|
-
async function
|
|
4115
|
-
let t = [T.join(e, ".env.example")], n = await Promise.all(
|
|
4147
|
+
async function wo(e) {
|
|
4148
|
+
let t = [T.join(e, ".env.example")], n = await Promise.all(So.map(async (t) => {
|
|
4116
4149
|
let n = T.join(e, t);
|
|
4117
4150
|
return (await y.readdir(n, { withFileTypes: !0 }).catch(() => [])).filter((e) => e.isDirectory()).map((e) => T.join(n, e.name, ".env.example"));
|
|
4118
4151
|
}));
|
|
@@ -4120,11 +4153,11 @@ async function _o(e) {
|
|
|
4120
4153
|
}
|
|
4121
4154
|
//#endregion
|
|
4122
4155
|
//#region src/core/post-clone.ts
|
|
4123
|
-
var Q = "@hype-stack/",
|
|
4124
|
-
async function
|
|
4156
|
+
var Q = "@hype-stack/", To = "hype-stack", Eo = "@hype-stack/cli";
|
|
4157
|
+
async function Do(e) {
|
|
4125
4158
|
await mr(T.join(e, ".git"));
|
|
4126
4159
|
}
|
|
4127
|
-
async function
|
|
4160
|
+
async function Oo(e) {
|
|
4128
4161
|
await J("git", ["init"], { cwd: e }), await J("git", ["add", "."], { cwd: e }), await J("git", [
|
|
4129
4162
|
"-c",
|
|
4130
4163
|
"user.name=Hype Stack CLI",
|
|
@@ -4135,19 +4168,19 @@ async function xo(e) {
|
|
|
4135
4168
|
"Initial commit from Hype Stack CLI"
|
|
4136
4169
|
], { cwd: e });
|
|
4137
4170
|
}
|
|
4138
|
-
async function
|
|
4139
|
-
let n = `@${t}/`, r = await
|
|
4171
|
+
async function ko(e, t) {
|
|
4172
|
+
let n = `@${t}/`, r = await Lo(e);
|
|
4140
4173
|
for (let e of r) {
|
|
4141
4174
|
let t = await dr(e);
|
|
4142
4175
|
if (!t) continue;
|
|
4143
4176
|
let r = !1;
|
|
4144
|
-
t.name?.startsWith(Q) && (t.name = t.name.replace(Q, n), r = !0),
|
|
4177
|
+
t.name?.startsWith(Q) && (t.name = t.name.replace(Q, n), r = !0), Po(t.dependencies, n) && (r = !0), Po(t.devDependencies, n) && (r = !0), t.nx && Fo(t.nx, n) && (r = !0);
|
|
4145
4178
|
let i = await y.readFile(e, "utf-8"), a = qr(i, n);
|
|
4146
4179
|
a === i ? r && await fr(e, t) : await y.writeFile(e, a, "utf-8");
|
|
4147
4180
|
}
|
|
4148
|
-
await
|
|
4181
|
+
await qi(e, t), await Mo(e, t), await Io(e, t);
|
|
4149
4182
|
}
|
|
4150
|
-
var
|
|
4183
|
+
var Ao = new Set([
|
|
4151
4184
|
".git",
|
|
4152
4185
|
"node_modules",
|
|
4153
4186
|
"dist",
|
|
@@ -4155,10 +4188,10 @@ var Co = new Set([
|
|
|
4155
4188
|
".nx",
|
|
4156
4189
|
".next",
|
|
4157
4190
|
"coverage"
|
|
4158
|
-
]),
|
|
4159
|
-
async function
|
|
4160
|
-
if (t ===
|
|
4161
|
-
let n = await
|
|
4191
|
+
]), jo = /^(docker-compose|compose)(\.[\w.-]+)?\.ya?ml$/;
|
|
4192
|
+
async function Mo(e, t) {
|
|
4193
|
+
if (t === To) return;
|
|
4194
|
+
let n = await No(e);
|
|
4162
4195
|
await Promise.all(n.map(async (e) => {
|
|
4163
4196
|
let n = await y.readFile(e, "utf-8").catch(() => null);
|
|
4164
4197
|
if (!n || !/^name:[ \t]*hype-stack/m.test(n)) return;
|
|
@@ -4166,23 +4199,23 @@ async function To(e, t) {
|
|
|
4166
4199
|
await y.writeFile(e, r, "utf-8");
|
|
4167
4200
|
}));
|
|
4168
4201
|
}
|
|
4169
|
-
async function
|
|
4202
|
+
async function No(e) {
|
|
4170
4203
|
let t = await y.readdir(e, { withFileTypes: !0 }).catch(() => []);
|
|
4171
4204
|
return (await Promise.all(t.map(async (t) => {
|
|
4172
4205
|
let n = T.join(e, t.name);
|
|
4173
|
-
return t.isDirectory() ?
|
|
4206
|
+
return t.isDirectory() ? Ao.has(t.name) ? [] : No(n) : t.isFile() && jo.test(t.name) ? [n] : [];
|
|
4174
4207
|
}))).flat();
|
|
4175
4208
|
}
|
|
4176
|
-
function
|
|
4209
|
+
function Po(e, t) {
|
|
4177
4210
|
if (!e) return !1;
|
|
4178
4211
|
let n = !1;
|
|
4179
|
-
for (let r of Object.keys(e)) if (r !==
|
|
4212
|
+
for (let r of Object.keys(e)) if (r !== Eo && r.startsWith(Q)) {
|
|
4180
4213
|
let i = r.replace(Q, t);
|
|
4181
4214
|
e[i] = e[r], delete e[r], n = !0;
|
|
4182
4215
|
}
|
|
4183
4216
|
return n;
|
|
4184
4217
|
}
|
|
4185
|
-
function
|
|
4218
|
+
function Fo(e, t) {
|
|
4186
4219
|
if (!e) return !1;
|
|
4187
4220
|
let n = !1;
|
|
4188
4221
|
if (e.implicitDependencies &&= e.implicitDependencies.map((e) => e.startsWith(Q) ? (n = !0, e.replace(Q, t)) : e), e.targets) {
|
|
@@ -4190,13 +4223,13 @@ function Oo(e, t) {
|
|
|
4190
4223
|
}
|
|
4191
4224
|
return n;
|
|
4192
4225
|
}
|
|
4193
|
-
async function
|
|
4226
|
+
async function Io(e, t) {
|
|
4194
4227
|
let n = T.join(e, "packages/enums/src/app/index.ts"), r = await y.readFile(n, "utf-8").catch(() => null);
|
|
4195
4228
|
if (!r) return;
|
|
4196
|
-
let i =
|
|
4229
|
+
let i = Xa(t), a = r.replaceAll(`id: "${To}"`, `id: "${t}"`).replaceAll(`name: "${To}"`, `name: "${t}"`).replace(/name: "Hype Stack"/, `name: "${i}"`).replace(/description: ".*?"/, `description: "${i} application"`);
|
|
4197
4230
|
await y.writeFile(n, a, "utf-8");
|
|
4198
4231
|
}
|
|
4199
|
-
async function
|
|
4232
|
+
async function Lo(e) {
|
|
4200
4233
|
let t = [], n = T.join(e, "package.json");
|
|
4201
4234
|
(await y.stat(n).catch(() => null))?.isFile() && t.push(n);
|
|
4202
4235
|
for (let n of [
|
|
@@ -4216,7 +4249,7 @@ async function Ao(e) {
|
|
|
4216
4249
|
}
|
|
4217
4250
|
//#endregion
|
|
4218
4251
|
//#region src/core/readme.ts
|
|
4219
|
-
var
|
|
4252
|
+
var Ro = {
|
|
4220
4253
|
cursor: {
|
|
4221
4254
|
label: "Cursor",
|
|
4222
4255
|
rulesDir: ".cursor/rules"
|
|
@@ -4233,21 +4266,21 @@ var jo = {
|
|
|
4233
4266
|
label: "GitHub Copilot",
|
|
4234
4267
|
rulesDir: ".github/instructions"
|
|
4235
4268
|
}
|
|
4236
|
-
},
|
|
4269
|
+
}, zo = {
|
|
4237
4270
|
backend: "Hono API server (Postgres, Prisma, Kysely, Valkey cache, WorkOS auth)",
|
|
4238
4271
|
frontend: "React + Vite app talking to the backend through the typed HyperFetch SDK"
|
|
4239
|
-
},
|
|
4272
|
+
}, Bo = {
|
|
4240
4273
|
enums: "Shared enums and app config used across apps",
|
|
4241
4274
|
cli: "Project tooling and code generators"
|
|
4242
4275
|
};
|
|
4243
|
-
function
|
|
4276
|
+
function Vo(e, t) {
|
|
4244
4277
|
return Object.entries(e).toSorted(([e], [t]) => e.localeCompare(t)).map(([e, n]) => {
|
|
4245
4278
|
let r = t[e];
|
|
4246
4279
|
return r ? `- \`${n}\` - ${r}` : `- \`${n}\``;
|
|
4247
4280
|
});
|
|
4248
4281
|
}
|
|
4249
|
-
function
|
|
4250
|
-
let { projectName: t, editor: n, workspace: r } = e, i =
|
|
4282
|
+
function Ho(e) {
|
|
4283
|
+
let { projectName: t, editor: n, workspace: r } = e, i = Xa(t), a = Ro[n], o = !!r.apps.backend, s = Vo(r.apps, zo), c = Vo(r.packages, Bo), l = [];
|
|
4251
4284
|
s.length > 0 && l.push(...s), c.length > 0 && l.push(...c), l.push("- `stack.json` - Hype Stack workspace config (apps, paths, installed packs)");
|
|
4252
4285
|
let u = [];
|
|
4253
4286
|
u.push(`# ${i}`), u.push([
|
|
@@ -4350,13 +4383,13 @@ function Fo(e) {
|
|
|
4350
4383
|
"stays useful."
|
|
4351
4384
|
].join("\n")), u.join("\n\n") + "\n";
|
|
4352
4385
|
}
|
|
4353
|
-
async function
|
|
4386
|
+
async function Uo(e, t) {
|
|
4354
4387
|
let n = T.join(e, "README.md");
|
|
4355
|
-
await y.writeFile(n,
|
|
4388
|
+
await y.writeFile(n, Ho(t), "utf-8");
|
|
4356
4389
|
}
|
|
4357
4390
|
//#endregion
|
|
4358
4391
|
//#region src/core/tracking.ts
|
|
4359
|
-
async function
|
|
4392
|
+
async function Wo(e) {
|
|
4360
4393
|
try {
|
|
4361
4394
|
let t = {
|
|
4362
4395
|
"X-Device-Id": er(),
|
|
@@ -4370,7 +4403,7 @@ async function Lo(e) {
|
|
|
4370
4403
|
}
|
|
4371
4404
|
//#endregion
|
|
4372
4405
|
//#region src/core/npm-deps.ts
|
|
4373
|
-
function
|
|
4406
|
+
function Go(e, t) {
|
|
4374
4407
|
let n = [], r = [];
|
|
4375
4408
|
if (!e) return {
|
|
4376
4409
|
errors: n,
|
|
@@ -4401,7 +4434,7 @@ function Ro(e, t) {
|
|
|
4401
4434
|
operations: r
|
|
4402
4435
|
};
|
|
4403
4436
|
}
|
|
4404
|
-
function
|
|
4437
|
+
function Ko(e) {
|
|
4405
4438
|
let t = {};
|
|
4406
4439
|
for (let n of e) if (n) for (let [e, r] of Object.entries(n)) t[e] = {
|
|
4407
4440
|
...t[e],
|
|
@@ -4409,7 +4442,7 @@ function zo(e) {
|
|
|
4409
4442
|
};
|
|
4410
4443
|
return t;
|
|
4411
4444
|
}
|
|
4412
|
-
async function
|
|
4445
|
+
async function qo(e, t, n = J) {
|
|
4413
4446
|
let r = [];
|
|
4414
4447
|
for (let i of e) {
|
|
4415
4448
|
let e = T.join(t, i.relativeDir);
|
|
@@ -4445,14 +4478,14 @@ async function Bo(e, t, n = J) {
|
|
|
4445
4478
|
function $(e) {
|
|
4446
4479
|
return e instanceof Error ? e.message : String(e);
|
|
4447
4480
|
}
|
|
4448
|
-
async function
|
|
4481
|
+
async function Jo(e, t, n) {
|
|
4449
4482
|
let r = e.filter((e) => e.tier === "paid" && !t.has(e.name)).map((e) => e.name);
|
|
4450
4483
|
return r.length === 0 ? {} : Wr(r, n).catch(() => ({}));
|
|
4451
4484
|
}
|
|
4452
|
-
function
|
|
4485
|
+
function Yo(e, t) {
|
|
4453
4486
|
return e === "free" ? L.success("free") : e === "owned" ? L.accent("owned") : `${L.highlight(`$${t}`)} ${L.muted("locked")}`;
|
|
4454
4487
|
}
|
|
4455
|
-
async function
|
|
4488
|
+
async function Xo(e, t, n) {
|
|
4456
4489
|
let r = e.filter((e) => t(e)), i = e.filter((e) => !t(e));
|
|
4457
4490
|
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 sr(r.map((e) => n.get(e)).filter((e) => e !== void 0).map((e) => ({
|
|
4458
4491
|
name: e.name,
|
|
@@ -4460,7 +4493,7 @@ async function Uo(e, t, n) {
|
|
|
4460
4493
|
price: e.price
|
|
4461
4494
|
})));
|
|
4462
4495
|
}
|
|
4463
|
-
function
|
|
4496
|
+
function Zo(e, t) {
|
|
4464
4497
|
z([
|
|
4465
4498
|
"These packs will be installed, in order:",
|
|
4466
4499
|
"",
|
|
@@ -4470,7 +4503,7 @@ function Wo(e, t) {
|
|
|
4470
4503
|
})
|
|
4471
4504
|
].join("\n"), "Install Plan");
|
|
4472
4505
|
}
|
|
4473
|
-
async function
|
|
4506
|
+
async function Qo(e, t) {
|
|
4474
4507
|
let n = [];
|
|
4475
4508
|
for (let r of e) {
|
|
4476
4509
|
let e = await Rr(r), i = await zr(r, t);
|
|
@@ -4482,18 +4515,18 @@ async function Go(e, t) {
|
|
|
4482
4515
|
}
|
|
4483
4516
|
return n;
|
|
4484
4517
|
}
|
|
4485
|
-
async function
|
|
4486
|
-
let { prepared: t, paths: n, cwd: r, spinner: i } = e, a =
|
|
4518
|
+
async function $o(e) {
|
|
4519
|
+
let { prepared: t, paths: n, cwd: r, spinner: i } = e, a = Go(Ko(t.map((e) => e.manifest.dependencies_npm)), n);
|
|
4487
4520
|
if (a.errors.length > 0) {
|
|
4488
4521
|
for (let e of a.errors) s.log.error(e);
|
|
4489
4522
|
return;
|
|
4490
4523
|
}
|
|
4491
4524
|
if (a.operations.length === 0) return;
|
|
4492
4525
|
i.start("Installing npm dependencies...");
|
|
4493
|
-
let o = await
|
|
4526
|
+
let o = await qo(a.operations, r);
|
|
4494
4527
|
if (i.stop(o.ok ? "npm dependencies installed" : "npm dependency installation failed"), !o.ok) for (let e of o.errors) s.log.error(e);
|
|
4495
4528
|
}
|
|
4496
|
-
function
|
|
4529
|
+
function es() {
|
|
4497
4530
|
Te([{
|
|
4498
4531
|
command: "npx @hype-stack/cli onboard",
|
|
4499
4532
|
hint: "(set up env vars + run migrations)"
|
|
@@ -4502,7 +4535,7 @@ function qo() {
|
|
|
4502
4535
|
hint: "(start frontend + backend)"
|
|
4503
4536
|
}]);
|
|
4504
4537
|
}
|
|
4505
|
-
function
|
|
4538
|
+
function ts(e) {
|
|
4506
4539
|
if (e.length === 0) return;
|
|
4507
4540
|
let t = e.map((e) => {
|
|
4508
4541
|
let t = e.replace(/^\{\{[^}]+\}\}\//, "");
|
|
@@ -4510,10 +4543,10 @@ function Jo(e) {
|
|
|
4510
4543
|
});
|
|
4511
4544
|
s.note(t.join("\n"), "Skipped (already exist)");
|
|
4512
4545
|
}
|
|
4513
|
-
async function
|
|
4546
|
+
async function ns(e) {
|
|
4514
4547
|
let { prepared: t, config: n, cwd: r, force: i, yes: a, slotsByPack: o } = e, c = /* @__PURE__ */ new Set();
|
|
4515
4548
|
if (i) return c;
|
|
4516
|
-
let l = await
|
|
4549
|
+
let l = await na({
|
|
4517
4550
|
packs: t,
|
|
4518
4551
|
config: n,
|
|
4519
4552
|
projectRoot: r,
|
|
@@ -4540,7 +4573,7 @@ async function Yo(e) {
|
|
|
4540
4573
|
}
|
|
4541
4574
|
//#endregion
|
|
4542
4575
|
//#region src/ui/swatch.ts
|
|
4543
|
-
function
|
|
4576
|
+
function rs(e) {
|
|
4544
4577
|
let t = e.trim().match(/^oklch\(([^)]+)\)$/i);
|
|
4545
4578
|
if (!t) return null;
|
|
4546
4579
|
let n = t[1].trim().split(/\s+/);
|
|
@@ -4559,56 +4592,56 @@ function Xo(e) {
|
|
|
4559
4592
|
h: a
|
|
4560
4593
|
};
|
|
4561
4594
|
}
|
|
4562
|
-
function
|
|
4595
|
+
function is(e) {
|
|
4563
4596
|
return Math.min(255, Math.max(0, Math.round(e)));
|
|
4564
4597
|
}
|
|
4565
|
-
function
|
|
4598
|
+
function as(e) {
|
|
4566
4599
|
return e <= .0031308 ? 12.92 * e : 1.055 * e ** (1 / 2.4) - .055;
|
|
4567
4600
|
}
|
|
4568
|
-
function
|
|
4601
|
+
function os({ l: e, c: t, h: n }) {
|
|
4569
4602
|
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;
|
|
4570
4603
|
return [
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4604
|
+
is(as(f) * 255),
|
|
4605
|
+
is(as(p) * 255),
|
|
4606
|
+
is(as(m) * 255)
|
|
4574
4607
|
];
|
|
4575
4608
|
}
|
|
4576
|
-
var
|
|
4577
|
-
function
|
|
4609
|
+
var ss = "\x1B[49m";
|
|
4610
|
+
function cs(e, t) {
|
|
4578
4611
|
let n = e[t];
|
|
4579
4612
|
if (!n) return b.dim(" ");
|
|
4580
|
-
let r =
|
|
4613
|
+
let r = rs(n);
|
|
4581
4614
|
if (!r) return b.dim(" ");
|
|
4582
|
-
let [i, a, o] =
|
|
4583
|
-
return `\x1b[48;2;${i};${a};${o}m ${
|
|
4615
|
+
let [i, a, o] = os(r);
|
|
4616
|
+
return `\x1b[48;2;${i};${a};${o}m ${ss}`;
|
|
4584
4617
|
}
|
|
4585
|
-
var
|
|
4618
|
+
var ls = [
|
|
4586
4619
|
"primary",
|
|
4587
4620
|
"secondary",
|
|
4588
4621
|
"accent"
|
|
4589
4622
|
];
|
|
4590
|
-
function
|
|
4591
|
-
return
|
|
4623
|
+
function us(e) {
|
|
4624
|
+
return ls.map((t) => cs(e, t)).join("");
|
|
4592
4625
|
}
|
|
4593
|
-
function
|
|
4594
|
-
return `${
|
|
4626
|
+
function ds(e) {
|
|
4627
|
+
return `${us(e.light)} ${b.dim("·")} ${us(e.dark)}`;
|
|
4595
4628
|
}
|
|
4596
4629
|
//#endregion
|
|
4597
4630
|
//#region src/commands/create.ts
|
|
4598
|
-
async function
|
|
4599
|
-
e.skipBanner ||
|
|
4631
|
+
async function fs(e) {
|
|
4632
|
+
e.skipBanner || Ga(), s.intro(L.brandBold("Create a new Hype Stack project"));
|
|
4600
4633
|
let o = e.yes === !0, c, l;
|
|
4601
4634
|
if (o && e.name) {
|
|
4602
|
-
let t =
|
|
4603
|
-
t && (s.log.error(t), B()), l = e.name, c =
|
|
4635
|
+
let t = Za(e.name);
|
|
4636
|
+
t && (s.log.error(t), B()), l = e.name, c = Ya(e.name);
|
|
4604
4637
|
} else {
|
|
4605
4638
|
let t = await s.text({
|
|
4606
4639
|
message: "What is your project named?",
|
|
4607
4640
|
placeholder: "my-app",
|
|
4608
4641
|
initialValue: e.name ?? "",
|
|
4609
|
-
validate: (e) =>
|
|
4642
|
+
validate: (e) => Za(e ?? "")
|
|
4610
4643
|
});
|
|
4611
|
-
s.isCancel(t) && B(), l = t, c =
|
|
4644
|
+
s.isCancel(t) && B(), l = t, c = Ya(l);
|
|
4612
4645
|
}
|
|
4613
4646
|
l.trim() !== c && s.log.info(L.muted(`Using "${L.highlight(c)}" as the project name`));
|
|
4614
4647
|
let u;
|
|
@@ -4652,7 +4685,7 @@ async function as(e) {
|
|
|
4652
4685
|
message: "Pick a color theme",
|
|
4653
4686
|
options: r.map((e) => ({
|
|
4654
4687
|
value: e.name,
|
|
4655
|
-
label: `${
|
|
4688
|
+
label: `${ds(e)} ${e.label}`
|
|
4656
4689
|
})),
|
|
4657
4690
|
initialValue: h
|
|
4658
4691
|
});
|
|
@@ -4670,31 +4703,31 @@ async function as(e) {
|
|
|
4670
4703
|
(s.isCancel(e) || !e) && B();
|
|
4671
4704
|
}
|
|
4672
4705
|
let _ = s.spinner();
|
|
4673
|
-
_.start("Cloning Hype Stack template..."), await
|
|
4706
|
+
_.start("Cloning Hype Stack template..."), await mo(d), _.stop(L.success("Template cloned"));
|
|
4674
4707
|
let v = s.spinner();
|
|
4675
|
-
v.start("Setting up project..."), await
|
|
4708
|
+
v.start("Setting up project..."), await Do(d), await ko(d, c), await xo(d, p);
|
|
4676
4709
|
let y = await Pr(d), b = Ir(c, y);
|
|
4677
|
-
await Nr(d, b), await
|
|
4710
|
+
await Nr(d, b), await Uo(d, {
|
|
4678
4711
|
projectName: c,
|
|
4679
4712
|
editor: p,
|
|
4680
4713
|
workspace: y
|
|
4681
4714
|
});
|
|
4682
4715
|
let x = T.resolve(d, b.paths?.frontend.root ?? "apps/frontend");
|
|
4683
|
-
a(g) && (await
|
|
4716
|
+
a(g) && (await po(x, i(g)) || s.log.warn(L.muted(`Could not find ${L.path("assets/styles.css")} to apply the ${g} theme`))), e.radius !== void 0 && ro(e.radius) && (await oo(x, e.radius) || s.log.warn(L.muted(`Could not find ${L.path("assets/styles.css")} to set the corner radius`))), await to(x, e.defaultMode === "dark" || e.defaultMode === "light" ? e.defaultMode : "light") || s.log.warn(L.muted(`Could not find ${L.path("src/hooks/use-theme.ts")} to set the default color mode`)), v.stop(L.success("Project configured"));
|
|
4684
4717
|
let S = s.spinner();
|
|
4685
4718
|
S.start("Installing dependencies..."), (await J("pnpm", ["install"], { cwd: d })).exitCode === 0 ? S.stop(L.success("Dependencies installed")) : (S.stop(L.warning("Dependencies installed with warnings")), s.log.warn(L.muted("You may need to run `pnpm install` manually to resolve issues.")));
|
|
4686
4719
|
let C = s.spinner();
|
|
4687
|
-
C.start("Initializing git repository..."), await
|
|
4720
|
+
C.start("Initializing git repository..."), await Oo(d), C.stop(L.success("Git repository initialized with clean history"));
|
|
4688
4721
|
let w = s.spinner();
|
|
4689
4722
|
w.start("Creating .env files from examples...");
|
|
4690
|
-
let E = await
|
|
4723
|
+
let E = await Co(d);
|
|
4691
4724
|
if (E.length > 0) {
|
|
4692
4725
|
let e = E.length;
|
|
4693
4726
|
w.stop(L.success(`Created ${e} .env file${e === 1 ? "" : "s"} from examples`));
|
|
4694
4727
|
} else w.stop(L.muted("No .env.example files to copy"));
|
|
4695
4728
|
s.log.success(`${L.brandBold("Hype Stack")} project ${L.highlight(c)} is ready!`);
|
|
4696
|
-
let D = T.relative(process.cwd(), d) || ".", O = [
|
|
4697
|
-
E.length > 0 ? O.push(`Review your ${L.path(".env")} files and fill in any secrets`) : O.push(`Copy ${L.path(".env.example")} to ${L.path(".env")} and configure`), Te(O);
|
|
4729
|
+
let D = T.relative(process.cwd(), d) || ".", O = [{ command: L.command(`cd ${D}`) }];
|
|
4730
|
+
E.length > 0 ? O.push({ command: `Review your ${L.path(".env")} files and fill in any secrets` }) : O.push({ command: `Copy ${L.path(".env.example")} to ${L.path(".env")} and configure` }), Te(O);
|
|
4698
4731
|
let k = e.setup === !1;
|
|
4699
4732
|
if (e.deferSetup) s.log.info(L.muted("Docker and migrations will run after your packs are installed."));
|
|
4700
4733
|
else {
|
|
@@ -4702,15 +4735,15 @@ async function as(e) {
|
|
|
4702
4735
|
message: "Would you like to start Docker services and run database migrations now?",
|
|
4703
4736
|
initialValue: !0
|
|
4704
4737
|
}));
|
|
4705
|
-
s.isCancel(e) && B(), e ? await
|
|
4738
|
+
s.isCancel(e) && B(), e ? await Ea(d, o) : s.log.info(L.muted("Docker and migrations can run later via `npx @hype-stack/cli onboard`.")), es();
|
|
4706
4739
|
}
|
|
4707
|
-
return await
|
|
4740
|
+
return await Wo("project_create"), s.outro(L.muted("Happy building!")), d;
|
|
4708
4741
|
}
|
|
4709
4742
|
//#endregion
|
|
4710
4743
|
//#region src/commands/init.ts
|
|
4711
|
-
async function
|
|
4744
|
+
async function ps(e) {
|
|
4712
4745
|
let t = e.cwd ?? process.cwd(), n = e.silent ?? !1;
|
|
4713
|
-
if (n || (
|
|
4746
|
+
if (n || (Ka(), s.intro(L.brandBold("Initialize Hype Stack configuration"))), !await Lr(t)) {
|
|
4714
4747
|
s.log.error(`This doesn't look like a Hype Stack project. ${L.muted("Expected apps/ directory and package.json")}`), s.outro(L.muted(`Run ${L.command("npx @hype-stack/cli create")} to scaffold a new project.`));
|
|
4715
4748
|
return;
|
|
4716
4749
|
}
|
|
@@ -4747,26 +4780,27 @@ async function os(e) {
|
|
|
4747
4780
|
message: "Project name for stack.json?",
|
|
4748
4781
|
placeholder: i,
|
|
4749
4782
|
initialValue: i,
|
|
4750
|
-
validate: (e) =>
|
|
4783
|
+
validate: (e) => Za(e ?? "")
|
|
4751
4784
|
});
|
|
4752
|
-
s.isCancel(e) && B(), a =
|
|
4785
|
+
s.isCancel(e) && B(), a = Ya(e);
|
|
4753
4786
|
}
|
|
4754
4787
|
await Nr(t, Ir(a, r)), n || (s.log.success(`${L.path("stack.json")} written successfully`), s.outro(L.muted("Your project is mapped and ready for Hype Stack CLI commands.")));
|
|
4755
4788
|
}
|
|
4756
|
-
async function
|
|
4789
|
+
async function ms(e, t = {}, n) {
|
|
4757
4790
|
if (await Mr(e)) return {
|
|
4758
4791
|
projectRoot: e,
|
|
4759
4792
|
scaffolded: !1
|
|
4760
4793
|
};
|
|
4761
|
-
let r = t.runInit ?? ((e) =>
|
|
4794
|
+
let r = t.runInit ?? ((e) => ps({
|
|
4762
4795
|
cwd: e,
|
|
4763
4796
|
silent: !0
|
|
4764
|
-
})), i = t.runCreate ?? ((e, t) =>
|
|
4797
|
+
})), i = t.runCreate ?? ((e, t) => fs({
|
|
4765
4798
|
parentDirectory: e,
|
|
4766
4799
|
deferSetup: !0,
|
|
4767
4800
|
skipBanner: !0,
|
|
4768
4801
|
defaultTheme: t?.defaultTheme,
|
|
4769
|
-
defaultMode: t?.defaultMode
|
|
4802
|
+
defaultMode: t?.defaultMode,
|
|
4803
|
+
radius: t?.radius
|
|
4770
4804
|
}));
|
|
4771
4805
|
if (await Lr(e)) {
|
|
4772
4806
|
s.log.warn(`No ${L.path("stack.json")} found in ${L.path(e)}.`);
|
|
@@ -4801,10 +4835,10 @@ async function ss(e, t = {}, n) {
|
|
|
4801
4835
|
}
|
|
4802
4836
|
//#endregion
|
|
4803
4837
|
//#region src/commands/compose.ts
|
|
4804
|
-
async function
|
|
4838
|
+
async function hs(e = {}) {
|
|
4805
4839
|
let t = e.cwd ?? process.cwd();
|
|
4806
|
-
|
|
4807
|
-
let n = await
|
|
4840
|
+
Ga();
|
|
4841
|
+
let n = await ms(t), r = n?.projectRoot ?? null, i = n?.scaffolded ?? !1, a;
|
|
4808
4842
|
try {
|
|
4809
4843
|
a = await jr(r ?? t);
|
|
4810
4844
|
} catch (e) {
|
|
@@ -4822,13 +4856,13 @@ async function cs(e = {}) {
|
|
|
4822
4856
|
c.stop("Failed to load packs"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${$(e)}`), process.exit(1);
|
|
4823
4857
|
}
|
|
4824
4858
|
c.stop("Packs loaded");
|
|
4825
|
-
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 Xn(F()))?.token ?? null, h = await
|
|
4859
|
+
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 Xn(F()))?.token ?? null, h = await Jo(l, d, {
|
|
4826
4860
|
token: m,
|
|
4827
4861
|
key: p
|
|
4828
4862
|
}), g = (e) => {
|
|
4829
4863
|
let t = f.get(e);
|
|
4830
4864
|
return !t || t.tier === "free" ? "free" : h[e]?.owned ? "owned" : "locked";
|
|
4831
|
-
}, _ = (e) => !d.has(e) && g(e) === "locked", v = await
|
|
4865
|
+
}, _ = (e) => !d.has(e) && g(e) === "locked", v = await gs({
|
|
4832
4866
|
packs: l,
|
|
4833
4867
|
installedSet: d,
|
|
4834
4868
|
stateOf: g,
|
|
@@ -4839,9 +4873,9 @@ async function cs(e = {}) {
|
|
|
4839
4873
|
s.outro(L.muted("No packs selected. Nothing to do."));
|
|
4840
4874
|
return;
|
|
4841
4875
|
}
|
|
4842
|
-
let b =
|
|
4876
|
+
let b = ys(v), x = bs(v), S = Fa(l, b), C = Oa(Ia(l, S)), w;
|
|
4843
4877
|
try {
|
|
4844
|
-
w =
|
|
4878
|
+
w = Aa(b, C, u);
|
|
4845
4879
|
} catch (e) {
|
|
4846
4880
|
s.cancel($(e)), process.exit(1);
|
|
4847
4881
|
}
|
|
@@ -4849,7 +4883,7 @@ async function cs(e = {}) {
|
|
|
4849
4883
|
z(`${w.alreadyInstalled.join(", ")} already installed.`, "Nothing to do"), s.outro(L.muted("Your selection is already part of the project."));
|
|
4850
4884
|
return;
|
|
4851
4885
|
}
|
|
4852
|
-
let T =
|
|
4886
|
+
let T = ja({
|
|
4853
4887
|
order: w.order,
|
|
4854
4888
|
graph: C,
|
|
4855
4889
|
isLocked: _,
|
|
@@ -4857,28 +4891,28 @@ async function cs(e = {}) {
|
|
|
4857
4891
|
});
|
|
4858
4892
|
if (T.blocked.length > 0 && !m && !p) {
|
|
4859
4893
|
let e = await or();
|
|
4860
|
-
e && (m = e, h = await
|
|
4894
|
+
e && (m = e, h = await Jo(l, d, {
|
|
4861
4895
|
token: m,
|
|
4862
4896
|
key: p
|
|
4863
|
-
}), T =
|
|
4897
|
+
}), T = ja({
|
|
4864
4898
|
order: w.order,
|
|
4865
4899
|
graph: C,
|
|
4866
4900
|
isLocked: _,
|
|
4867
4901
|
installed: u
|
|
4868
4902
|
}));
|
|
4869
4903
|
}
|
|
4870
|
-
if (T.blocked.length > 0 && await
|
|
4904
|
+
if (T.blocked.length > 0 && await Xo(T.blocked, _, f), T.installable.length === 0) {
|
|
4871
4905
|
s.outro(L.muted("Nothing left to install once locked packs are removed."));
|
|
4872
4906
|
return;
|
|
4873
4907
|
}
|
|
4874
|
-
if (
|
|
4908
|
+
if (Zo(T.installable, f), !e.yes) {
|
|
4875
4909
|
let e = await s.confirm({ message: `Install ${T.installable.length} pack${T.installable.length === 1 ? "" : "s"}?` });
|
|
4876
4910
|
(s.isCancel(e) || !e) && (s.cancel("Installation cancelled."), process.exit(0));
|
|
4877
4911
|
}
|
|
4878
4912
|
c.start("Downloading packs...");
|
|
4879
4913
|
let E;
|
|
4880
4914
|
try {
|
|
4881
|
-
E = await
|
|
4915
|
+
E = await Qo(T.installable, {
|
|
4882
4916
|
token: m,
|
|
4883
4917
|
key: p
|
|
4884
4918
|
});
|
|
@@ -4886,7 +4920,7 @@ async function cs(e = {}) {
|
|
|
4886
4920
|
c.stop("Download failed"), s.cancel($(e)), process.exit(1);
|
|
4887
4921
|
}
|
|
4888
4922
|
c.stop(`Downloaded ${E.length} pack${E.length === 1 ? "" : "s"}`);
|
|
4889
|
-
let D = await
|
|
4923
|
+
let D = await ns({
|
|
4890
4924
|
prepared: E,
|
|
4891
4925
|
config: a,
|
|
4892
4926
|
cwd: o,
|
|
@@ -4896,7 +4930,7 @@ async function cs(e = {}) {
|
|
|
4896
4930
|
});
|
|
4897
4931
|
try {
|
|
4898
4932
|
c.start("Installing pack files...");
|
|
4899
|
-
let t = await
|
|
4933
|
+
let t = await aa({
|
|
4900
4934
|
packs: E,
|
|
4901
4935
|
config: a,
|
|
4902
4936
|
projectRoot: o,
|
|
@@ -4909,22 +4943,22 @@ async function cs(e = {}) {
|
|
|
4909
4943
|
for (let e of t.errors) s.log.error(e);
|
|
4910
4944
|
s.cancel("No files were written. Fix the errors above (or pass --force for existing files) and try again."), process.exit(1);
|
|
4911
4945
|
}
|
|
4912
|
-
c.stop("Files installed"), t.installed.length > 0 && s.log.success(`${L.highlight(String(t.installed.length))} files installed`), t.skipped.length > 0 && (s.log.warning(`${t.skipped.length} files skipped (use --force to overwrite)`),
|
|
4946
|
+
c.stop("Files installed"), t.installed.length > 0 && s.log.success(`${L.highlight(String(t.installed.length))} files installed`), t.skipped.length > 0 && (s.log.warning(`${t.skipped.length} files skipped (use --force to overwrite)`), ts(t.skipped));
|
|
4913
4947
|
for (let e of t.errors) s.log.error(e);
|
|
4914
|
-
await
|
|
4948
|
+
await $o({
|
|
4915
4949
|
prepared: E,
|
|
4916
4950
|
paths: a.paths,
|
|
4917
4951
|
cwd: o,
|
|
4918
4952
|
spinner: c
|
|
4919
4953
|
});
|
|
4920
4954
|
let n;
|
|
4921
|
-
i && (n = await
|
|
4955
|
+
i && (n = await Da(o, e.yes ?? !1)), await _r({
|
|
4922
4956
|
projectRoot: o,
|
|
4923
4957
|
paths: a.paths,
|
|
4924
4958
|
skipPrompts: e.yes ?? !1,
|
|
4925
4959
|
dbReady: n,
|
|
4926
4960
|
freshScaffold: i
|
|
4927
|
-
}),
|
|
4961
|
+
}), es(), s.outro(L.brand(`Installed ${t.appliedPacks.join(", ")}.`));
|
|
4928
4962
|
} finally {
|
|
4929
4963
|
await Promise.all(E.map((e) => y.rm(e.packDir, {
|
|
4930
4964
|
recursive: !0,
|
|
@@ -4932,10 +4966,10 @@ async function cs(e = {}) {
|
|
|
4932
4966
|
})));
|
|
4933
4967
|
}
|
|
4934
4968
|
}
|
|
4935
|
-
async function
|
|
4969
|
+
async function gs(e) {
|
|
4936
4970
|
let { packs: t, installedSet: n, stateOf: r, options: i, adminAvailable: a } = e;
|
|
4937
4971
|
if (i.packs && i.packs.length > 0) {
|
|
4938
|
-
let e = i.packs.map(
|
|
4972
|
+
let e = i.packs.map(vs), n = e.filter((e) => !t.some((t) => t.name === e.name));
|
|
4939
4973
|
return n.length > 0 && (s.cancel(`Unknown pack${n.length === 1 ? "" : "s"}: ${n.map((e) => e.name).join(", ")}`), process.exit(1)), e;
|
|
4940
4974
|
}
|
|
4941
4975
|
let o = t.filter((e) => n.has(e.name));
|
|
@@ -4944,13 +4978,13 @@ async function ls(e) {
|
|
|
4944
4978
|
if (c.length === 0) return s.outro(L.muted("Every available pack is already installed.")), [];
|
|
4945
4979
|
let l = le();
|
|
4946
4980
|
z(c.map((e) => ` ${R.arrow} ${L.highlight(e.displayName)} ${ve(`${l}/packs/${e.name}`)}`).join("\n"), "Browse packs");
|
|
4947
|
-
let u =
|
|
4981
|
+
let u = pa(c, { adminAvailable: a }), d = [];
|
|
4948
4982
|
for (let e of u) {
|
|
4949
4983
|
let t = e.packs.map((e) => {
|
|
4950
4984
|
let t = r(e.name);
|
|
4951
4985
|
return {
|
|
4952
4986
|
value: e.name,
|
|
4953
|
-
label: `${e.displayName} ${
|
|
4987
|
+
label: `${e.displayName} ${Yo(t, e.price)}`,
|
|
4954
4988
|
hint: e.description
|
|
4955
4989
|
};
|
|
4956
4990
|
});
|
|
@@ -4967,7 +5001,7 @@ async function ls(e) {
|
|
|
4967
5001
|
});
|
|
4968
5002
|
continue;
|
|
4969
5003
|
}
|
|
4970
|
-
let n = await
|
|
5004
|
+
let n = await Ja({
|
|
4971
5005
|
message: `Select ${e.label.toLowerCase()} to add (optional)`,
|
|
4972
5006
|
options: t,
|
|
4973
5007
|
required: !1
|
|
@@ -4977,20 +5011,20 @@ async function ls(e) {
|
|
|
4977
5011
|
}
|
|
4978
5012
|
return d;
|
|
4979
5013
|
}
|
|
4980
|
-
var
|
|
4981
|
-
function
|
|
4982
|
-
let t = e.match(
|
|
5014
|
+
var _s = /@(frontend|admin)$/;
|
|
5015
|
+
function vs(e) {
|
|
5016
|
+
let t = e.match(_s);
|
|
4983
5017
|
return t ? {
|
|
4984
5018
|
name: e.slice(0, -t[0].length),
|
|
4985
5019
|
slot: t[1]
|
|
4986
5020
|
} : { name: e };
|
|
4987
5021
|
}
|
|
4988
|
-
function
|
|
5022
|
+
function ys(e) {
|
|
4989
5023
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
4990
5024
|
for (let r of e) t.has(r.name) || (t.add(r.name), n.push(r.name));
|
|
4991
5025
|
return n;
|
|
4992
5026
|
}
|
|
4993
|
-
function
|
|
5027
|
+
function bs(e) {
|
|
4994
5028
|
let t = /* @__PURE__ */ new Map();
|
|
4995
5029
|
for (let n of e) {
|
|
4996
5030
|
if (!n.slot) continue;
|
|
@@ -5001,8 +5035,8 @@ function ps(e) {
|
|
|
5001
5035
|
}
|
|
5002
5036
|
//#endregion
|
|
5003
5037
|
//#region src/commands/login.ts
|
|
5004
|
-
async function
|
|
5005
|
-
|
|
5038
|
+
async function xs() {
|
|
5039
|
+
Ka(), s.intro(L.brandBold("Log in to Hype Stack")), s.log.step("Opening your browser to sign in...");
|
|
5006
5040
|
let e;
|
|
5007
5041
|
try {
|
|
5008
5042
|
e = await ar({ onUrl: (e) => {
|
|
@@ -5015,8 +5049,8 @@ async function ms() {
|
|
|
5015
5049
|
}
|
|
5016
5050
|
//#endregion
|
|
5017
5051
|
//#region src/commands/logout.ts
|
|
5018
|
-
async function
|
|
5019
|
-
|
|
5052
|
+
async function Ss() {
|
|
5053
|
+
Ka(), s.intro(L.brandBold("Log out of Hype Stack"));
|
|
5020
5054
|
let e = F(), t = await Xn(e);
|
|
5021
5055
|
if (!t) {
|
|
5022
5056
|
s.outro(L.muted("You're not logged in."));
|
|
@@ -5026,7 +5060,7 @@ async function hs() {
|
|
|
5026
5060
|
}
|
|
5027
5061
|
//#endregion
|
|
5028
5062
|
//#region src/core/onboard-env.ts
|
|
5029
|
-
function
|
|
5063
|
+
function Cs(e) {
|
|
5030
5064
|
let t = [], n = "";
|
|
5031
5065
|
for (let r of e.split(/\r?\n/)) {
|
|
5032
5066
|
let e = r.trim();
|
|
@@ -5052,14 +5086,14 @@ function gs(e) {
|
|
|
5052
5086
|
}
|
|
5053
5087
|
return t;
|
|
5054
5088
|
}
|
|
5055
|
-
function
|
|
5089
|
+
function ws(e) {
|
|
5056
5090
|
let t = e.trim();
|
|
5057
5091
|
if (t === "") return "";
|
|
5058
5092
|
if (t.length <= 4) return "•".repeat(t.length);
|
|
5059
5093
|
let n = Math.min(t.length - 4, 8);
|
|
5060
5094
|
return `${"•".repeat(n)}${t.slice(-4)}`;
|
|
5061
5095
|
}
|
|
5062
|
-
function
|
|
5096
|
+
function Ts(e, t, n) {
|
|
5063
5097
|
let r = e.split(/\r?\n/), i = !1, a = r.map((e) => {
|
|
5064
5098
|
if (i) return e;
|
|
5065
5099
|
let r = e.trim();
|
|
@@ -5069,22 +5103,22 @@ function vs(e, t, n) {
|
|
|
5069
5103
|
});
|
|
5070
5104
|
return i ? a.join("\n") : e + `${e.length > 0 && !e.endsWith("\n") ? "\n" : ""}${t}=${n}\n`;
|
|
5071
5105
|
}
|
|
5072
|
-
async function
|
|
5106
|
+
async function Es(e) {
|
|
5073
5107
|
return await Y(e) ? y.readFile(e, "utf-8") : "";
|
|
5074
5108
|
}
|
|
5075
|
-
async function
|
|
5109
|
+
async function Ds(e) {
|
|
5076
5110
|
let t = T.join(T.dirname(e), ".env");
|
|
5077
5111
|
return await Y(t) || await y.copyFile(e, t), t;
|
|
5078
5112
|
}
|
|
5079
|
-
async function
|
|
5080
|
-
let r =
|
|
5113
|
+
async function Os(e, t, n) {
|
|
5114
|
+
let r = Ts(await Es(e), t, n);
|
|
5081
5115
|
await y.writeFile(e, r, "utf-8");
|
|
5082
5116
|
}
|
|
5083
5117
|
//#endregion
|
|
5084
5118
|
//#region src/commands/onboard.ts
|
|
5085
|
-
async function
|
|
5119
|
+
async function ks(e = {}) {
|
|
5086
5120
|
let t = e.cwd ?? process.cwd();
|
|
5087
|
-
|
|
5121
|
+
Ga(), s.intro(L.brandBold("Onboard your stack"));
|
|
5088
5122
|
let n;
|
|
5089
5123
|
try {
|
|
5090
5124
|
n = await jr(t);
|
|
@@ -5092,19 +5126,19 @@ async function Ss(e = {}) {
|
|
|
5092
5126
|
n = null;
|
|
5093
5127
|
}
|
|
5094
5128
|
n || (s.cancel(`${L.path("stack.json")} not found. Run ${L.command("npx @hype-stack/cli init")} first.`), process.exit(1));
|
|
5095
|
-
let r = n.installedPacks ?? [], i = n.onboarding?.envSections ?? [], a = await
|
|
5129
|
+
let r = n.installedPacks ?? [], i = n.onboarding?.envSections ?? [], a = await wo(t);
|
|
5096
5130
|
a.length === 0 && s.log.warn(L.muted("No .env.example files found; skipping env setup."));
|
|
5097
|
-
for (let n of a) await
|
|
5131
|
+
for (let n of a) await As({
|
|
5098
5132
|
examplePath: n,
|
|
5099
5133
|
projectRoot: t,
|
|
5100
5134
|
skipPrompts: e.yes ?? !1,
|
|
5101
5135
|
installedEnvSections: i
|
|
5102
5136
|
});
|
|
5103
5137
|
let o = Ar(r);
|
|
5104
|
-
o.length > 0 && z(o.map((e) => ` ${L.muted("·")} ${e}`).join("\n"), "Tips"), e.skipMigrations || await
|
|
5138
|
+
o.length > 0 && z(o.map((e) => ` ${L.muted("·")} ${e}`).join("\n"), "Tips"), e.skipMigrations || await Ns(t, e.yes ?? !1), s.outro(L.brand(`All set. Run ${L.command("pnpm dev")} to start your app.`));
|
|
5105
5139
|
}
|
|
5106
|
-
async function
|
|
5107
|
-
let { examplePath: t, projectRoot: n, skipPrompts: r, installedEnvSections: i } = e, a = T.relative(n, t) || t, o = await
|
|
5140
|
+
async function As(e) {
|
|
5141
|
+
let { examplePath: t, projectRoot: n, skipPrompts: r, installedEnvSections: i } = e, a = T.relative(n, t) || t, o = await Ds(t), c = await Es(o), l = Cs(await y.readFile(t, "utf-8")), u = L.path(a);
|
|
5108
5142
|
s.log.step(`Env: ${u}`);
|
|
5109
5143
|
for (let e of l) {
|
|
5110
5144
|
if (e.vars.length === 0) continue;
|
|
@@ -5120,7 +5154,7 @@ async function Cs(e) {
|
|
|
5120
5154
|
s.log.info(`${L.label(n.key)} ${L.muted("skipped (non-interactive)")}`);
|
|
5121
5155
|
continue;
|
|
5122
5156
|
}
|
|
5123
|
-
let e =
|
|
5157
|
+
let e = ws(js(c, n.key)), i = await s.text({
|
|
5124
5158
|
message: `${L.label(n.key)}`,
|
|
5125
5159
|
placeholder: e ? `${e} ${L.muted("(Enter keeps this)")}` : t.hint
|
|
5126
5160
|
});
|
|
@@ -5130,31 +5164,31 @@ async function Cs(e) {
|
|
|
5130
5164
|
s.log.info(L.muted(`${n.key} unchanged.`));
|
|
5131
5165
|
continue;
|
|
5132
5166
|
}
|
|
5133
|
-
await
|
|
5167
|
+
await Os(o, n.key, a), s.log.success(`${n.key} saved`);
|
|
5134
5168
|
}
|
|
5135
5169
|
}
|
|
5136
5170
|
}
|
|
5137
|
-
function
|
|
5171
|
+
function js(e, t) {
|
|
5138
5172
|
for (let n of e.split(/\r?\n/)) {
|
|
5139
|
-
let e = n.match(RegExp(`^${
|
|
5173
|
+
let e = n.match(RegExp(`^${Ms(t)}\\s*=\\s*(.*)$`));
|
|
5140
5174
|
if (e) return e[1].trim();
|
|
5141
5175
|
}
|
|
5142
5176
|
return "";
|
|
5143
5177
|
}
|
|
5144
|
-
function
|
|
5178
|
+
function Ms(e) {
|
|
5145
5179
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5146
5180
|
}
|
|
5147
|
-
async function
|
|
5148
|
-
if (!await
|
|
5181
|
+
async function Ns(e, t) {
|
|
5182
|
+
if (!await ga() && !await va(e, t, !1)) {
|
|
5149
5183
|
s.log.info(L.muted(`Start services later with ${L.command("docker compose up -d")} (in apps/backend), then ${L.command("pnpm --filter @internal/backend migration:latest")}.`));
|
|
5150
5184
|
return;
|
|
5151
5185
|
}
|
|
5152
5186
|
let n = s.spinner();
|
|
5153
|
-
if (n.start("Waiting for Postgres to be ready..."), !await
|
|
5187
|
+
if (n.start("Waiting for Postgres to be ready..."), !await ba(e)) {
|
|
5154
5188
|
n.error("Postgres health check timed out"), s.log.warn(L.muted(`Run migrations manually once Postgres is ready: ${L.command("pnpm --filter @internal/backend migration:latest")}`));
|
|
5155
5189
|
return;
|
|
5156
5190
|
}
|
|
5157
|
-
if (n.stop(L.success("Postgres is ready")), await
|
|
5191
|
+
if (n.stop(L.success("Postgres is ready")), await Sa(e)) {
|
|
5158
5192
|
s.log.info(L.muted("Migrations already applied, skipping."));
|
|
5159
5193
|
return;
|
|
5160
5194
|
}
|
|
@@ -5166,20 +5200,20 @@ async function Es(e, t) {
|
|
|
5166
5200
|
s.log.info(L.muted("Skipping database migrations."));
|
|
5167
5201
|
return;
|
|
5168
5202
|
}
|
|
5169
|
-
await
|
|
5203
|
+
await Ca(e);
|
|
5170
5204
|
}
|
|
5171
5205
|
//#endregion
|
|
5172
5206
|
//#region src/core/templates.ts
|
|
5173
|
-
var
|
|
5207
|
+
var Ps = q.createRequest()({
|
|
5174
5208
|
endpoint: "/templates/list",
|
|
5175
5209
|
method: "GET"
|
|
5176
5210
|
});
|
|
5177
|
-
async function
|
|
5178
|
-
let { data: e, error: t } = await
|
|
5211
|
+
async function Fs() {
|
|
5212
|
+
let { data: e, error: t } = await Ps.send();
|
|
5179
5213
|
if (t || !e) throw Error(`Failed to fetch template list: ${String(t)}`);
|
|
5180
5214
|
return e.templates;
|
|
5181
5215
|
}
|
|
5182
|
-
async function
|
|
5216
|
+
async function Is(e) {
|
|
5183
5217
|
let { data: t, error: n, status: r } = await q.createRequest()({
|
|
5184
5218
|
endpoint: `/templates/${encodeURIComponent(e)}/manifest`,
|
|
5185
5219
|
method: "GET"
|
|
@@ -5188,7 +5222,7 @@ async function ks(e) {
|
|
|
5188
5222
|
if (n || !t) throw Error(`Failed to load manifest for template "${e}": ${String(n)}`);
|
|
5189
5223
|
return t;
|
|
5190
5224
|
}
|
|
5191
|
-
async function
|
|
5225
|
+
async function Ls(e, t = {}) {
|
|
5192
5226
|
let n = q.createRequest()({
|
|
5193
5227
|
endpoint: `/templates/${encodeURIComponent(e)}/download`,
|
|
5194
5228
|
method: "POST"
|
|
@@ -5216,9 +5250,9 @@ async function As(e, t = {}) {
|
|
|
5216
5250
|
}
|
|
5217
5251
|
//#endregion
|
|
5218
5252
|
//#region src/commands/template.ts
|
|
5219
|
-
async function
|
|
5253
|
+
async function Rs(t = {}) {
|
|
5220
5254
|
let n = t.cwd ?? process.cwd();
|
|
5221
|
-
|
|
5255
|
+
Ga();
|
|
5222
5256
|
let r = s.spinner();
|
|
5223
5257
|
r.start("Loading packs...");
|
|
5224
5258
|
let o;
|
|
@@ -5230,7 +5264,7 @@ async function js(t = {}) {
|
|
|
5230
5264
|
r.stop("Packs loaded"), r.start("Loading templates...");
|
|
5231
5265
|
let c;
|
|
5232
5266
|
try {
|
|
5233
|
-
c = await
|
|
5267
|
+
c = await Fs();
|
|
5234
5268
|
} catch (e) {
|
|
5235
5269
|
r.stop("Failed to load templates"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${$(e)}`), process.exit(1);
|
|
5236
5270
|
}
|
|
@@ -5253,13 +5287,14 @@ async function js(t = {}) {
|
|
|
5253
5287
|
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}`);
|
|
5254
5288
|
let d;
|
|
5255
5289
|
try {
|
|
5256
|
-
d = await
|
|
5290
|
+
d = await Is(u.id);
|
|
5257
5291
|
} catch (e) {
|
|
5258
5292
|
s.cancel($(e)), process.exit(1);
|
|
5259
5293
|
}
|
|
5260
|
-
let f = await
|
|
5294
|
+
let f = await ms(n, {}, {
|
|
5261
5295
|
defaultTheme: d.theme,
|
|
5262
|
-
defaultMode: d.defaultMode
|
|
5296
|
+
defaultMode: d.defaultMode,
|
|
5297
|
+
radius: d.radius
|
|
5263
5298
|
}), p = f?.projectRoot ?? null, m = f?.scaffolded ?? !1, h;
|
|
5264
5299
|
try {
|
|
5265
5300
|
h = await jr(p ?? n);
|
|
@@ -5269,16 +5304,16 @@ async function js(t = {}) {
|
|
|
5269
5304
|
h || (s.cancel(p ? `Could not read ${L.path("stack.json")}. Run 'npx @hype-stack/cli init' to regenerate it, then run 'npx @hype-stack/cli template' again.` : `No ${L.path("stack.json")}. Run 'npx @hype-stack/cli init' first, then 'npx @hype-stack/cli template'.`), process.exit(1)), h.paths || (s.cancel(`${L.path("stack.json")} is missing ${L.path("paths")}. Run 'npx @hype-stack/cli init' again to regenerate it.`), process.exit(1));
|
|
5270
5305
|
let g = p ?? n;
|
|
5271
5306
|
s.intro(L.brandBold("Install a template"));
|
|
5272
|
-
let _ = h.installedPacks ?? [], v = new Set(_), b = new Map(o.map((e) => [e.name, e])), x = t.licenseKey ?? h.licenseKey ?? null, S = (await Xn(F()))?.token ?? null, C = await
|
|
5307
|
+
let _ = h.installedPacks ?? [], v = new Set(_), b = new Map(o.map((e) => [e.name, e])), x = t.licenseKey ?? h.licenseKey ?? null, S = (await Xn(F()))?.token ?? null, C = await zs(u, t.variants, t.yes ?? !1), w = Ma(u.slots, C), E = Na(u.slots, u.packs, w), D = await Bs({
|
|
5273
5308
|
packs: o,
|
|
5274
5309
|
templatePacks: E,
|
|
5275
5310
|
installedSet: v,
|
|
5276
5311
|
options: t
|
|
5277
5312
|
}), O = [...E, ...D.filter((e) => !E.includes(e))], k = O.filter((e) => !b.has(e));
|
|
5278
5313
|
k.length > 0 && (s.cancel(`Unknown pack${k.length === 1 ? "" : "s"}: ${k.join(", ")}`), process.exit(1));
|
|
5279
|
-
let ee =
|
|
5314
|
+
let ee = Ia(o, w), A = Oa(ee), te;
|
|
5280
5315
|
try {
|
|
5281
|
-
te =
|
|
5316
|
+
te = Aa(O, A, _);
|
|
5282
5317
|
} catch (e) {
|
|
5283
5318
|
s.cancel($(e)), process.exit(1);
|
|
5284
5319
|
}
|
|
@@ -5286,13 +5321,13 @@ async function js(t = {}) {
|
|
|
5286
5321
|
s.outro(L.muted("Every pack in this template is already installed."));
|
|
5287
5322
|
return;
|
|
5288
5323
|
}
|
|
5289
|
-
let ne = await
|
|
5324
|
+
let ne = await Jo(ee, v, {
|
|
5290
5325
|
token: S,
|
|
5291
5326
|
key: x
|
|
5292
5327
|
}), re = (e) => {
|
|
5293
5328
|
let t = b.get(e);
|
|
5294
5329
|
return !t || t.tier === "free" ? "free" : ne[e]?.owned ? "owned" : "locked";
|
|
5295
|
-
}, j = (e) => !v.has(e) && re(e) === "locked", M =
|
|
5330
|
+
}, j = (e) => !v.has(e) && re(e) === "locked", M = ja({
|
|
5296
5331
|
order: te.order,
|
|
5297
5332
|
graph: A,
|
|
5298
5333
|
isLocked: j,
|
|
@@ -5300,28 +5335,28 @@ async function js(t = {}) {
|
|
|
5300
5335
|
});
|
|
5301
5336
|
if (M.blocked.length > 0 && !S && !x) {
|
|
5302
5337
|
let e = await or();
|
|
5303
|
-
e && (S = e, ne = await
|
|
5338
|
+
e && (S = e, ne = await Jo(ee, v, {
|
|
5304
5339
|
token: S,
|
|
5305
5340
|
key: x
|
|
5306
|
-
}), M =
|
|
5341
|
+
}), M = ja({
|
|
5307
5342
|
order: te.order,
|
|
5308
5343
|
graph: A,
|
|
5309
5344
|
isLocked: j,
|
|
5310
5345
|
installed: _
|
|
5311
5346
|
}));
|
|
5312
5347
|
}
|
|
5313
|
-
if (M.blocked.length > 0 && await
|
|
5348
|
+
if (M.blocked.length > 0 && await Xo(M.blocked, j, b), M.installable.length === 0) {
|
|
5314
5349
|
s.outro(L.muted("Nothing left to install once locked packs are removed."));
|
|
5315
5350
|
return;
|
|
5316
5351
|
}
|
|
5317
|
-
if (
|
|
5352
|
+
if (Zo(M.installable, b), !t.yes) {
|
|
5318
5353
|
let e = await s.confirm({ message: `Install template ${L.brandBold(u.name)} (${M.installable.length} pack${M.installable.length === 1 ? "" : "s"})?` });
|
|
5319
5354
|
(s.isCancel(e) || !e) && (s.cancel("Installation cancelled."), process.exit(0));
|
|
5320
5355
|
}
|
|
5321
5356
|
r.start("Downloading packs...");
|
|
5322
5357
|
let N;
|
|
5323
5358
|
try {
|
|
5324
|
-
N = await
|
|
5359
|
+
N = await Qo(M.installable, {
|
|
5325
5360
|
token: S,
|
|
5326
5361
|
key: x
|
|
5327
5362
|
});
|
|
@@ -5329,7 +5364,7 @@ async function js(t = {}) {
|
|
|
5329
5364
|
r.stop("Download failed"), s.cancel($(e)), process.exit(1);
|
|
5330
5365
|
}
|
|
5331
5366
|
r.stop(`Downloaded ${N.length} pack${N.length === 1 ? "" : "s"}`);
|
|
5332
|
-
let ie = await
|
|
5367
|
+
let ie = await ns({
|
|
5333
5368
|
prepared: N,
|
|
5334
5369
|
config: h,
|
|
5335
5370
|
cwd: g,
|
|
@@ -5338,7 +5373,7 @@ async function js(t = {}) {
|
|
|
5338
5373
|
}), P = null;
|
|
5339
5374
|
try {
|
|
5340
5375
|
r.start("Installing pack files...");
|
|
5341
|
-
let n = await
|
|
5376
|
+
let n = await aa({
|
|
5342
5377
|
packs: N,
|
|
5343
5378
|
config: h,
|
|
5344
5379
|
projectRoot: g,
|
|
@@ -5350,15 +5385,15 @@ async function js(t = {}) {
|
|
|
5350
5385
|
for (let e of n.errors) s.log.error(e);
|
|
5351
5386
|
s.cancel("No files were written. Fix the errors above (or pass --force for existing files) and try again."), process.exit(1);
|
|
5352
5387
|
}
|
|
5353
|
-
r.stop("Files installed"), n.installed.length > 0 && s.log.success(`${L.highlight(String(n.installed.length))} files installed`), n.skipped.length > 0 && (s.log.warning(`${n.skipped.length} files skipped (use --force to overwrite)`),
|
|
5388
|
+
r.stop("Files installed"), n.installed.length > 0 && s.log.success(`${L.highlight(String(n.installed.length))} files installed`), n.skipped.length > 0 && (s.log.warning(`${n.skipped.length} files skipped (use --force to overwrite)`), ts(n.skipped));
|
|
5354
5389
|
for (let e of n.errors) s.log.error(e);
|
|
5355
5390
|
r.start("Applying template overrides...");
|
|
5356
|
-
let o = await
|
|
5391
|
+
let o = await Ls(u.id, {
|
|
5357
5392
|
token: S,
|
|
5358
5393
|
licenseKey: x
|
|
5359
5394
|
});
|
|
5360
5395
|
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)), P = o.templateDir;
|
|
5361
|
-
let c = await
|
|
5396
|
+
let c = await sa({
|
|
5362
5397
|
manifest: d,
|
|
5363
5398
|
config: h,
|
|
5364
5399
|
projectRoot: g,
|
|
@@ -5368,11 +5403,11 @@ async function js(t = {}) {
|
|
|
5368
5403
|
for (let e of c.errors) s.log.error(e);
|
|
5369
5404
|
if (!m) {
|
|
5370
5405
|
let t = T.resolve(g, h.paths?.frontend.root ?? "apps/frontend"), n = d.theme ?? "zinc-mono";
|
|
5371
|
-
a(n) && (await
|
|
5406
|
+
a(n) && (await po(t, i(n)) ? s.log.success(`Applied the ${i(n).label} theme`) : s.log.warning(L.muted(`Could not find ${L.path("assets/styles.css")} to apply the theme`))), d.radius !== void 0 && ro(d.radius) && (await oo(t, d.radius) ? s.log.success(`Set the corner radius to ${d.radius}`) : s.log.warning(L.muted(`Could not find ${L.path("assets/styles.css")} to set the corner radius`)));
|
|
5372
5407
|
let r = d.defaultMode === "dark" || d.defaultMode === "light" ? d.defaultMode : e;
|
|
5373
|
-
await
|
|
5408
|
+
await to(t, r) ? s.log.success(`Default color mode set to ${r}`) : s.log.warning(L.muted(`Could not find ${L.path("src/hooks/use-theme.ts")} to set the default color mode`));
|
|
5374
5409
|
}
|
|
5375
|
-
await
|
|
5410
|
+
await Vs({
|
|
5376
5411
|
prepared: N,
|
|
5377
5412
|
templateNpm: d.dependencies_npm,
|
|
5378
5413
|
paths: h.paths,
|
|
@@ -5380,13 +5415,13 @@ async function js(t = {}) {
|
|
|
5380
5415
|
spinner: r
|
|
5381
5416
|
});
|
|
5382
5417
|
let l;
|
|
5383
|
-
m && (l = await
|
|
5418
|
+
m && (l = await Da(g, t.yes ?? !1)), await _r({
|
|
5384
5419
|
projectRoot: g,
|
|
5385
5420
|
paths: h.paths,
|
|
5386
5421
|
skipPrompts: t.yes ?? !1,
|
|
5387
5422
|
dbReady: l,
|
|
5388
5423
|
freshScaffold: m
|
|
5389
|
-
}),
|
|
5424
|
+
}), es(), s.outro(L.brand(`Installed template ${u.name}.`));
|
|
5390
5425
|
} finally {
|
|
5391
5426
|
await Promise.all(N.map((e) => y.rm(e.packDir, {
|
|
5392
5427
|
recursive: !0,
|
|
@@ -5397,7 +5432,7 @@ async function js(t = {}) {
|
|
|
5397
5432
|
});
|
|
5398
5433
|
}
|
|
5399
5434
|
}
|
|
5400
|
-
async function
|
|
5435
|
+
async function zs(e, t, n) {
|
|
5401
5436
|
let r = {};
|
|
5402
5437
|
for (let i of e.slots) {
|
|
5403
5438
|
if (t?.[i.family]) {
|
|
@@ -5421,7 +5456,7 @@ async function Ms(e, t, n) {
|
|
|
5421
5456
|
}
|
|
5422
5457
|
return r;
|
|
5423
5458
|
}
|
|
5424
|
-
async function
|
|
5459
|
+
async function Bs(e) {
|
|
5425
5460
|
let { packs: t, templatePacks: n, installedSet: r, options: i } = e, a = new Set(n);
|
|
5426
5461
|
if (i.packs && i.packs.length > 0) {
|
|
5427
5462
|
let e = i.packs.filter((e) => !t.some((t) => t.name === e));
|
|
@@ -5432,7 +5467,7 @@ async function Ns(e) {
|
|
|
5432
5467
|
if (o.length === 0) return [];
|
|
5433
5468
|
let c = le();
|
|
5434
5469
|
z(o.map((e) => ` ${R.arrow} ${L.highlight(e.displayName)} ${ve(`${c}/packs/${e.name}`)}`).join("\n"), "Browse packs");
|
|
5435
|
-
let l = await
|
|
5470
|
+
let l = await Ja({
|
|
5436
5471
|
message: "Add extra packs on top of the template (optional)",
|
|
5437
5472
|
options: o.map((e) => ({
|
|
5438
5473
|
value: e.name,
|
|
@@ -5443,25 +5478,25 @@ async function Ns(e) {
|
|
|
5443
5478
|
});
|
|
5444
5479
|
return m(l) && (s.cancel("Cancelled."), process.exit(0)), l;
|
|
5445
5480
|
}
|
|
5446
|
-
async function
|
|
5447
|
-
let { prepared: t, templateNpm: n, paths: r, cwd: i, spinner: a } = e, o =
|
|
5481
|
+
async function Vs(e) {
|
|
5482
|
+
let { prepared: t, templateNpm: n, paths: r, cwd: i, spinner: a } = e, o = Ko(t.map((e) => e.manifest.dependencies_npm)), c = Go(n ? Ko([o, n]) : o, r);
|
|
5448
5483
|
if (c.errors.length > 0) {
|
|
5449
5484
|
for (let e of c.errors) s.log.error(e);
|
|
5450
5485
|
return;
|
|
5451
5486
|
}
|
|
5452
5487
|
if (c.operations.length === 0) return;
|
|
5453
5488
|
a.start("Installing npm dependencies...");
|
|
5454
|
-
let l = await
|
|
5489
|
+
let l = await qo(c.operations, i);
|
|
5455
5490
|
if (a.stop(l.ok ? "npm dependencies installed" : "npm dependency installation failed"), !l.ok) for (let e of l.errors) s.log.error(e);
|
|
5456
5491
|
}
|
|
5457
5492
|
//#endregion
|
|
5458
5493
|
//#region src/cli.ts
|
|
5459
|
-
function
|
|
5494
|
+
function Hs(e) {
|
|
5460
5495
|
if (!e) return;
|
|
5461
5496
|
let t = e.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
|
|
5462
5497
|
return t.length > 0 ? t : void 0;
|
|
5463
5498
|
}
|
|
5464
|
-
function
|
|
5499
|
+
function Us(e) {
|
|
5465
5500
|
if (!e) return;
|
|
5466
5501
|
let t = {};
|
|
5467
5502
|
for (let n of e.split(",")) {
|
|
@@ -5470,10 +5505,10 @@ function Is(e) {
|
|
|
5470
5505
|
}
|
|
5471
5506
|
return Object.keys(t).length > 0 ? t : void 0;
|
|
5472
5507
|
}
|
|
5473
|
-
function
|
|
5508
|
+
function Ws() {
|
|
5474
5509
|
let e = new o();
|
|
5475
5510
|
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) => {
|
|
5476
|
-
await
|
|
5511
|
+
await fs({
|
|
5477
5512
|
name: e.name,
|
|
5478
5513
|
directory: e.directory,
|
|
5479
5514
|
install: e.install,
|
|
@@ -5483,38 +5518,38 @@ function Ls() {
|
|
|
5483
5518
|
setup: e.setup
|
|
5484
5519
|
});
|
|
5485
5520
|
}), e.command("init").description("Initialize stack.json in the current project").action(async () => {
|
|
5486
|
-
await
|
|
5521
|
+
await ps({});
|
|
5487
5522
|
}), 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) => {
|
|
5488
|
-
await
|
|
5523
|
+
await ks({
|
|
5489
5524
|
cwd: e.cwd,
|
|
5490
5525
|
yes: e.yes,
|
|
5491
5526
|
skipMigrations: e.skipMigrations
|
|
5492
5527
|
});
|
|
5493
5528
|
}), 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) => {
|
|
5494
|
-
await
|
|
5495
|
-
packs:
|
|
5529
|
+
await hs({
|
|
5530
|
+
packs: Hs(e.packs),
|
|
5496
5531
|
force: e.force,
|
|
5497
5532
|
yes: e.yes,
|
|
5498
5533
|
licenseKey: e.key ?? e.licenseKey,
|
|
5499
5534
|
cwd: e.cwd
|
|
5500
5535
|
});
|
|
5501
5536
|
}), 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) => {
|
|
5502
|
-
await
|
|
5537
|
+
await Rs({
|
|
5503
5538
|
templateId: e,
|
|
5504
|
-
variants:
|
|
5505
|
-
packs:
|
|
5539
|
+
variants: Us(t.variants),
|
|
5540
|
+
packs: Hs(t.packs),
|
|
5506
5541
|
force: t.force,
|
|
5507
5542
|
yes: t.yes,
|
|
5508
5543
|
licenseKey: t.key ?? t.licenseKey,
|
|
5509
5544
|
cwd: t.cwd
|
|
5510
5545
|
});
|
|
5511
5546
|
}), e.command("login").description("Log in via your browser to install packs your organization owns").action(async () => {
|
|
5512
|
-
await
|
|
5547
|
+
await xs();
|
|
5513
5548
|
}), e.command("logout").description("Log out and remove the saved CLI token").action(async () => {
|
|
5514
|
-
await
|
|
5549
|
+
await Ss();
|
|
5515
5550
|
}), e.command("auth").description("Alias for `login`").action(async () => {
|
|
5516
|
-
await
|
|
5551
|
+
await xs();
|
|
5517
5552
|
}), e;
|
|
5518
5553
|
}
|
|
5519
5554
|
//#endregion
|
|
5520
|
-
export {
|
|
5555
|
+
export { ms as a, hs as i, Ss as n, ps as o, xs as r, fs as s, Ws as t };
|