Files
aklive2d/apps/showcase/runner.js
Haoyu Xu d6e7bc20d3 feat: migrate to turbo (#22)
* feat: migrate top turbo

* ci: ci test

* fix: fix codeql issues

* feat: ci test

* chore: lint

* chore: misc changes

* feat: rename vite helpers

* feat: use fetch to handle assets

* feat: update directory

* feat: fetch charword table

* feat: migrate download game data and detect missing voice files

* feat: symlink relative path

* feat: finish wrangler upload

* feat: migrate wrangler download

* feat: finish

* chore: auto update

* ci: update ci

* ci: update ci

---------

Co-authored-by: Halyul <Halyul@users.noreply.github.com>
2025-02-22 15:11:30 +08:00

39 lines
1.1 KiB
JavaScript

import path from 'node:path'
import { build as viteBuild } from 'vite'
import operators from '@aklive2d/operator'
import { envParser, file } from '@aklive2d/libs'
import { copyShowcaseData, copyProjectJSON } from '@aklive2d/vite-helpers'
import * as dirs from './index.js'
const build = async (namesToBuild) => {
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,
})
await viteBuild()
const releaseDir = path.join(dirs.DIST_DIR, name)
file.mv(dirs.OUT_DIR, releaseDir)
file.rm(dirs.DATA_DIR)
copyProjectJSON(name, {
releaseDir,
})
}
}
async function main() {
const { name } = envParser.parse({
name: {
type: 'string',
short: 'n',
multiple: true,
default: [],
},
})
await build(name)
}
main()