mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
feat(cli): Upgrade to Prisma 6.13.0 (#431)
This commit is contained in:
5
.changeset/legal-bears-feel.md
Normal file
5
.changeset/legal-bears-feel.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"create-better-t-stack": patch
|
||||
---
|
||||
|
||||
Upgrade to Prisma 6.13.0
|
||||
@@ -28,8 +28,8 @@ export const DEFAULT_CONFIG: ProjectConfig = {
|
||||
};
|
||||
|
||||
export const dependencyVersionMap = {
|
||||
"better-auth": "^1.3.0",
|
||||
"@better-auth/expo": "^1.3.0",
|
||||
"better-auth": "^1.3.4",
|
||||
"@better-auth/expo": "^1.3.4",
|
||||
|
||||
"drizzle-orm": "^0.44.2",
|
||||
"drizzle-kit": "^0.31.2",
|
||||
@@ -44,8 +44,8 @@ export const dependencyVersionMap = {
|
||||
|
||||
mysql2: "^3.14.0",
|
||||
|
||||
"@prisma/client": "^6.12.0",
|
||||
prisma: "^6.12.0",
|
||||
"@prisma/client": "^6.13.0",
|
||||
prisma: "^6.13.0",
|
||||
"@prisma/extension-accelerate": "^2.0.2",
|
||||
|
||||
mongoose: "^8.14.0",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import path from "node:path";
|
||||
import { cancel, isCancel, log, select, spinner, text } from "@clack/prompts";
|
||||
import { cancel, isCancel, log, select, text } from "@clack/prompts";
|
||||
import { consola } from "consola";
|
||||
import { execa } from "execa";
|
||||
import fs from "fs-extra";
|
||||
@@ -23,7 +23,7 @@ async function setupWithCreateDb(
|
||||
) {
|
||||
try {
|
||||
log.info(
|
||||
"Starting Prisma PostgreSQL setup. Please follow the instructions below:",
|
||||
"Starting Prisma Postgres setup. Please follow the instructions below:",
|
||||
);
|
||||
|
||||
const createDbCommand = getPackageExecutionCommand(
|
||||
@@ -149,6 +149,20 @@ async function writeEnvFile(projectDir: string, config?: PrismaConfig) {
|
||||
}
|
||||
}
|
||||
|
||||
async function addDotenvImportToPrismaConfig(projectDir: string) {
|
||||
try {
|
||||
const prismaConfigPath = path.join(
|
||||
projectDir,
|
||||
"apps/server/prisma.config.ts",
|
||||
);
|
||||
let content = await fs.readFile(prismaConfigPath, "utf8");
|
||||
content = `import "dotenv/config";\n${content}`;
|
||||
await fs.writeFile(prismaConfigPath, content);
|
||||
} catch (_error) {
|
||||
consola.error("Failed to update prisma.config.ts");
|
||||
}
|
||||
}
|
||||
|
||||
function displayManualSetupInstructions() {
|
||||
log.info(`Manual Prisma PostgreSQL Setup Instructions:
|
||||
|
||||
@@ -226,7 +240,7 @@ export async function setupPrismaPostgres(config: ProjectConfig) {
|
||||
}
|
||||
|
||||
const setupMethod = await select({
|
||||
message: "Choose your Prisma setup method:",
|
||||
message: "Choose your Prisma Postgres setup method:",
|
||||
options: setupOptions,
|
||||
initialValue: "create-db",
|
||||
});
|
||||
@@ -246,28 +260,23 @@ export async function setupPrismaPostgres(config: ProjectConfig) {
|
||||
|
||||
if (prismaConfig) {
|
||||
await writeEnvFile(projectDir, prismaConfig);
|
||||
|
||||
await addDotenvImportToPrismaConfig(projectDir);
|
||||
|
||||
if (orm === "prisma") {
|
||||
await addPrismaAccelerateExtension(serverDir);
|
||||
log.info(
|
||||
pc.cyan(
|
||||
'NOTE: Make sure to uncomment `import "dotenv/config";` in `apps/server/src/prisma.config.ts` to load environment variables.',
|
||||
),
|
||||
);
|
||||
}
|
||||
log.success(
|
||||
pc.green("Prisma PostgreSQL database configured successfully!"),
|
||||
pc.green("Prisma Postgres database configured successfully!"),
|
||||
);
|
||||
} else {
|
||||
const fallbackSpinner = spinner();
|
||||
fallbackSpinner.start("Setting up fallback configuration...");
|
||||
await writeEnvFile(projectDir);
|
||||
fallbackSpinner.stop("Fallback configuration ready");
|
||||
displayManualSetupInstructions();
|
||||
}
|
||||
} catch (error) {
|
||||
consola.error(
|
||||
pc.red(
|
||||
`Error during Prisma PostgreSQL setup: ${
|
||||
`Error during Prisma Postgres setup: ${
|
||||
error instanceof Error ? error.message : String(error)
|
||||
}`,
|
||||
),
|
||||
|
||||
@@ -253,7 +253,7 @@ async function getDatabaseInstructions(
|
||||
}
|
||||
|
||||
if (orm === "prisma") {
|
||||
if (database === "sqlite") {
|
||||
if (dbSetup === "turso") {
|
||||
instructions.push(
|
||||
`${pc.yellow(
|
||||
"NOTE:",
|
||||
@@ -262,13 +262,6 @@ async function getDatabaseInstructions(
|
||||
);
|
||||
}
|
||||
|
||||
if (runtime === "bun") {
|
||||
instructions.push(
|
||||
`${pc.yellow(
|
||||
"NOTE:",
|
||||
)} Prisma with Bun may require additional configuration. If you encounter errors,\nfollow the guidance provided in the error messages`,
|
||||
);
|
||||
}
|
||||
if (database === "mongodb" && dbSetup === "docker") {
|
||||
instructions.push(
|
||||
`${pc.yellow(
|
||||
|
||||
@@ -248,9 +248,9 @@ async function updateServerPackageJson(
|
||||
}
|
||||
|
||||
if (options.orm === "prisma") {
|
||||
scripts["db:push"] = "prisma db push --schema ./prisma/schema";
|
||||
scripts["db:push"] = "prisma db push";
|
||||
scripts["db:studio"] = "prisma studio";
|
||||
scripts["db:generate"] = "prisma generate --schema ./prisma/schema";
|
||||
scripts["db:generate"] = "prisma generate";
|
||||
scripts["db:migrate"] = "prisma migrate dev";
|
||||
} else if (options.orm === "drizzle") {
|
||||
scripts["db:push"] = "drizzle-kit push";
|
||||
|
||||
@@ -23,7 +23,7 @@ function getAddonDisplay(addon: Addons): { label: string; hint: string } {
|
||||
hint = "High-performance build system";
|
||||
break;
|
||||
case "pwa":
|
||||
label = "PWA (Progressive Web App)";
|
||||
label = "PWA";
|
||||
hint = "Make your app installable and work offline";
|
||||
break;
|
||||
case "tauri":
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"next": "15.3.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"dotenv": "^16.5.0"
|
||||
"dotenv": "^17.2.1"
|
||||
},
|
||||
{{#if (eq dbSetup 'supabase')}}
|
||||
"trustedDependencies": [
|
||||
@@ -21,6 +21,7 @@
|
||||
"devDependencies": {
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^19",
|
||||
"zod": "^4.0.13",
|
||||
"typescript": "^5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,8 @@
|
||||
"check-types": "tsc -b",
|
||||
"compile": "bun build --compile --minify --sourcemap --bytecode ./src/index.ts --outfile server"
|
||||
},
|
||||
{{#if (eq orm 'prisma')}}
|
||||
"prisma": {
|
||||
"schema": "./schema"
|
||||
},
|
||||
{{/if}}
|
||||
"dependencies": {
|
||||
"dotenv": "^16.4.7",
|
||||
"dotenv": "^17.2.1",
|
||||
"zod": "^4.0.2"
|
||||
},
|
||||
{{#if (eq dbSetup 'supabase')}}
|
||||
|
||||
@@ -3,6 +3,8 @@ import path from "node:path";
|
||||
import type { PrismaConfig } from "prisma";
|
||||
|
||||
export default {
|
||||
earlyAccess: true,
|
||||
schema: path.join("prisma", "schema"),
|
||||
migrations: {
|
||||
path: path.join("prisma", "migrations"),
|
||||
}
|
||||
} satisfies PrismaConfig;
|
||||
|
||||
@@ -3,6 +3,8 @@ import path from "node:path";
|
||||
import type { PrismaConfig } from "prisma";
|
||||
|
||||
export default {
|
||||
earlyAccess: true,
|
||||
schema: path.join("prisma", "schema"),
|
||||
migrations: {
|
||||
path: path.join("prisma", "migrations"),
|
||||
}
|
||||
} satisfies PrismaConfig;
|
||||
@@ -1,12 +1,12 @@
|
||||
{{#if (eq dbSetup "prisma-postgres")}}
|
||||
// import "dotenv/config"; uncomment this to load .env
|
||||
{{else}}
|
||||
{{#unless (eq dbSetup "prisma-postgres")}}
|
||||
import "dotenv/config";
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
import path from "node:path";
|
||||
import type { PrismaConfig } from "prisma";
|
||||
|
||||
export default {
|
||||
earlyAccess: true,
|
||||
schema: path.join("prisma", "schema"),
|
||||
migrations: {
|
||||
path: path.join("prisma", "migrations"),
|
||||
}
|
||||
} satisfies PrismaConfig;
|
||||
|
||||
@@ -3,6 +3,8 @@ import path from "node:path";
|
||||
import type { PrismaConfig } from "prisma";
|
||||
|
||||
export default {
|
||||
earlyAccess: true,
|
||||
schema: path.join("prisma", "schema"),
|
||||
migrations: {
|
||||
path: path.join("prisma", "migrations"),
|
||||
}
|
||||
} satisfies PrismaConfig;
|
||||
@@ -1,8 +1,8 @@
|
||||
"use client";
|
||||
|
||||
import { Terminal } from "lucide-react";
|
||||
import ShowcaseItem from "./_components/ShowcaseItem";
|
||||
import Footer from "../_components/footer";
|
||||
import ShowcaseItem from "./_components/ShowcaseItem";
|
||||
|
||||
const showcaseProjects = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user