1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-06-14 08:39:17 +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

@ -118,7 +118,7 @@ export async function cardToCardSingle(localId: string, card: Card, lang: Suppor
* @returns [the local id, the Card object]
*/
export async function getCard(serie: string, setName: string, id: string): Promise<Card> {
return (await import(`../../${DB_PATH}/data/${serie}/${setName}/${id}.js`)).default
return (await import(`../../${DB_PATH}/data/${serie}/${setName}/${id}.ts`)).default
}
/**
@ -128,7 +128,7 @@ export async function getCard(serie: string, setName: string, id: string): Promi
* @returns An array with the 0 = localId, 1 = Card Object
*/
export async function getCards(lang: SupportedLanguages, set?: Set): Promise<Array<[string, Card]>> {
const cards = await smartGlob(`${DB_PATH}/data/${(set && set.serie.name.en) ?? '*'}/${(set && set.name.en) ?? '*'}/*.js`)
const cards = await smartGlob(`${DB_PATH}/data/${(set && set.serie.name.en) ?? '*'}/${(set && set.name.en) ?? '*'}/*.ts`)
const list: Array<[string, Card]> = []
for (const path of cards) {
let items = path.split('/')