mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-04-28 15:09:43 +00:00
fix: drop better-sqlite3 to remove deprecated prebuild-install (#75)
npm was warning on every install that prebuild-install@7.1.3 is no longer maintained. prebuild-install ships as a transitive dependency of better-sqlite3 and upstream PR #1446 to replace it is still open, so we switch to Node's built-in node:sqlite module (stable in Node 24, experimental in Node 22/23) and remove the better-sqlite3 dep entirely. - src/sqlite.ts: uses DatabaseSync from node:sqlite. The one-shot ExperimentalWarning about SQLite on Node 22/23 is silenced for that specific warning; other warnings pass through unchanged. - package.json: engines.node bumped to >=22 (Node 20 EOL 2026-04-30), better-sqlite3 and @types/better-sqlite3 removed, @types/node added (it was coming in transitively via @types/better-sqlite3). - tests/providers/opencode.test.ts: fixture DB creation switched to node:sqlite (API parity for the CREATE TABLE + INSERT + prepare path we use). End-user install footprint shrinks from 167 to 40 packages and prints zero deprecation warnings. Credit: @primeminister for the report.
This commit is contained in:
parent
2b15256189
commit
7aefd674fc
5 changed files with 83 additions and 540 deletions
|
|
@ -29,7 +29,7 @@ function createTestDb(dir: string): string {
|
|||
mkdirSync(ocDir, { recursive: true })
|
||||
const dbPath = join(ocDir, 'opencode.db')
|
||||
|
||||
const Database = require('better-sqlite3')
|
||||
const { DatabaseSync: Database } = require('node:sqlite')
|
||||
const db = new Database(dbPath)
|
||||
db.exec(`
|
||||
CREATE TABLE session (
|
||||
|
|
@ -57,7 +57,7 @@ function createTestDb(dir: string): string {
|
|||
}
|
||||
|
||||
function withTestDb(dbPath: string, fn: (db: TestDb) => void): void {
|
||||
const Database = require('better-sqlite3')
|
||||
const { DatabaseSync: Database } = require('node:sqlite')
|
||||
const db = new Database(dbPath)
|
||||
fn(db)
|
||||
db.close()
|
||||
|
|
@ -221,7 +221,7 @@ skipUnlessSqlite('opencode provider - session discovery', () => {
|
|||
const ocDir = join(tmpDir, 'opencode')
|
||||
await mkdir(ocDir, { recursive: true })
|
||||
|
||||
const Database = require('better-sqlite3')
|
||||
const { DatabaseSync: Database } = require('node:sqlite')
|
||||
for (const file of ['opencode.db', 'opencode-dev.db']) {
|
||||
const dbPath = join(ocDir, file)
|
||||
const db = new Database(dbPath)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue