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

@@ -196,9 +196,7 @@ export default function Home() {
key={index} key={index}
> >
<section <section
className={ className={classes.content}
classes.content
}
> >
<section <section
className={ className={
@@ -239,7 +237,8 @@ export default function Home() {
'zh-CN' 'zh-CN'
? entry.type === ? entry.type ===
'skin' 'skin'
? `${entry ? `${
entry
.skinName[ .skinName[
'zh-CN' 'zh-CN'
] ]

View File

@@ -24,7 +24,9 @@ export function useConfig() {
const compiledIds = operators.map((item) => item.official_id.toString()) const compiledIds = operators.map((item) => item.official_id.toString())
const updatedIds = data.info.map((item) => item.id.toString()) const updatedIds = data.info.map((item) => item.id.toString())
const newIds = difference(updatedIds, compiledIds) const newIds = difference(updatedIds, compiledIds)
setNewOperators(data.info.filter((item) => newIds.includes(item.id.toString()))) setNewOperators(
data.info.filter((item) => newIds.includes(item.id.toString()))
)
}, []) }, [])
return { config, operators, newOperators, fetchOfficialUpdate } return { config, operators, newOperators, fetchOfficialUpdate }

View File

@@ -8,6 +8,7 @@
"preview:directory": "turbo run preview:directory --ui tui", "preview:directory": "turbo run preview:directory --ui tui",
"preview": "http-server ./dist", "preview": "http-server ./dist",
"lint": "turbo run lint", "lint": "turbo run lint",
"lint:fix": "turbo run lint:fix",
"update": "turbo run update", "update": "turbo run update",
"init": "turbo run init", "init": "turbo run init",
"download:game": "turbo run download:game", "download:game": "turbo run download:game",

View File

@@ -48,7 +48,9 @@ const download = async (
}) })
mapping.musicFiles.map((item) => { mapping.musicFiles.map((item) => {
if (!file.exists(path.join(item.source, item.filename))) { if (!file.exists(path.join(item.source, item.filename))) {
const filename = item.filename.replace('.ogg', '').replace(/_(intro|loop)/, "") const filename = item.filename
.replace('.ogg', '')
.replace(/_(intro|loop)/, '')
itemToDownload.add(filename) itemToDownload.add(filename)
} }
}) })

View File

