create-better-t-stack 2.41.4 → 2.43.0
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 +1 -1
- package/dist/index.js +1 -1
- package/dist/{src-CGOvCEq2.js → src-aqYnSRIj.js} +12 -16
- package/package.json +1 -1
- package/templates/backend/server/elysia/src/index.ts.hbs +16 -0
- package/templates/backend/server/fastify/src/index.ts.hbs +2 -3
- package/templates/frontend/nuxt/app/{app.config.ts → app.config.ts.hbs} +1 -1
- package/templates/frontend/nuxt/nuxt.config.ts.hbs +1 -1
- package/templates/frontend/nuxt/package.json.hbs +5 -5
- package/templates/frontend/nuxt/tsconfig.json.hbs +1 -0
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -94,7 +94,7 @@ const dependencyVersionMap = {
|
|
|
94
94
|
"@elysiajs/node": "^1.3.1",
|
|
95
95
|
"@elysiajs/cors": "^1.3.3",
|
|
96
96
|
"@elysiajs/trpc": "^1.1.0",
|
|
97
|
-
elysia: "^1.3.
|
|
97
|
+
"elysia": "^1.3.21",
|
|
98
98
|
"@hono/node-server": "^1.14.4",
|
|
99
99
|
"@hono/trpc-server": "^0.4.0",
|
|
100
100
|
hono: "^4.8.2",
|
|
@@ -105,12 +105,12 @@ const dependencyVersionMap = {
|
|
|
105
105
|
fastify: "^5.3.3",
|
|
106
106
|
"@fastify/cors": "^11.0.1",
|
|
107
107
|
turbo: "^2.5.4",
|
|
108
|
-
ai: "^5.0.
|
|
109
|
-
"@ai-sdk/google": "^2.0.
|
|
110
|
-
"@ai-sdk/vue": "^2.0.
|
|
111
|
-
"@ai-sdk/svelte": "^3.0.
|
|
112
|
-
"@ai-sdk/react": "^2.0.
|
|
113
|
-
streamdown: "^1.
|
|
108
|
+
"ai": "^5.0.39",
|
|
109
|
+
"@ai-sdk/google": "^2.0.13",
|
|
110
|
+
"@ai-sdk/vue": "^2.0.39",
|
|
111
|
+
"@ai-sdk/svelte": "^3.0.39",
|
|
112
|
+
"@ai-sdk/react": "^2.0.39",
|
|
113
|
+
streamdown: "^1.2.0",
|
|
114
114
|
"@orpc/server": "^1.8.6",
|
|
115
115
|
"@orpc/client": "^1.8.6",
|
|
116
116
|
"@orpc/openapi": "^1.8.6",
|
|
@@ -540,9 +540,8 @@ function allowedApisForFrontends(frontends = []) {
|
|
|
540
540
|
function isExampleTodoAllowed(backend, database) {
|
|
541
541
|
return !(backend !== "convex" && backend !== "none" && database === "none");
|
|
542
542
|
}
|
|
543
|
-
function isExampleAIAllowed(
|
|
543
|
+
function isExampleAIAllowed(_backend, frontends = []) {
|
|
544
544
|
const includesSolid = frontends.includes("solid");
|
|
545
|
-
if (backend === "elysia") return false;
|
|
546
545
|
if (includesSolid) return false;
|
|
547
546
|
return true;
|
|
548
547
|
}
|
|
@@ -563,7 +562,6 @@ function validateExamplesCompatibility(examples, backend, database, frontend) {
|
|
|
563
562
|
const examplesArr = examples ?? [];
|
|
564
563
|
if (examplesArr.length === 0 || examplesArr.includes("none")) return;
|
|
565
564
|
if (examplesArr.includes("todo") && backend !== "convex" && backend !== "none" && database === "none") exitWithError("The 'todo' example requires a database if a backend (other than Convex) is present. Cannot use --examples todo when database is 'none' and a backend is selected.");
|
|
566
|
-
if (examplesArr.includes("ai") && backend === "elysia") exitWithError("The 'ai' example is not compatible with the Elysia backend.");
|
|
567
565
|
if (examplesArr.includes("ai") && (frontend ?? []).includes("solid")) exitWithError("The 'ai' example is not compatible with the Solid frontend.");
|
|
568
566
|
}
|
|
569
567
|
|
|
@@ -841,8 +839,6 @@ async function getExamplesChoice(examples, database, frontends, backend, api) {
|
|
|
841
839
|
if (backend === "convex") return ["todo"];
|
|
842
840
|
if (backend === "none") return [];
|
|
843
841
|
if (database === "none") return [];
|
|
844
|
-
const noFrontendSelected = !frontends || frontends.length === 0;
|
|
845
|
-
if (noFrontendSelected) return [];
|
|
846
842
|
let response = [];
|
|
847
843
|
const options = [];
|
|
848
844
|
if (isExampleTodoAllowed(backend, database)) options.push({
|
|
@@ -3132,7 +3128,8 @@ async function setupNuxtAlchemyDeploy(projectDir, _packageManager, options) {
|
|
|
3132
3128
|
devDependencies: [
|
|
3133
3129
|
"alchemy",
|
|
3134
3130
|
"nitro-cloudflare-dev",
|
|
3135
|
-
"dotenv"
|
|
3131
|
+
"dotenv",
|
|
3132
|
+
"wrangler"
|
|
3136
3133
|
],
|
|
3137
3134
|
projectDir: webAppDir
|
|
3138
3135
|
});
|
|
@@ -5993,7 +5990,7 @@ function getNativeInstructions(isConvex) {
|
|
|
5993
5990
|
function getLintingInstructions(runCmd) {
|
|
5994
5991
|
return `${pc.bold("Linting and formatting:")}\n${pc.cyan("•")} Format and lint fix: ${`${runCmd} check`}\n`;
|
|
5995
5992
|
}
|
|
5996
|
-
async function getDatabaseInstructions(database, orm, runCmd,
|
|
5993
|
+
async function getDatabaseInstructions(database, orm, runCmd, runtime, dbSetup, serverDeploy) {
|
|
5997
5994
|
const instructions = [];
|
|
5998
5995
|
if (dbSetup === "docker") {
|
|
5999
5996
|
const dockerStatus = await getDockerStatus(database);
|
|
@@ -6003,8 +6000,7 @@ async function getDatabaseInstructions(database, orm, runCmd, _runtime, dbSetup,
|
|
|
6003
6000
|
}
|
|
6004
6001
|
}
|
|
6005
6002
|
if (serverDeploy === "wrangler" && dbSetup === "d1") {
|
|
6006
|
-
if (orm === "prisma" &&
|
|
6007
|
-
Consider using Alchemy deploy instead of Wrangler for D1 projects.`);
|
|
6003
|
+
if (orm === "prisma" && runtime === "workers") instructions.push(`\n${pc.yellow("WARNING:")} Prisma + D1 on Workers with Wrangler has migration issues.\n Consider using Alchemy deploy instead of Wrangler for D1 projects.\n`);
|
|
6008
6004
|
const packageManager = runCmd === "npm run" ? "npm" : runCmd || "npm";
|
|
6009
6005
|
instructions.push(`${pc.cyan("1.")} Login to Cloudflare: ${pc.white(`${packageManager} wrangler login`)}`);
|
|
6010
6006
|
instructions.push(`${pc.cyan("2.")} Create D1 database: ${pc.white(`${packageManager} wrangler d1 create your-database-name`)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.43.0",
|
|
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",
|
|
@@ -4,6 +4,10 @@ import { node } from "@elysiajs/node";
|
|
|
4
4
|
{{/if}}
|
|
5
5
|
import { Elysia } from "elysia";
|
|
6
6
|
import { cors } from "@elysiajs/cors";
|
|
7
|
+
{{#if (includes examples "ai")}}
|
|
8
|
+
import { google } from "@ai-sdk/google";
|
|
9
|
+
import { convertToModelMessages, streamText } from "ai";
|
|
10
|
+
{{/if}}
|
|
7
11
|
{{#if (eq api "trpc")}}
|
|
8
12
|
import { createContext } from "./lib/context";
|
|
9
13
|
import { appRouter } from "./routers/index";
|
|
@@ -94,6 +98,18 @@ const app = new Elysia()
|
|
|
94
98
|
});
|
|
95
99
|
return res;
|
|
96
100
|
})
|
|
101
|
+
{{/if}}
|
|
102
|
+
{{#if (includes examples "ai")}}
|
|
103
|
+
.post("/ai", async (context) => {
|
|
104
|
+
const body = await context.request.json();
|
|
105
|
+
const uiMessages = body.messages || [];
|
|
106
|
+
const result = streamText({
|
|
107
|
+
model: google("gemini-2.0-flash"),
|
|
108
|
+
messages: convertToModelMessages(uiMessages)
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
return result.toUIMessageStreamResponse();
|
|
112
|
+
})
|
|
97
113
|
{{/if}}
|
|
98
114
|
.get("/", () => "OK")
|
|
99
115
|
.listen(3000, () => {
|
|
@@ -158,15 +158,14 @@ interface AiRequestBody {
|
|
|
158
158
|
messages: UIMessage[];
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
fastify.post('/ai', async function (request
|
|
162
|
-
// there are some issues with the ai sdk and fastify, docs: https://ai-sdk.dev/cookbook/api-servers/fastify
|
|
161
|
+
fastify.post('/ai', async function (request) {
|
|
163
162
|
const { messages } = request.body as AiRequestBody;
|
|
164
163
|
const result = streamText({
|
|
165
164
|
model: google('gemini-1.5-flash'),
|
|
166
165
|
messages: convertToModelMessages(messages),
|
|
167
166
|
});
|
|
168
167
|
|
|
169
|
-
return result.
|
|
168
|
+
return result.toUIMessageStreamResponse();
|
|
170
169
|
});
|
|
171
170
|
{{/if}}
|
|
172
171
|
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"postinstall": "nuxt prepare"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@nuxt/ui": "3.3.
|
|
14
|
-
"nuxt": "^4.
|
|
15
|
-
"typescript": "^5.
|
|
16
|
-
"vue": "^3.5.
|
|
13
|
+
"@nuxt/ui": "3.3.3",
|
|
14
|
+
"nuxt": "^4.1.1",
|
|
15
|
+
"typescript": "^5.9.2",
|
|
16
|
+
"vue": "^3.5.21",
|
|
17
17
|
"vue-router": "^4.5.1",
|
|
18
|
-
"zod": "^4.
|
|
18
|
+
"zod": "^4.1.5"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"tailwindcss": "^4.1.11",
|