1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-06-16 01:19:18 +00:00

feat: Move internals to bunJS (#459)

This commit is contained in:
2024-01-03 00:40:03 +01:00
committed by GitHub
parent f8c1d7dce9
commit 034b7e2cec
14 changed files with 95 additions and 4359 deletions

View File

@ -1,10 +1,10 @@
import { Serie, Set, SupportedLanguages } from '../../../interfaces'
import { SerieResume, Serie as SerieSingle } from '../../../meta/definitions/api'
import { getSets, setToSetSimple } from './setUtil'
import { DB_PATH, smartGlob } from './util'
import { setToSetSimple, getSets } from './setUtil'
import { Serie, SupportedLanguages, Set } from '../../../interfaces'
import { Serie as SerieSingle, SerieResume } from '../../../meta/definitions/api'
export async function getSerie(name: string): Promise<Serie> {
return (await import(`../../${DB_PATH}/data/${name}.js`)).default
return (await import(`../../${DB_PATH}/data/${name}.ts`)).default
}
export async function isSerieAvailable(serie: Serie, lang: SupportedLanguages): Promise<boolean> {
@ -16,7 +16,7 @@ export async function isSerieAvailable(serie: Serie, lang: SupportedLanguages):
}
export async function getSeries(lang: SupportedLanguages): Promise<Array<Serie>> {
let series: Array<Serie> = (await Promise.all((await smartGlob(`${DB_PATH}/data/*.js`))
let series: Array<Serie> = (await Promise.all((await smartGlob(`${DB_PATH}/data/*.ts`))
// Find Serie's name
.map((it) => it.substring(it.lastIndexOf('/') + 1, it.length - 3))
// Fetch the Serie