@@ -1,7 +1,7 @@
import path from 'node:path' import path from 'node:path'
import { files as backgroundFiles } from '@aklive2d/background'
import config from '@aklive2d/config' import config from '@aklive2d/config'
import { githubDownload } from '@aklive2d/downloader' import { githubDownload } from '@aklive2d/downloader'
import {files as backgroundFiles} from "@aklive2d/background"
import { file } from '@aklive2d/libs' import { file } from '@aklive2d/libs'
import type { import type {
AudioDataTable, AudioDataTable,
@@ -89,23 +89,34 @@ const generateMapping = () => {
for (const e of musicFiles) { for (const e of musicFiles) {
const musicPath = path.join(e.source, e.filename) const musicPath = path.join(e.source, e.filename)
if (!file.exists(musicPath)) { 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)) { for (const e of Object.keys(musicFileMapping)) {
if (!backgroundFiles.includes(e)) { 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) { for (const background of backgroundFiles) {
if (!musicFileMapping[background]) { if (!musicFileMapping[background]) {
const alternativeMatch = background.replace(/_(form)(.*)(\.png)$/, "$3") const alternativeMatch = background.replace(
if (musicFileMapping[alternativeMatch]){ /_(form)(.*)(\.png)$/,
musicFileMapping[background] = structuredClone(musicFileMapping[alternativeMatch]) '$3'
)
if (musicFileMapping[alternativeMatch]) {
musicFileMapping[background] = structuredClone(
musicFileMapping[alternativeMatch]
)
} else { } 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.`
)
} }
} }
} }

View File

@@ -158,7 +158,8 @@ const generateMapping = () => {
: operatorInfo.skinName['en-US'] : operatorInfo.skinName['en-US']
const skinEntry = findSkinEntry(skinTable, name, type) const skinEntry = findSkinEntry(skinTable, name, type)
operator.filename = skinEntry.dynIllustId.replace(/_2$/, '') operator.filename = skinEntry.dynIllustId.replace(/_2$/, '')
operator.portrait_filename = type === 'skin' operator.portrait_filename =
type === 'skin'
? skinEntry.skinId.replace(/@/, '_') ? skinEntry.skinId.replace(/@/, '_')
: `${skinEntry.charId}_2` : `${skinEntry.charId}_2`
operator.fallback_name = `${operator.portrait_filename}${operator.isSP ? '_sp' : ''}` operator.fallback_name = `${operator.portrait_filename}${operator.isSP ? '_sp' : ''}`

View File

@@ -73,7 +73,8 @@ const generateAssets = async (name: string) => {
) as string ) as string
if (!portraitHubContent) throw new Error('portrait_hub.json not found') if (!portraitHubContent) throw new Error('portrait_hub.json not found')
const portraitHub: PortraitHub = JSON.parse(portraitHubContent) const portraitHub: PortraitHub = JSON.parse(portraitHubContent)
const portrait_filename_lowerCase = operators[name].portrait_filename.toLowerCase() const portrait_filename_lowerCase =
operators[name].portrait_filename.toLowerCase()
const portraitItem = portraitHub._sprites.find( const portraitItem = portraitHub._sprites.find(
(item) => item.name.toLowerCase() === portrait_filename_lowerCase (item) => item.name.toLowerCase() === portrait_filename_lowerCase
) )

View File

@@ -8,7 +8,9 @@
"../../packages/assets/dist/**", "../../packages/assets/dist/**",
"src/**" "src/**"
], ],
"dependsOn": ["@aklive2d/showcase#build:directory"], "dependsOn": [
"@aklive2d/showcase#build:directory"
],
"persistent": true "persistent": true
}, },
"@aklive2d/directory#build:directory": { "@aklive2d/directory#build:directory": {
@@ -18,59 +20,97 @@
"../../packages/assets/dist/**", "../../packages/assets/dist/**",
"src/**" "src/**"
], ],
"outputs": ["../../dist/index.html", "../../dist/_assets/**"], "outputs": [
"dependsOn": ["@aklive2d/showcase#build:directory"] "../../dist/index.html",
"../../dist/_assets/**"
],
"dependsOn": [
"@aklive2d/showcase#build:directory"
]
}, },
"@aklive2d/showcase#build:directory": { "@aklive2d/showcase#build:directory": {
"env": ["name"], "env": [
"name"
],
"inputs": [ "inputs": [
"$TURBO_DEFAULT$", "$TURBO_DEFAULT$",
"../../packages/assets/dist/**", "../../packages/assets/dist/**",
"src/**" "src/**"
], ],
"outputs": ["../../release/**"], "outputs": [
"dependsOn": ["@aklive2d/assets#build"] "../../release/**"
],
"dependsOn": [
"@aklive2d/assets#build"
]
}, },
"@aklive2d/showcase#build": { "@aklive2d/showcase#build": {
"env": ["name"], "env": [
"name"
],
"inputs": [ "inputs": [
"$TURBO_DEFAULT$", "$TURBO_DEFAULT$",
"../../packages/assets/dist/**", "../../packages/assets/dist/**",
"src/**" "src/**"
], ],
"outputs": ["../../release/**"], "outputs": [
"dependsOn": ["@aklive2d/assets#build"] "../../release/**"
],
"dependsOn": [
"@aklive2d/assets#build"
]
}, },
"@aklive2d/background#build": { "@aklive2d/background#build": {
"inputs": ["../music/auto_update/music_table.json"], "inputs": [
"outputs": ["dist/bg_*.png", "dist/operator_bg.png"] "../music/auto_update/music_table.json"
],
"outputs": [
"dist/bg_*.png",
"dist/operator_bg.png"
]
}, },
"@aklive2d/charword-table#build": { "@aklive2d/charword-table#build": {
"env": ["name"], "env": [
"name"
],
"inputs": [ "inputs": [
"../official-info/auto_update/official_info.json", "../official-info/auto_update/official_info.json",
"../operator/operators.yaml" "../operator/operators.yaml"
], ],
"outputs": ["dist/**/charword_table.json"] "outputs": [
"dist/**/charword_table.json"
]
}, },
"@aklive2d/operator#build": { "@aklive2d/operator#build": {
"env": ["name"], "env": [
"dependsOn": ["@aklive2d/charword-table#build"], "name"
],
"dependsOn": [
"@aklive2d/charword-table#build"
],
"inputs": [ "inputs": [
"../official-info/auto_update/official_info.json", "../official-info/auto_update/official_info.json",
"operators.yaml" "operators.yaml"
], ],
"outputs": ["dist/**"] "outputs": [
"dist/**"
]
}, },
"@aklive2d/project-json#build": { "@aklive2d/project-json#build": {
"env": ["name"], "env": [
"name"
],
"dependsOn": [ "dependsOn": [
"@aklive2d/background#build", "@aklive2d/background#build",
"@aklive2d/charword-table#build", "@aklive2d/charword-table#build",
"@aklive2d/music#build" "@aklive2d/music#build"
], ],
"inputs": ["../operator/operators.yaml"], "inputs": [
"outputs": ["dist/**"] "../operator/operators.yaml"
],
"outputs": [
"dist/**"
]
}, },
"@aklive2d/assets#build": { "@aklive2d/assets#build": {
"dependsOn": [ "dependsOn": [
@@ -79,22 +119,40 @@
"@aklive2d/operator#build", "@aklive2d/operator#build",
"@aklive2d/project-json#build" "@aklive2d/project-json#build"
], ],
"outputs": ["dist/**"] "outputs": [
"dist/**"
]
}, },
"build": { "build": {
"env": ["name"], "env": [
"dependsOn": ["^build"], "name"
"inputs": ["$TURBO_DEFAULT$"], ],
"outputs": ["release/**"] "dependsOn": [
"^build"
],
"inputs": [
"$TURBO_DEFAULT$"
],
"outputs": [
"release/**"
]
}, },
"build:directory": { "build:directory": {
"env": ["name"], "env": [
"inputs": ["$TURBO_DEFAULT$"], "name"
"outputs": ["dist/**"] ],
"inputs": [
"$TURBO_DEFAULT$"
],
"outputs": [
"dist/**"
]
}, },
"@aklive2d/charword-table#update": { "@aklive2d/charword-table#update": {
"cache": false, "cache": false,
"outputs": ["auto_update/charword_table*.json"] "outputs": [
"auto_update/charword_table*.json"
]
}, },
"@aklive2d/music#update": { "@aklive2d/music#update": {
"cache": false, "cache": false,
@@ -106,74 +164,118 @@
}, },
"@aklive2d/official-info#update": { "@aklive2d/official-info#update": {
"cache": false, "cache": false,
"outputs": ["auto_update/official_info.json"] "outputs": [
"auto_update/official_info.json"
]
}, },
"update": { "update": {
"cache": false "cache": false
}, },
"@aklive2d/operator#init": { "@aklive2d/operator#init": {
"env": ["name", "id"], "env": [
"name",
"id"
],
"cache": false, "cache": false,
"inputs": ["../official-info/auto_update/official_info.json"], "inputs": [
"outputs": ["config/*.yaml", "config.yaml"] "../official-info/auto_update/official_info.json"
],
"outputs": [
"config/*.yaml",
"config.yaml"
]
}, },
"init": { "init": {
"env": ["name", "id"], "env": [
"name",
"id"
],
"cache": false "cache": false
}, },
"lint": { "lint": {
"cache": false "cache": false
}, },
"lint:fix": {
"cache": false
},
"dev:directory": { "dev:directory": {
"env": ["name"], "env": [
"dependsOn": ["^@aklive2d/assets#build"], "name"
],
"dependsOn": [
"^@aklive2d/assets#build"
],
"cache": false, "cache": false,
"persistent": true "persistent": true
}, },
"preview:directory": { "preview:directory": {
"env": ["name"], "env": [
"dependsOn": ["^@aklive2d/assets#build"], "name"
],
"dependsOn": [
"^@aklive2d/assets#build"
],
"cache": false, "cache": false,
"persistent": true "persistent": true
}, },
"dev:showcase": { "dev:showcase": {
"env": ["name"], "env": [
"dependsOn": ["^@aklive2d/assets#build"], "name"
],
"dependsOn": [
"^@aklive2d/assets#build"
],
"cache": false, "cache": false,
"persistent": true "persistent": true
}, },
"preview:showcase": { "preview:showcase": {
"env": ["name"], "env": [
"dependsOn": ["^@aklive2d/showcase#build"], "name"
],
"dependsOn": [
"^@aklive2d/showcase#build"
],
"cache": false, "cache": false,
"persistent": true "persistent": true
}, },
"@aklive2d/assets#download:game": { "@aklive2d/assets#download:game": {
"cache": false, "cache": false,
"outputs": ["data/**"] "outputs": [
"data/**"
]
}, },
"download:game": { "download:game": {
"cache": false "cache": false
}, },
"@aklive2d/assets#build:cleanup": { "@aklive2d/assets#build:cleanup": {
"cache": false, "cache": false,
"dependsOn": ["@aklive2d/directory#build"] "dependsOn": [
"@aklive2d/directory#build"
]
}, },
"@aklive2d/background#build:cleanup": { "@aklive2d/background#build:cleanup": {
"cache": false, "cache": false,
"dependsOn": ["@aklive2d/directory#build"] "dependsOn": [
"@aklive2d/directory#build"
]
}, },
"@aklive2d/charword-table#build:cleanup": { "@aklive2d/charword-table#build:cleanup": {
"cache": false, "cache": false,
"dependsOn": ["@aklive2d/directory#build"] "dependsOn": [
"@aklive2d/directory#build"
]
}, },
"@aklive2d/music#build:cleanup": { "@aklive2d/music#build:cleanup": {
"cache": false, "cache": false,
"dependsOn": ["@aklive2d/directory#build"] "dependsOn": [
"@aklive2d/directory#build"
]
}, },
"@aklive2d/operator#build:cleanup": { "@aklive2d/operator#build:cleanup": {
"cache": false, "cache": false,
"dependsOn": ["@aklive2d/directory#build"] "dependsOn": [
"@aklive2d/directory#build"
]
}, },
"build:cleanup": { "build:cleanup": {
"cache": false "cache": false