Skip to content

refactor: replace better-sqlite3 with built-in node:sqlite (upstream #32) - #2

Merged
fiddur merged 3 commits into
developfrom
node-sqlite
Aug 21, 2026
Merged

refactor: replace better-sqlite3 with built-in node:sqlite (upstream #32)#2
fiddur merged 3 commits into
developfrom
node-sqlite

Conversation

@fiddur

@fiddur fiddur commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Merges upstream nilbuild/diffity#32 by @sdirix unmodified.

Drops better-sqlite3, the only native dependency, for the built-in node:sqlite. Same SQLite
file format, so existing reviews.db sessions keep working. engines.node goes >=18
>=22.13.

Taken in early because it rewrites every row-returning query in db.ts, threads.ts, tours.ts
and session.ts — the files the walkthrough work touches next.

Verified locally: 127 tests pass, build succeeds, and the CLI opens the database at runtime
(diffity list).

Stacked on #1.

🤖 Generated with Claude Code

https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs

sdirix and others added 3 commits July 25, 2026 09:13
Drops the only native dependency, so installs no longer risk a node-gyp
build on platforms without prebuilt binaries (and the tree shrinks by
12 MB). Same SQLite file format, so existing reviews.db files keep
working without migration.

- db.ts uses DatabaseSync, loaded lazily via createRequire so users on
  older Node get a readable error instead of ERR_UNKNOWN_BUILTIN_MODULE
  at startup; db.pragma(x) becomes db.exec('PRAGMA ' + x)
- add queryAll/queryOne helpers that keep the row-shape assertion in one
  place, since node:sqlite types every row as Record<string,
  SQLOutputValue> with no generic overloads; all row-returning queries
  in threads/tours/session go through them
- doctor checks node:sqlite availability instead of native module load
- engines.node >=18 -> >=22.13 (first release with node:sqlite unflagged)
@fiddur
fiddur changed the base branch from fix-build-skills-wipe to develop August 21, 2026 13:33
@fiddur
fiddur marked this pull request as ready for review August 21, 2026 13:33
@fiddur
fiddur merged commit 5599192 into develop Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants