style: linted files and added lint:fix

This commit is contained in:
Haoyu Xu
2025-10-05 20:50:22 +08:00
parent 33c7553506
commit 8bf964bef1
20 changed files with 270 additions and 151 deletions

View File

@@ -1,7 +1,7 @@
import path from 'node:path'
import { files as backgroundFiles } from '@aklive2d/background'
import config from '@aklive2d/config'
import { githubDownload } from '@aklive2d/downloader'
import {files as backgroundFiles} from "@aklive2d/background"
import { file } from '@aklive2d/libs'
import type {
AudioDataTable,
@@ -89,25 +89,36 @@ const generateMapping = () => {
for (const e of musicFiles) {
const musicPath = path.join(e.source, e.filename)
if (!file.exists(musicPath)) {
throw new Error(`Music file ${e.filename} is not found in music folder.`)
throw new Error(
`Music file ${e.filename} is not found in music folder.`
)
}
}
for (const e of Object.keys(musicFileMapping)) {
if (!backgroundFiles.includes(e)) {
throw new Error(`Background file ${e} is not found in background folder.`)
throw new Error(
`Background file ${e} is not found in background folder.`
)
}
}
for (const background of backgroundFiles) {
if (!musicFileMapping[background]) {
const alternativeMatch = background.replace(/_(form)(.*)(\.png)$/, "$3")
if (musicFileMapping[alternativeMatch]){
musicFileMapping[background] = structuredClone(musicFileMapping[alternativeMatch])
if (!musicFileMapping[background]) {
const alternativeMatch = background.replace(
/_(form)(.*)(\.png)$/,
'$3'
)
if (musicFileMapping[alternativeMatch]) {
musicFileMapping[background] = structuredClone(
musicFileMapping[alternativeMatch]
)
} else {
throw new Error(`Music mapping for background file ${background} is not found in music mapping.`)
throw new Error(
`Music mapping for background file ${background} is not found in music mapping.`
)
}
}
}
}
return {