create-better-t-stack 2.42.0 → 2.43.1
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-D0heoKPu.js → src-CLCbHMKK.js} +10 -13
- 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/react/next/tsconfig.json.hbs +11 -5
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({
|
|
@@ -3096,7 +3092,8 @@ async function setupNextAlchemyDeploy(projectDir, _packageManager, options) {
|
|
|
3096
3092
|
devDependencies: [
|
|
3097
3093
|
"alchemy",
|
|
3098
3094
|
"dotenv",
|
|
3099
|
-
"wrangler"
|
|
3095
|
+
"wrangler",
|
|
3096
|
+
"@cloudflare/workers-types"
|
|
3100
3097
|
],
|
|
3101
3098
|
projectDir: webAppDir
|
|
3102
3099
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.43.1",
|
|
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
|
|
|
@@ -21,16 +21,22 @@
|
|
|
21
21
|
],
|
|
22
22
|
"paths": {
|
|
23
23
|
"@/*": ["./src/*"]
|
|
24
|
-
}
|
|
24
|
+
}{{#if (or (eq serverDeploy "alchemy") (eq webDeploy "alchemy"))}},
|
|
25
|
+
"types": [
|
|
26
|
+
"@cloudflare/workers-types"
|
|
27
|
+
]{{/if}}
|
|
25
28
|
},
|
|
26
29
|
"include": [
|
|
30
|
+
{{#if (eq serverDeploy "alchemy")}}
|
|
31
|
+
"../server/env.d.ts",
|
|
32
|
+
{{/if}}
|
|
33
|
+
{{#if (eq serverDeploy "wrangler")}}
|
|
34
|
+
"../server/worker-configuration.d.ts",
|
|
35
|
+
{{/if}}
|
|
27
36
|
"./next-env.d.ts",
|
|
28
37
|
"./**/*.ts",
|
|
29
38
|
"./**/*.tsx",
|
|
30
|
-
"./.next/types/**/*.ts"
|
|
31
|
-
{{#if (eq runtime "workers")}}
|
|
32
|
-
"../server/worker-configuration.d.ts"
|
|
33
|
-
{{/if}}
|
|
39
|
+
"./.next/types/**/*.ts"
|
|
34
40
|
],
|
|
35
41
|
"exclude": [
|
|
36
42
|
"./node_modules"
|