Consolidate the three duplicate Bible-book lookup tables into one shared registry
Publish Container / docker (push) Successful in 14m9s
Publish Container / docker (push) Successful in 14m9s
src/App.tsx (Scripture Index book map) and server/routes/bible-passage.js (BSB/bolls.life passage fetch) each hand-maintained their own independent 66-book list with a different key format (3-letter USFM id vs bolls.life's numeric id), so a future alias/rename fix in one would silently not apply to the other. Add shared/bible-books.js as the single canonical list (name + aliases + USFM id, in canonical order); the server derives its numeric bolls.life ids from the array position instead of hand-maintaining a second table. Requires allowJs + including shared/ in tsconfig.app.json so the client can import the plain-JS module alongside its TypeScript sources. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016Yvx4rPVy2HWe7ubuk3X3J
This commit is contained in:
1 parent
c158fb6317
commit
335a9cbe31
4 files changed
+107
-86
No files matched your search
+4
-69
@@ -12,6 +12,7 @@ import { usePageMeta } from './hooks/usePageMeta'
|
||||
import { useGlobalSearch } from './hooks/useGlobalSearch'
|
||||
import { GlobalSearch } from './components/GlobalSearch'
|
||||
import { EpisodeAudioPlayer } from './components/EpisodeAudioPlayer'
|
||||
import { BIBLE_BOOKS } from '../shared/bible-books.js'
|
||||
import './App.css'
|
||||
import { sendEvent, useScrollDepthTracking, useTimeOnPage, useUTMCapture, useLinkClickTracking } from './analytics'
|
||||
|
||||
@@ -1983,75 +1984,9 @@ function ResourcesPage({ content }: { content: SiteContent }) {
|
||||
)
|
||||
}
|
||||
|
||||
const BIBLE_BOOKS: Array<{ id: string; name: string; aliases?: string[] }> = [
|
||||
{ id: 'GEN', name: 'Genesis', aliases: ['gen'] },
|
||||
{ id: 'EXO', name: 'Exodus', aliases: ['exo'] },
|
||||
{ id: 'LEV', name: 'Leviticus', aliases: ['lev'] },
|
||||
{ id: 'NUM', name: 'Numbers', aliases: ['num'] },
|
||||
{ id: 'DEU', name: 'Deuteronomy', aliases: ['deut'] },
|
||||
{ id: 'JOS', name: 'Joshua', aliases: ['josh'] },
|
||||
{ id: 'JDG', name: 'Judges', aliases: ['judg'] },
|
||||
{ id: 'RUT', name: 'Ruth' },
|
||||
{ id: 'SA1', name: '1 Samuel', aliases: ['1 sam'] },
|
||||
{ id: 'SA2', name: '2 Samuel', aliases: ['2 sam'] },
|
||||
{ id: 'KI1', name: '1 Kings', aliases: ['1 kgs'] },
|
||||
{ id: 'KI2', name: '2 Kings', aliases: ['2 kgs'] },
|
||||
{ id: 'CH1', name: '1 Chronicles', aliases: ['1 chr'] },
|
||||
{ id: 'CH2', name: '2 Chronicles', aliases: ['2 chr'] },
|
||||
{ id: 'EZR', name: 'Ezra' },
|
||||
{ id: 'NEH', name: 'Nehemiah', aliases: ['neh'] },
|
||||
{ id: 'EST', name: 'Esther', aliases: ['esth'] },
|
||||
{ id: 'JOB', name: 'Job' },
|
||||
{ id: 'PSA', name: 'Psalms', aliases: ['ps', 'psa', 'psalm'] },
|
||||
{ id: 'PRO', name: 'Proverbs', aliases: ['prov'] },
|
||||
{ id: 'ECC', name: 'Ecclesiastes', aliases: ['eccl'] },
|
||||
{ id: 'SNG', name: 'Song of Solomon', aliases: ['song'] },
|
||||
{ id: 'ISA', name: 'Isaiah', aliases: ['isa'] },
|
||||
{ id: 'JER', name: 'Jeremiah', aliases: ['jer'] },
|
||||
{ id: 'LAM', name: 'Lamentations', aliases: ['lam'] },
|
||||
{ id: 'EZK', name: 'Ezekiel', aliases: ['ezek'] },
|
||||
{ id: 'DAN', name: 'Daniel', aliases: ['dan'] },
|
||||
{ id: 'HOS', name: 'Hosea', aliases: ['hos'] },
|
||||
{ id: 'JOL', name: 'Joel' },
|
||||
{ id: 'AMO', name: 'Amos' },
|
||||
{ id: 'OBA', name: 'Obadiah', aliases: ['obad'] },
|
||||
{ id: 'JNA', name: 'Jonah' },
|
||||
{ id: 'MIC', name: 'Micah', aliases: ['mic'] },
|
||||
{ id: 'NAH', name: 'Nahum', aliases: ['nah'] },
|
||||
{ id: 'HAB', name: 'Habakkuk', aliases: ['hab'] },
|
||||
{ id: 'ZEP', name: 'Zephaniah', aliases: ['zeph'] },
|
||||
{ id: 'HAG', name: 'Haggai', aliases: ['hag'] },
|
||||
{ id: 'ZEC', name: 'Zechariah', aliases: ['zech'] },
|
||||
{ id: 'MAL', name: 'Malachi', aliases: ['mal'] },
|
||||
{ id: 'MAT', name: 'Matthew', aliases: ['matt'] },
|
||||
{ id: 'MRK', name: 'Mark' },
|
||||
{ id: 'LUK', name: 'Luke' },
|
||||
{ id: 'JHN', name: 'John' },
|
||||
{ id: 'ACT', name: 'Acts' },
|
||||
{ id: 'ROM', name: 'Romans', aliases: ['rom'] },
|
||||
{ id: 'CO1', name: '1 Corinthians', aliases: ['1 cor'] },
|
||||
{ id: 'CO2', name: '2 Corinthians', aliases: ['2 cor'] },
|
||||
{ id: 'GAL', name: 'Galatians', aliases: ['gal'] },
|
||||
{ id: 'EPH', name: 'Ephesians', aliases: ['eph'] },
|
||||
{ id: 'PHP', name: 'Philippians', aliases: ['phil'] },
|
||||
{ id: 'COL', name: 'Colossians', aliases: ['col'] },
|
||||
{ id: 'TH1', name: '1 Thessalonians', aliases: ['1 thess'] },
|
||||
{ id: 'TH2', name: '2 Thessalonians', aliases: ['2 thess'] },
|
||||
{ id: 'TI1', name: '1 Timothy', aliases: ['1 tim'] },
|
||||
{ id: 'TI2', name: '2 Timothy', aliases: ['2 tim'] },
|
||||
{ id: 'TIT', name: 'Titus' },
|
||||
{ id: 'PHM', name: 'Philemon', aliases: ['philem'] },
|
||||
{ id: 'HEB', name: 'Hebrews', aliases: ['heb'] },
|
||||
{ id: 'JAM', name: 'James', aliases: ['jas'] },
|
||||
{ id: 'PE1', name: '1 Peter', aliases: ['1 pet'] },
|
||||
{ id: 'PE2', name: '2 Peter', aliases: ['2 pet'] },
|
||||
{ id: 'JO1', name: '1 John' },
|
||||
{ id: 'JO2', name: '2 John' },
|
||||
{ id: 'JO3', name: '3 John' },
|
||||
{ id: 'JDE', name: 'Jude', aliases: ['jude'] },
|
||||
{ id: 'REV', name: 'Revelation', aliases: ['rev'] },
|
||||
]
|
||||
|
||||
// Canonical book list lives in shared/bible-books.js so the client (Scripture
|
||||
// Index book matching, below) and the server (server/routes/bible-passage.js,
|
||||
// the BSB passage-fetch API) can't drift out of sync with each other.
|
||||
const SI_BOOK_MAP: Record<string, string> = {}
|
||||
const SI_BOOK_NAME: Record<string, string> = {}
|
||||
const SI_BOOK_ORDER: string[] = []
|
||||
|
||||
Reference in new issue
Block a user