1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-08-04 05:11:58 +00:00

fix: error while compiling on Windows (#846)

This commit is contained in:
2025-08-01 14:50:54 +02:00
committed by GitHub
parent dc26879060
commit cfef533c75
5 changed files with 14 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ import { Set, SupportedLanguages } from '../../../interfaces'
import { SetResume, Set as SetSingle } from '../../../meta/definitions/api'
import { cardToCardSimple, getCards } from './cardUtil'
import { DB_PATH, fetchRemoteFile, getDataFolder, resolveText, setIsLegal, smartGlob } from './util'
import path from 'node:path'
interface t {
[key: string]: Set
@@ -37,7 +38,9 @@ export async function getSet(name: string, serie = '*', lang: SupportedLanguages
// Dont use cache as it wont necessary have them all
export async function getSets(serie = '*', lang: SupportedLanguages): Promise<Array<Set>> {
// list sets names
const rawSets = (await smartGlob(`${DB_PATH}/${getDataFolder(lang)}/${serie}/*.ts`)).map((set) => set.substring(set.lastIndexOf('/') + 1, set.lastIndexOf('.')))
const rawSets = (await smartGlob(`${DB_PATH}/${getDataFolder(lang)}/${serie}/*.ts`))
.map((it) => it.replaceAll(path.sep, '/'))
.map((set) => set.substring(set.lastIndexOf('/') + 1, set.lastIndexOf('.')))
// Fetch sets
const sets = (await Promise.all(rawSets.map((set) => getSet(set, serie, lang))))
// Filter sets