feat: separate steam build and directory build to save space

This commit is contained in:
Haoyu Xu
2025-05-02 16:57:44 +08:00
parent 065fe5b15e
commit 093f9d7f1a
20 changed files with 503 additions and 373 deletions

View File

@@ -5,34 +5,41 @@ import { envParser, file } from '@aklive2d/libs'
import { copyShowcaseData, copyProjectJSON } from '@aklive2d/vite-helpers'
import * as dirs from './index.js'
const build = async (namesToBuild: string[]) => {
const build = async (namesToBuild: string[], mode: string) => {
const names = !namesToBuild.length ? Object.keys(operators) : namesToBuild
console.log('Generating assets for', names.length, 'operators')
for (const name of names) {
copyShowcaseData(name, {
dataDir: dirs.DATA_DIR,
publicAssetsDir: dirs.PUBLIC_ASSETS_DIR,
mode,
})
await viteBuild()
const releaseDir = path.join(dirs.DIST_DIR, name)
file.mv(dirs.OUT_DIR, releaseDir)
file.rm(dirs.DATA_DIR)
copyProjectJSON(name, {
releaseDir,
})
if (mode !== 'build:directory') {
copyProjectJSON(name, {
releaseDir,
})
}
}
}
async function main() {
const { name } = envParser.parse({
const { name, mode } = envParser.parse({
name: {
type: 'string',
short: 'n',
multiple: true,
default: [],
},
mode: {
type: 'string',
short: 'm',
},
})
await build(name as string[])
await build(name as string[], mode as string)
}
main()