update deps

fix types error
This commit is contained in:
Aman Varshney
2025-04-08 10:28:25 +05:30
parent 9147dbb535
commit fe7153f496
10 changed files with 83 additions and 91 deletions

View File

@@ -111,7 +111,6 @@ app.post("/ai", async (c) => {
return stream(c, (stream) => stream.pipe(result.toDataStream()));
});`;
// Add imports and route handler for Hono
if (indexContent.includes("import {")) {
const lastImportIndex = indexContent.lastIndexOf("import");
const endOfLastImport = indexContent.indexOf("\n", lastImportIndex);
@@ -144,7 +143,6 @@ ${aiRouteHandler}`;
}
}
} else if (isExpress) {
// Express implementation
const importSection = `import { streamText } from "ai";\nimport { google } from "@ai-sdk/google";`;
const aiRouteHandler = `
@@ -160,7 +158,6 @@ app.post("/ai", async (req, res) => {
result.pipeDataStreamToResponse(res);
});`;
// Add imports for Express
if (
indexContent.includes("import {") ||
indexContent.includes("import ")
@@ -176,7 +173,6 @@ ${indexContent.substring(endOfLastImport + 1)}`;
${indexContent}`;
}
// Add route handler for Express
const trpcHandlerIndex = indexContent.indexOf('app.use("/trpc"');
if (trpcHandlerIndex !== -1) {
indexContent = `${indexContent.substring(0, trpcHandlerIndex)}${aiRouteHandler}
@@ -185,7 +181,6 @@ ${indexContent.substring(trpcHandlerIndex)}`;
} else {
const appListenIndex = indexContent.indexOf("app.listen(");
if (appListenIndex !== -1) {
// Find the line before app.listen
const prevNewlineIndex = indexContent.lastIndexOf(
"\n",
appListenIndex,
@@ -194,7 +189,6 @@ ${indexContent.substring(trpcHandlerIndex)}`;
${indexContent.substring(prevNewlineIndex)}`;
} else {
// Fallback: append to the end
indexContent = `${indexContent}
${aiRouteHandler}`;

View File

@@ -201,7 +201,6 @@ function validateOptions(options: CLIOptions): void {
}
}
// Check for database setup compatibility
if (options.dbSetup === "turso") {
if (options.database && options.database !== "sqlite") {
cancel(

View File

@@ -45,13 +45,10 @@ type PromptGroupResults = {
export async function gatherConfig(
flags: Partial<ProjectConfig>,
): Promise<ProjectConfig> {
// Handle specific dbSetup scenarios to adjust database and ORM before prompts
if (flags.dbSetup) {
if (flags.dbSetup === "turso") {
// Force database to be sqlite when turso is selected
flags.database = "sqlite";
// If orm is explicitly set to prisma, warn and switch to drizzle
if (flags.orm === "prisma") {
log.warn(
pc.yellow(
@@ -61,13 +58,11 @@ export async function gatherConfig(
flags.orm = "drizzle";
}
} else if (flags.dbSetup === "prisma-postgres") {
// Force database and orm for prisma-postgres
flags.database = "postgres";
flags.orm = "prisma";
} else if (flags.dbSetup === "mongodb-atlas") {
// Force database for mongodb-atlas
flags.database = "mongodb";
flags.orm = "prisma"; // MongoDB only works with Prisma
flags.orm = "prisma";
}
}

View File

@@ -16,7 +16,7 @@ export async function getDBSetupChoice(
{
value: "turso" as const,
label: "Turso",
hint: "Cloud SQLite with libSQL",
hint: "SQLite for Production. Powered by libSQL.",
},
{ value: "none" as const, label: "None", hint: "Manual setup" },
];
@@ -25,7 +25,7 @@ export async function getDBSetupChoice(
{
value: "prisma-postgres" as const,
label: "Prisma Postgres",
hint: "Managed by Prisma",
hint: "Instant Postgres for Global Applications",
},
{ value: "none" as const, label: "None", hint: "Manual setup" },
];
@@ -34,7 +34,7 @@ export async function getDBSetupChoice(
{
value: "mongodb-atlas" as const,
label: "MongoDB Atlas",
hint: "Cloud MongoDB service",
hint: "The most effective way to deploy MongoDB",
},
{ value: "none" as const, label: "None", hint: "Manual setup" },
];

View File

@@ -1,5 +1,5 @@
export type ProjectDatabase = "sqlite" | "postgres" | "mongodb" | "none";
export type ProjectOrm = "drizzle" | "prisma";
export type ProjectOrm = "drizzle" | "prisma" | "none";
export type ProjectPackageManager = "npm" | "pnpm" | "bun";
export type ProjectAddons = "pwa" | "biome" | "tauri" | "husky";
export type ProjectBackend = "hono" | "elysia" | "express";