mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
add convex
This commit is contained in:
@@ -5,13 +5,24 @@ import type { ProjectConfig } from "../types";
|
||||
import { addPackageDependency } from "../utils/add-package-deps";
|
||||
|
||||
export async function setupExamples(config: ProjectConfig): Promise<void> {
|
||||
const { projectName, examples, frontend } = config;
|
||||
const { projectName, examples, frontend, backend } = config;
|
||||
|
||||
if (
|
||||
backend === "convex" ||
|
||||
!examples ||
|
||||
examples.length === 0 ||
|
||||
examples[0] === "none"
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const projectDir = path.resolve(process.cwd(), projectName);
|
||||
|
||||
if (examples.includes("ai")) {
|
||||
const clientDir = path.join(projectDir, "apps/web");
|
||||
const serverDir = path.join(projectDir, "apps/server");
|
||||
const clientDirExists = await fs.pathExists(clientDir);
|
||||
const serverDirExists = await fs.pathExists(serverDir);
|
||||
|
||||
const hasNuxt = frontend.includes("nuxt");
|
||||
const hasSvelte = frontend.includes("svelte");
|
||||
@@ -22,6 +33,7 @@ export async function setupExamples(config: ProjectConfig): Promise<void> {
|
||||
dependencies.push("@ai-sdk/vue");
|
||||
} else if (hasSvelte) {
|
||||
dependencies.push("@ai-sdk/svelte");
|
||||
} else {
|
||||
}
|
||||
await addPackageDependency({
|
||||
dependencies,
|
||||
@@ -29,9 +41,11 @@ export async function setupExamples(config: ProjectConfig): Promise<void> {
|
||||
});
|
||||
}
|
||||
|
||||
await addPackageDependency({
|
||||
dependencies: ["ai", "@ai-sdk/google"],
|
||||
projectDir: serverDir,
|
||||
});
|
||||
if (serverDirExists) {
|
||||
await addPackageDependency({
|
||||
dependencies: ["ai", "@ai-sdk/google"],
|
||||
projectDir: serverDir,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user