create-better-t-stack 3.2.8 → 3.2.10
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.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as router, i as init, n as createBtsCli, o as sponsors, r as docs, t as builder } from "./src-
|
|
2
|
+
import { a as router, i as init, n as createBtsCli, o as sponsors, r as docs, t as builder } from "./src-C8z72H-V.js";
|
|
3
3
|
|
|
4
4
|
export { builder, createBtsCli, docs, init, router, sponsors };
|
|
@@ -150,6 +150,7 @@ const dependencyVersionMap = {
|
|
|
150
150
|
dotenv: "^17.2.2",
|
|
151
151
|
tsdown: "^0.15.5",
|
|
152
152
|
zod: "^4.1.11",
|
|
153
|
+
srvx: "0.8.15",
|
|
153
154
|
"@polar-sh/better-auth": "^1.1.3",
|
|
154
155
|
"@polar-sh/sdk": "^0.34.16"
|
|
155
156
|
};
|
|
@@ -2032,53 +2033,19 @@ function getPackageExecutionCommand(packageManager, commandWithArgs) {
|
|
|
2032
2033
|
|
|
2033
2034
|
//#endregion
|
|
2034
2035
|
//#region src/helpers/addons/fumadocs-setup.ts
|
|
2035
|
-
const TEMPLATES = {
|
|
2036
|
-
"next-mdx": {
|
|
2037
|
-
label: "Next.js: Fumadocs MDX",
|
|
2038
|
-
hint: "Recommended template with MDX support",
|
|
2039
|
-
value: "+next+fuma-docs-mdx"
|
|
2040
|
-
},
|
|
2041
|
-
"next-content-collections": {
|
|
2042
|
-
label: "Next.js: Content Collections",
|
|
2043
|
-
hint: "Template using Next.js content collections",
|
|
2044
|
-
value: "+next+content-collections"
|
|
2045
|
-
},
|
|
2046
|
-
"react-router-mdx-remote": {
|
|
2047
|
-
label: "React Router: MDX Remote",
|
|
2048
|
-
hint: "Template for React Router with MDX remote",
|
|
2049
|
-
value: "react-router"
|
|
2050
|
-
},
|
|
2051
|
-
"tanstack-start-mdx-remote": {
|
|
2052
|
-
label: "Tanstack Start: MDX Remote",
|
|
2053
|
-
hint: "Template for Tanstack Start with MDX remote",
|
|
2054
|
-
value: "tanstack-start"
|
|
2055
|
-
}
|
|
2056
|
-
};
|
|
2057
2036
|
async function setupFumadocs(config) {
|
|
2058
2037
|
const { packageManager, projectDir } = config;
|
|
2059
2038
|
try {
|
|
2060
2039
|
log.info("Setting up Fumadocs...");
|
|
2061
|
-
const
|
|
2062
|
-
message: "Choose a template",
|
|
2063
|
-
options: Object.entries(TEMPLATES).map(([key, template$1]) => ({
|
|
2064
|
-
value: key,
|
|
2065
|
-
label: template$1.label,
|
|
2066
|
-
hint: template$1.hint
|
|
2067
|
-
})),
|
|
2068
|
-
initialValue: "next-mdx"
|
|
2069
|
-
});
|
|
2070
|
-
if (isCancel(template)) return exitCancelled("Operation cancelled");
|
|
2071
|
-
const fumadocsInitCommand = getPackageExecutionCommand(packageManager, `create-fumadocs-app@latest fumadocs --template ${TEMPLATES[template].value} --src --no-install --pm ${packageManager} --no-eslint --no-git`);
|
|
2072
|
-
const s = spinner();
|
|
2073
|
-
s.start("Setting up Fumadocs...");
|
|
2040
|
+
const fumadocsInitCommand = getPackageExecutionCommand(packageManager, `create-fumadocs-app@latest fumadocs --src --no-install --pm ${packageManager} --no-eslint --no-biome --no-git`);
|
|
2074
2041
|
const appsDir = path.join(projectDir, "apps");
|
|
2075
2042
|
await fs.ensureDir(appsDir);
|
|
2076
2043
|
await execa(fumadocsInitCommand, {
|
|
2077
2044
|
cwd: appsDir,
|
|
2078
2045
|
env: { CI: "true" },
|
|
2079
|
-
shell: true
|
|
2046
|
+
shell: true,
|
|
2047
|
+
stdio: "inherit"
|
|
2080
2048
|
});
|
|
2081
|
-
s.stop("Fumadocs setup complete!");
|
|
2082
2049
|
const fumadocsDir = path.join(projectDir, "apps", "fumadocs");
|
|
2083
2050
|
const packageJsonPath = path.join(fumadocsDir, "package.json");
|
|
2084
2051
|
if (await fs.pathExists(packageJsonPath)) {
|
|
@@ -2271,7 +2238,7 @@ const EDITORS = {
|
|
|
2271
2238
|
vscode: { label: "VSCode / Cursor / Windsurf" },
|
|
2272
2239
|
zed: { label: "Zed" }
|
|
2273
2240
|
};
|
|
2274
|
-
const
|
|
2241
|
+
const AGENTS = {
|
|
2275
2242
|
"vscode-copilot": { label: "VS Code Copilot" },
|
|
2276
2243
|
cursor: { label: "Cursor" },
|
|
2277
2244
|
windsurf: { label: "Windsurf" },
|
|
@@ -2288,10 +2255,27 @@ const RULES = {
|
|
|
2288
2255
|
junie: { label: "Junie" },
|
|
2289
2256
|
augmentcode: { label: "AugmentCode" },
|
|
2290
2257
|
"kilo-code": { label: "Kilo Code" },
|
|
2291
|
-
goose: { label: "Goose" }
|
|
2258
|
+
goose: { label: "Goose" },
|
|
2259
|
+
"roo-code": { label: "Roo Code" }
|
|
2292
2260
|
};
|
|
2261
|
+
function getFrameworksFromFrontend(frontend) {
|
|
2262
|
+
const frameworkMap = {
|
|
2263
|
+
"tanstack-router": "react",
|
|
2264
|
+
"react-router": "react",
|
|
2265
|
+
"tanstack-start": "react",
|
|
2266
|
+
next: "next",
|
|
2267
|
+
nuxt: "vue",
|
|
2268
|
+
"native-nativewind": "react",
|
|
2269
|
+
"native-unistyles": "react",
|
|
2270
|
+
svelte: "svelte",
|
|
2271
|
+
solid: "solid"
|
|
2272
|
+
};
|
|
2273
|
+
const frameworks = /* @__PURE__ */ new Set();
|
|
2274
|
+
for (const f of frontend) if (f !== "none" && frameworkMap[f]) frameworks.add(frameworkMap[f]);
|
|
2275
|
+
return Array.from(frameworks);
|
|
2276
|
+
}
|
|
2293
2277
|
async function setupUltracite(config, hasHusky) {
|
|
2294
|
-
const { packageManager, projectDir } = config;
|
|
2278
|
+
const { packageManager, projectDir, frontend } = config;
|
|
2295
2279
|
try {
|
|
2296
2280
|
log.info("Setting up Ultracite...");
|
|
2297
2281
|
await setupBiome(projectDir);
|
|
@@ -2304,11 +2288,11 @@ async function setupUltracite(config, hasHusky) {
|
|
|
2304
2288
|
})),
|
|
2305
2289
|
required: true
|
|
2306
2290
|
}),
|
|
2307
|
-
|
|
2308
|
-
message: "Choose
|
|
2309
|
-
options: Object.entries(
|
|
2291
|
+
agents: () => autocompleteMultiselect({
|
|
2292
|
+
message: "Choose agents",
|
|
2293
|
+
options: Object.entries(AGENTS).map(([key, agent]) => ({
|
|
2310
2294
|
value: key,
|
|
2311
|
-
label:
|
|
2295
|
+
label: agent.label
|
|
2312
2296
|
})),
|
|
2313
2297
|
required: true
|
|
2314
2298
|
})
|
|
@@ -2316,14 +2300,16 @@ async function setupUltracite(config, hasHusky) {
|
|
|
2316
2300
|
exitCancelled("Operation cancelled");
|
|
2317
2301
|
} });
|
|
2318
2302
|
const editors = result.editors;
|
|
2319
|
-
const
|
|
2303
|
+
const agents = result.agents;
|
|
2304
|
+
const frameworks = getFrameworksFromFrontend(frontend);
|
|
2320
2305
|
const ultraciteArgs = [
|
|
2321
2306
|
"init",
|
|
2322
2307
|
"--pm",
|
|
2323
2308
|
packageManager
|
|
2324
2309
|
];
|
|
2310
|
+
if (frameworks.length > 0) ultraciteArgs.push("--frameworks", ...frameworks);
|
|
2325
2311
|
if (editors.length > 0) ultraciteArgs.push("--editors", ...editors);
|
|
2326
|
-
if (
|
|
2312
|
+
if (agents.length > 0) ultraciteArgs.push("--agents", ...agents);
|
|
2327
2313
|
if (hasHusky) ultraciteArgs.push("--integrations", "husky", "lint-staged");
|
|
2328
2314
|
const ultraciteInitCommand = getPackageExecutionCommand(packageManager, `ultracite@latest ${ultraciteArgs.join(" ")} --skip-install`);
|
|
2329
2315
|
const s = spinner();
|
|
@@ -4309,6 +4295,10 @@ async function setupApi(config) {
|
|
|
4309
4295
|
dependencies: ["better-auth"],
|
|
4310
4296
|
projectDir: apiPackageDir
|
|
4311
4297
|
});
|
|
4298
|
+
if (backend === "express") await addPackageDependency({
|
|
4299
|
+
devDependencies: ["@types/express"],
|
|
4300
|
+
projectDir: apiPackageDir
|
|
4301
|
+
});
|
|
4312
4302
|
if (webDirExists && apiDeps.web) await addPackageDependency({
|
|
4313
4303
|
dependencies: apiDeps.web.dependencies,
|
|
4314
4304
|
devDependencies: apiDeps.web.devDependencies,
|
|
@@ -4445,7 +4435,7 @@ async function setupAuth(config) {
|
|
|
4445
4435
|
projectDir: clientDir
|
|
4446
4436
|
});
|
|
4447
4437
|
else if (hasTanStackStart) await addPackageDependency({
|
|
4448
|
-
dependencies: ["@clerk/tanstack-react-start"],
|
|
4438
|
+
dependencies: ["@clerk/tanstack-react-start", "srvx"],
|
|
4449
4439
|
projectDir: clientDir
|
|
4450
4440
|
});
|
|
4451
4441
|
else if (hasViteReactOther) await addPackageDependency({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.10",
|
|
4
4
|
"description": "A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -88,12 +88,17 @@ export async function createContext({ context }: CreateContextOptions) {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
{{else if (eq backend 'express')}}
|
|
91
|
+
import type { Request } from "express";
|
|
91
92
|
{{#if (eq auth "better-auth")}}
|
|
92
93
|
import { fromNodeHeaders } from "better-auth/node";
|
|
93
94
|
import { auth } from "@{{projectName}}/auth";
|
|
94
95
|
{{/if}}
|
|
95
96
|
|
|
96
|
-
|
|
97
|
+
interface CreateContextOptions {
|
|
98
|
+
req: Request;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export async function createContext(opts: CreateContextOptions) {
|
|
97
102
|
{{#if (eq auth "better-auth")}}
|
|
98
103
|
const session = await auth.api.getSession({
|
|
99
104
|
headers: fromNodeHeaders(opts.req.headers),
|
|
@@ -33,7 +33,19 @@ const getORPCClient = createIsomorphicFn()
|
|
|
33
33
|
.server(() =>
|
|
34
34
|
createRouterClient(appRouter, {
|
|
35
35
|
context: async ({ req }) => {
|
|
36
|
+
{{#if (eq backend "self")}}
|
|
36
37
|
return createContext({ req });
|
|
38
|
+
{{else if (eq backend "hono")}}
|
|
39
|
+
return createContext({ context: req });
|
|
40
|
+
{{else if (eq backend "elysia")}}
|
|
41
|
+
return createContext({ context: req });
|
|
42
|
+
{{else if (eq backend "express")}}
|
|
43
|
+
return createContext({ req });
|
|
44
|
+
{{else if (eq backend "fastify")}}
|
|
45
|
+
return createContext(req.headers);
|
|
46
|
+
{{else}}
|
|
47
|
+
return createContext();
|
|
48
|
+
{{/if}}
|
|
37
49
|
},
|
|
38
50
|
}),
|
|
39
51
|
)
|