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