fix: use bun:sqlite in production, better-sqlite3 as test-only devDep
Production (Docker): src/lib/db.ts now uses bun:sqlite + drizzle-orm/bun-sqlite. No native addon compilation needed — bun:sqlite is a Bun built-in. The Dockerfile drops all native build tools (python3, make, g++) and uses --ignore-scripts. Tests (Vitest/Node.js): bun:sqlite is unavailable under Node.js, so: - tests/helpers/db.ts keeps better-sqlite3 + drizzle-orm/better-sqlite3 for integration tests that need a real in-memory SQLite - vitest.config.ts aliases bun:sqlite → a thin better-sqlite3 shim and drizzle-orm/bun-sqlite → drizzle-orm/better-sqlite3 for unit tests that transitively import src/lib/db.ts without executing any queries - better-sqlite3 stays as a devDependency (test-only, not built in Docker) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
4
bun.lock
4
bun.lock
@@ -10,10 +10,8 @@
|
||||
"@mui/icons-material": "^7.3.9",
|
||||
"@mui/material": "^7.3.9",
|
||||
"@mui/x-date-pickers": "^8.27.2",
|
||||
"@types/better-sqlite3": "^7.6.13",
|
||||
"apexcharts": "^5.10.4",
|
||||
"bcryptjs": "^3.0.3",
|
||||
"better-sqlite3": "^12.8.0",
|
||||
"d3-geo": "^3.1.1",
|
||||
"dayjs": "^1.11.20",
|
||||
"drizzle-orm": "^0.45.1",
|
||||
@@ -32,6 +30,7 @@
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@next/eslint-plugin-next": "^16.1.7",
|
||||
"@playwright/test": "^1.58.2",
|
||||
"@types/better-sqlite3": "^7.6.13",
|
||||
"@types/bun": "latest",
|
||||
"@types/d3-geo": "^3.1.0",
|
||||
"@types/node": "^25.5.0",
|
||||
@@ -40,6 +39,7 @@
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@types/topojson-client": "^3.1.5",
|
||||
"@vitest/ui": "^4.1.0",
|
||||
"better-sqlite3": "^12.8.0",
|
||||
"drizzle-kit": "^0.31.10",
|
||||
"eslint": "^10.0.3",
|
||||
"typescript": "^5.9.3",
|
||||
|
||||
Reference in New Issue
Block a user