refactor: replace better-sqlite3 with built-in node:sqlite - #32
Open
sdirix wants to merge 1 commit into
Open
Conversation
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
As Node 18 and 20 are EOL already I think this is a good opportunity to slim down diffity. This makes life easier as diffity does not have to be rebuilt for every Node version. You might want to increase the major version before releasing to indicate breaking changes for users still using older Node versions.