refactor: 替换 better-sqlite3 为 libsql 适配器

移除 C++ 原生依赖,Dockerfile 不再需要 python3/make/g++,
构建更快、镜像更轻。
This commit is contained in:
2026-02-25 18:23:25 +08:00
committed by 田东生
parent 5bf98753f1
commit bfed5cc2a2
4 changed files with 408 additions and 454 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ ENV PRISMA_ENGINES_MIRROR=https://registry.npmmirror.com/-/binary/prisma
# --- Dependencies --- # --- Dependencies ---
FROM base AS deps FROM base AS deps
RUN apk add --no-cache libc6-compat python3 make g++ RUN apk add --no-cache libc6-compat
WORKDIR /app WORKDIR /app
COPY package.json package-lock.json* ./ COPY package.json package-lock.json* ./
RUN npm ci RUN npm ci
+403 -447
View File
File diff suppressed because it is too large Load Diff
+1 -3
View File
@@ -9,9 +9,8 @@
"lint": "eslint" "lint": "eslint"
}, },
"dependencies": { "dependencies": {
"@prisma/adapter-better-sqlite3": "^7.4.1", "@prisma/adapter-libsql": "^7.4.1",
"@prisma/client": "^7.4.1", "@prisma/client": "^7.4.1",
"better-sqlite3": "^12.6.2",
"framer-motion": "^12.34.3", "framer-motion": "^12.34.3",
"lucide-react": "^0.575.0", "lucide-react": "^0.575.0",
"next": "16.1.6", "next": "16.1.6",
@@ -20,7 +19,6 @@
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/postcss": "^4", "@tailwindcss/postcss": "^4",
"@types/better-sqlite3": "^7.6.13",
"@types/node": "^20", "@types/node": "^20",
"@types/react": "^19", "@types/react": "^19",
"@types/react-dom": "^19", "@types/react-dom": "^19",
+2 -2
View File
@@ -1,11 +1,11 @@
import { PrismaClient } from "@/generated/prisma/client"; import { PrismaClient } from "@/generated/prisma/client";
import { PrismaBetterSqlite3 } from "@prisma/adapter-better-sqlite3"; import { PrismaLibSql } from "@prisma/adapter-libsql";
const globalForPrisma = globalThis as unknown as { prisma: PrismaClient }; const globalForPrisma = globalThis as unknown as { prisma: PrismaClient };
function createClient() { function createClient() {
const url = process.env.DATABASE_URL ?? "file:./dev.db"; const url = process.env.DATABASE_URL ?? "file:./dev.db";
const adapter = new PrismaBetterSqlite3({ url }); const adapter = new PrismaLibSql({ url });
return new PrismaClient({ adapter }); return new PrismaClient({ adapter });
} }