Fix many errors
Some checks failed
On Push Deploy / deploy (push) Has been cancelled

This commit is contained in:
Johnny322
2026-02-08 16:10:48 +01:00
parent 54cf7d870c
commit e50dd7f8b2

View File

@@ -25,15 +25,21 @@ type GameMap = Record<
} }
> >
const globEager = (pattern: string) =>
(import.meta.glob(pattern, { eager: true, import: 'default' } as any) as unknown) as Record<
string,
string
>
const songFiles = { const songFiles = {
...import.meta.globEager('./Data/*/*/Songs/*.mp3'), ...globEager('./Data/*/*/Songs/*.mp3'),
...import.meta.globEager('./Data/*/*/songs/*.mp3') ...globEager('./Data/*/*/songs/*.mp3')
} as Record<string, { default: string }> }
const answerFiles = { const answerFiles = {
...import.meta.globEager('./Data/*/*/Answers/*.mp3'), ...globEager('./Data/*/*/Answers/*.mp3'),
...import.meta.globEager('./Data/*/*/answers/*.mp3') ...globEager('./Data/*/*/answers/*.mp3')
} as Record<string, { default: string }> }
const getParts = (path: string) => { const getParts = (path: string) => {
const normalized = path.replace(/\\/g, '/') const normalized = path.replace(/\\/g, '/')
@@ -75,12 +81,12 @@ 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, module]) => { Object.entries(songFiles).forEach(([path, url]) => {
addEntry(games, getParts(path), module.default) addEntry(games, getParts(path), url)
})
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) => { return Object.values(games).map((game) => {
const categories = Object.values(game.categories).map((category) => { const categories = Object.values(game.categories).map((category) => {