iamnbutler/shelfgoblinPublic

Shelf Goblin — discover LitRPG audiobooks, follow series, and track your library.

Add JSON exporter from database to static files

Creates `scripts/backend/exporters/json.ts` that reads book data from a
SQLite database and exports filtered, transformed JSON to static/data/.

Key features:
- Queries books by year with proper series deduplication (picks primary
  series via subquery to avoid duplicate rows from multi-series books)
- Export-time filters: content (harem/erotic), AI narration, quality
  score, and subgenre — all configurable via export-filters.json
- Generates per-year JSON files matching the frontend Book interface
- Generates meta.json with freshness metadata and year counts
- Database connection wrapped in try/finally to prevent leaks
- Runtime formatting handles singular "1 hr" correctly

Run with: npm run db:export

Closes #30

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
C4TATasks Agent and Claude Opus 4.6 authored committed by iamnbutler
468fb8dPatch
Parenta4342b3
2 files changed+309-0
StackedSplit
scripts/backend/config/export-filters.json+19 −0
scripts/backend/exporters/json.ts+290 −0