This commit is contained in:
@@ -26,26 +26,14 @@ type GameMap = Record<
|
||||
>
|
||||
|
||||
const songFiles = {
|
||||
...(import.meta.glob('./Data/*/*/Songs/*.mp3', {
|
||||
eager: true,
|
||||
import: 'default'
|
||||
} as any) as unknown as Record<string, string>),
|
||||
...(import.meta.glob('./Data/*/*/songs/*.mp3', {
|
||||
eager: true,
|
||||
import: 'default'
|
||||
} as any) as unknown as Record<string, string>)
|
||||
}
|
||||
...(import.meta as any).globEager('./Data/*/*/Songs/*.mp3'),
|
||||
...(import.meta as any).globEager('./Data/*/*/songs/*.mp3')
|
||||
} as Record<string, { default: string }>
|
||||
|
||||
const answerFiles = {
|
||||
...(import.meta.glob('./Data/*/*/Answers/*.mp3', {
|
||||
eager: true,
|
||||
import: 'default'
|
||||
} as any) as unknown as Record<string, string>),
|
||||
...(import.meta.glob('./Data/*/*/answers/*.mp3', {
|
||||
eager: true,
|
||||
import: 'default'
|
||||
} as any) as unknown as Record<string, string>)
|
||||
}
|
||||
...(import.meta as any).globEager('./Data/*/*/Answers/*.mp3'),
|
||||
...(import.meta as any).globEager('./Data/*/*/answers/*.mp3')
|
||||
} as Record<string, { default: string }>
|
||||
|
||||
const getParts = (path: string) => {
|
||||
const normalized = path.replace(/\\/g, '/')
|
||||
@@ -87,11 +75,11 @@ const addEntry = (target: GameMap, info: ReturnType<typeof getParts>, url: strin
|
||||
|
||||
const buildGameData = (): Game[] => {
|
||||
const games: GameMap = {}
|
||||
Object.entries(songFiles).forEach(([path, url]) => {
|
||||
addEntry(games, getParts(path), url)
|
||||
Object.entries(songFiles).forEach(([path, module]) => {
|
||||
addEntry(games, getParts(path), module.default)
|
||||
})
|
||||
Object.entries(answerFiles).forEach(([path, url]) => {
|
||||
addEntry(games, getParts(path), url)
|
||||
Object.entries(answerFiles).forEach(([path, module]) => {
|
||||
addEntry(games, getParts(path), module.default)
|
||||
})
|
||||
|
||||
return Object.values(games).map((game) => {
|
||||
|
||||
Reference in New Issue
Block a user