Share code between database application and SvelteKit application - #271
Merged
Conversation
ScriptRaccoon
force-pushed
the
shared-code
branch
6 times, most recently
from
July 9, 2026 20:06
fe9b977 to
29029ad
Compare
…nd consistency function
ScriptRaccoon
force-pushed
the
shared-code
branch
from
July 10, 2026 14:01
d0a7734 to
2cb3c14
Compare
ScriptRaccoon
marked this pull request as ready for review
July 10, 2026 14:01
this does not report any error anyway, and should only be used during development
ScriptRaccoon
force-pushed
the
shared-code
branch
from
July 11, 2026 06:46
059e5fa to
07d9f1a
Compare
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.
The repository basically contains two applications: the database application1 (seed files, seed script, deduction script, etc.) and the SvelteKit application (user interface). The database application lives in
/databases, while the SvelteKit application lives in/src. Both have long relied on similar functions and configuration objects, but until now this code was duplicated rather than shared.This PR resolves this by adding a new
/sharedfolder at the root. Both the database application and the SvelteKit application now import common functions and configuration objects from there. As a notable example, deduction helpers have been extracted that can be used in three places: the deduction script, the redundancy check, and the consistency worker (for the search page).Also, the database query wrappers in the Svelte application have been removed, since the
db.preparefunction by better-sqlite3 already supports generics, no additional error handling is required, and even additional features like.pluck()and.raw()are available. As a result, both the database application and the SvelteKit application now use the same pattern to access the database.1At the moment, the database application is simply a folder rather than a standalone package. A more systematic solution would be to turn the repository into a monorepo. I experimented with that a while ago, but it introduced enough complexity that I decided against it.