Phase 6 add CrossWire SWORD imports

This commit is contained in:
2026-07-11 23:31:34 -05:00
parent 564eaea5a0
commit c1721b1705
28 changed files with 23175 additions and 7 deletions
+31
View File
@@ -0,0 +1,31 @@
import { fetchSwordConfCatalog } from './sword-lib.js'
const catalog = await fetchSwordConfCatalog()
const modules = [...catalog.modules.values()]
.map((entry) => ({
id: entry.module_id,
description: scalar(entry.conf.Description),
mod_drv: scalar(entry.conf.ModDrv),
source_type: scalar(entry.conf.SourceType),
license: scalar(entry.conf.DistributionLicense),
lang: scalar(entry.conf.Lang),
}))
.sort((a, b) => a.id.localeCompare(b.id))
for (const module of modules) {
console.log([
module.id.padEnd(24),
module.mod_drv.padEnd(8),
module.source_type.padEnd(8),
module.lang.padEnd(6),
module.license.padEnd(24),
module.description,
].join(' ').trimEnd())
}
console.log(`\n${modules.length} SWORD module(s) listed from ${catalog.source_url}`)
function scalar(value) {
if (Array.isArray(value)) return value.join(', ')
return value ?? ''
}