fix native scaffolding

This commit is contained in:
Aman Varshney
2025-04-19 18:59:02 +05:30
parent b8c3fd40ab
commit d82ad80ac4
7 changed files with 96 additions and 58 deletions

View File

@@ -1,4 +1,5 @@
import path from "node:path";
import fs from "fs-extra";
import type { ProjectConfig } from "../types";
import { addPackageDependency } from "../utils/add-package-deps";
@@ -8,11 +9,16 @@ export async function setupExamples(config: ProjectConfig): Promise<void> {
if (examples.includes("ai")) {
const clientDir = path.join(projectDir, "apps/web");
await addPackageDependency({
dependencies: ["ai"],
projectDir: clientDir,
});
const serverDir = path.join(projectDir, "apps/server");
const clientDirExists = await fs.pathExists(clientDir);
if (clientDirExists) {
await addPackageDependency({
dependencies: ["ai"],
projectDir: clientDir,
});
}
await addPackageDependency({
dependencies: ["ai", "@ai-sdk/google"],
projectDir: serverDir,