This commit is contained in:
@@ -25,15 +25,15 @@ type GameMap = Record<
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|
||||||
const songFiles = {
|
const songFiles = import.meta.globEager('./Data/*/*/songs/*.mp3') as Record<
|
||||||
...(import.meta as any).globEager('./Data/*/*/Songs/*.mp3'),
|
string,
|
||||||
...(import.meta as any).globEager('./Data/*/*/songs/*.mp3')
|
{ default: string }
|
||||||
} as Record<string, { default: string }>
|
>
|
||||||
|
|
||||||
const answerFiles = {
|
const answerFiles = import.meta.globEager('./Data/*/*/answers/*.mp3') as Record<
|
||||||
...(import.meta as any).globEager('./Data/*/*/Answers/*.mp3'),
|
string,
|
||||||
...(import.meta as any).globEager('./Data/*/*/answers/*.mp3')
|
{ default: string }
|
||||||
} as Record<string, { default: string }>
|
>
|
||||||
|
|
||||||
const getParts = (path: string) => {
|
const getParts = (path: string) => {
|
||||||
const normalized = path.replace(/\\/g, '/')
|
const normalized = path.replace(/\\/g, '/')
|
||||||
@@ -67,9 +67,7 @@ const addEntry = (target: GameMap, info: ReturnType<typeof getParts>, url: strin
|
|||||||
clues: []
|
clues: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const normalizedType = type?.toLowerCase()
|
const bucket = type === 'Songs' ? 'songs' : 'answers'
|
||||||
if (normalizedType !== 'songs' && normalizedType !== 'answers') return
|
|
||||||
const bucket = normalizedType === 'songs' ? 'songs' : 'answers'
|
|
||||||
target[game].categories[category][bucket][number] = url
|
target[game].categories[category][bucket][number] = url
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +78,7 @@ const buildGameData = (): Game[] => {
|
|||||||
})
|
})
|
||||||
Object.entries(answerFiles).forEach(([path, module]) => {
|
Object.entries(answerFiles).forEach(([path, module]) => {
|
||||||
addEntry(games, getParts(path), module.default)
|
addEntry(games, getParts(path), module.default)
|
||||||
})
|
})
|
||||||
|
|
||||||
return Object.values(games).map((game) => {
|
return Object.values(games).map((game) => {
|
||||||
const categories = Object.values(game.categories).map((category) => {
|
const categories = Object.values(game.categories).map((category) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user