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

@@ -39,4 +39,4 @@
"sass": "^1.93.2", "sass": "^1.93.2",
"vite": "^7.1.9" "vite": "^7.1.9"
} }
} }

View File

@@ -120,7 +120,7 @@ export default function Home() {
const list = navigationList.filter((item) => { const list = navigationList.filter((item) => {
return ( return (
item.name.toLowerCase().indexOf(searchField.toLowerCase()) !== item.name.toLowerCase().indexOf(searchField.toLowerCase()) !==
-1 || item.type === 'date' -1 || item.type === 'date'
) )
}) })
const newList = [] const newList = []
@@ -188,102 +188,101 @@ export default function Home() {
className={`${classes['styled-selection']}`} className={`${classes['styled-selection']}`}
> >
{newOperators.map((entry, index) => { {newOperators.map((entry, index) => {
return ( return (
<Link <Link
reloadDocument reloadDocument
to={entry.link} to={entry.link}
target="_blank" target="_blank"
key={index} key={index}
>
<section
className={classes.content}
> >
<section <section
className={ className={
classes.content classes.option
} }
> >
<section <section
className={ className={
classes.option classes.outline
} }
/>
<section
className={`${classes.text} ${classes.container}`}
> >
<section <section
className={ className={
classes.outline classes.type
} }
/> >
<CharIcon
type={
entry.type
}
viewBox={
entry.type ===
'operator'
? '0 0 88.969 71.469'
: '0 0 94.563 67.437'
}
/>
</section>
<section <section
className={`${classes.text} ${classes.container}`} className={
classes.title
}
>
{language ===
'zh-CN'
? entry.type ===
'skin'
? `${
entry
.skinName[
'zh-CN'
]
} · ${entry.operatorName}`
: entry.operatorName
: entry
.skinName[
'en-US'
]}
</section>
<section
className={
classes[
'arrow-icon'
]
}
> >
<section <section
className={ className={
classes.type classes.bar
} }
> ></section>
<CharIcon
type={
entry.type
}
viewBox={
entry.type ===
'operator'
? '0 0 88.969 71.469'
: '0 0 94.563 67.437'
}
/>
</section>
<section <section
className={ className={
classes.title classes.bar
} }
> ></section>
{language ===
'zh-CN'
? entry.type ===
'skin'
? `${entry
.skinName[
'zh-CN'
]
} · ${entry.operatorName}`
: entry.operatorName
: entry
.skinName[
'en-US'
]}
</section>
<section <section
className={ className={
classes[ classes.bar
'arrow-icon'
]
} }
> ></section>
<section <section
className={ className={
classes.bar classes.bar
} }
></section> ></section>
<section
className={
classes.bar
}
></section>
<section
className={
classes.bar
}
></section>
<section
className={
classes.bar
}
></section>
</section>
</section> </section>
</section> </section>
</section> </section>
</Link> </section>
) </Link>
})} )
})}
</section> </section>
</section> </section>
</section> </section>
@@ -370,9 +369,9 @@ function OperatorElement({ item, hidden, handleVoicePlay }) {
<span className={classes.text}> <span className={classes.text}>
{ {
item.codename[ item.codename[
language.startsWith('en') language.startsWith('en')
? alternateLang ? alternateLang
: textDefaultLang : textDefaultLang
] ]
} }
</span> </span>

View File

@@ -565,8 +565,8 @@ export default function Operator() {
style={ style={
config.invert_filter config.invert_filter
? { ? {
filter: 'invert(1)', filter: 'invert(1)',
} }
: {} : {}
} }
/> />

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

@@ -13,4 +13,4 @@
"devDependencies": { "devDependencies": {
"@aklive2d/postcss-config": "workspace:*" "@aklive2d/postcss-config": "workspace:*"
} }
} }

View File

@@ -25,4 +25,4 @@
"@aklive2d/vite-helpers": "workspace:*", "@aklive2d/vite-helpers": "workspace:*",
"@aklive2d/module": "workspace:*" "@aklive2d/module": "workspace:*"
} }
} }

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",
@@ -39,4 +40,4 @@
"esbuild", "esbuild",
"sharp" "sharp"
] ]
} }

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

@@ -21,4 +21,4 @@
"lint:fix": "biome check --write .", "lint:fix": "biome check --write .",
"build:cleanup": "rm -rf ./dist" "build:cleanup": "rm -rf ./dist"
} }
} }

View File

@@ -20,4 +20,4 @@
"lint:fix": "biome check --write .", "lint:fix": "biome check --write .",
"build:cleanup": "rm -rf ./dist" "build:cleanup": "rm -rf ./dist"
} }
} }

View File

@@ -14,4 +14,4 @@
"lint": "biome lint --write .", "lint": "biome lint --write .",
"lint:fix": "biome check --write ." "lint:fix": "biome check --write ."
} }
} }

View File

@@ -21,4 +21,4 @@
"@types/yauzl-promise": "^4.0.1", "@types/yauzl-promise": "^4.0.1",
"@types/yazl": "^3.3.0" "@types/yazl": "^3.3.0"
} }
} }

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,25 +89,36 @@ 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.`
)
} }
} }
} }
return { return {

View File

@@ -16,4 +16,4 @@
"lint": "biome lint --write .", "lint": "biome lint --write .",
"lint:fix": "biome check --write ." "lint:fix": "biome check --write ."
} }
} }

View File

@@ -158,9 +158,10 @@ 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 =
? skinEntry.skinId.replace(/@/, '_') type === 'skin'
: `${skinEntry.charId}_2` ? skinEntry.skinId.replace(/@/, '_')
: `${skinEntry.charId}_2`
operator.fallback_name = `${operator.portrait_filename}${operator.isSP ? '_sp' : ''}` operator.fallback_name = `${operator.portrait_filename}${operator.isSP ? '_sp' : ''}`
const regions = Object.keys( const regions = Object.keys(

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

@@ -25,4 +25,4 @@
"devDependencies": { "devDependencies": {
"@types/unidecode": "^1.1.0" "@types/unidecode": "^1.1.0"
} }
} }

View File

@@ -20,4 +20,4 @@
"lint": "biome lint --write .", "lint": "biome lint --write .",
"lint:fix": "biome check --write ." "lint:fix": "biome check --write ."
} }
} }

View File

@@ -21,4 +21,4 @@
"lint": "biome lint --write .", "lint": "biome lint --write .",
"lint:fix": "biome check --write ." "lint:fix": "biome check --write ."
} }
} }

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,77 +164,121 @@
}, },
"@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
} }
} }
} }