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:
@@ -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
|
||||
|
Reference in New Issue
Block a user