feat: updated music and background handling to support _form_x type background

This commit is contained in:
Haoyu Xu
2025-10-05 20:26:10 +08:00
parent 49a49e5210
commit 33c7553506
8 changed files with 39 additions and 32 deletions

View File

@@ -1,7 +1,6 @@
import path from 'node:path'
import config from '@aklive2d/config'
import { file } from '@aklive2d/libs'
import { mapping as musicMapping } from '@aklive2d/music'
import sharp from 'sharp'
export const BACKGROUND_DIR = path.join(
@@ -35,7 +34,6 @@ const filesToBuild = file.readdirSync(EXTRACTED_DIR).filter((f) => {
})
export const build = async () => {
const err = []
file.mkdir(DIST_DIR)
await Promise.all(
filesToBuild.map(async (f) => {
@@ -47,23 +45,6 @@ export const build = async () => {
DEFAULT_BACKGROUND_FILE,
path.join(DIST_DIR, config.module.background.operator_bg_png)
)
const { musicFiles, musicFileMapping } = musicMapping
for (const e of musicFiles) {
const musicPath = path.join(e.source, e.filename)
if (!file.exists(musicPath)) {
err.push(`Music file ${e.filename} is not found in music folder.`)
}
}
files = getFiles()
for (const e of Object.keys(musicFileMapping)) {
if (!files.includes(e)) {
err.push(`Background file ${e} is not found in background folder.`)
}
}
return err
}
const composite = async (filenamePrefix: string, fileExt: string) => {

View File

@@ -7,8 +7,7 @@
"dependencies": {
"sharp": "^0.34.4",
"@aklive2d/libs": "workspace:*",
"@aklive2d/config": "workspace:*",
"@aklive2d/music": "workspace:*"
"@aklive2d/config": "workspace:*"
},
"peerDependencies": {
"typescript": ">=5.9.3"
@@ -19,4 +18,4 @@
"lint:fix": "biome check --write .",
"build:cleanup": "rm -rf ./dist ./data"
}
}
}