build: updated build assets

This commit is contained in:
Haoyu Xu
2023-11-01 15:12:17 -04:00
parent a57cea003d
commit a61e7caa75
3 changed files with 35 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ import Background from './libs/background.js'
import CharwordTable from './libs/charword_table.js';
import Music from './libs/music.js';
import officalUpdate from './libs/offical_update.js';
import LogoInfo from './libs/logo_info.js';
async function main() {
global.__projectRoot = path.dirname(fileURLToPath(import.meta.url))
@@ -27,6 +28,7 @@ async function main() {
const charwordTable = new CharwordTable()
const musicTable = new Music()
const logoTable = new LogoInfo()
/**
* Skip all, no need for OPERATOR_NAME
@@ -54,6 +56,9 @@ async function main() {
case 'music':
await musicTable.process()
process.exit(0)
case 'logo':
await logoTable.process()
process.exit(0)
case 'offical_update':
await officalUpdate()
process.exit(0)

29
libs/logo_info.js Normal file
View File

@@ -0,0 +1,29 @@
/* eslint-disable no-undef */
import path from 'path';
import { writeSync, readSync } from "./file.js"
import Downloader from "./downloader.js"
export default class LogoInfo {
#downloader = new Downloader()
#sharedPath = path.join(__projectRoot, __config.folder.operator, __config.folder.share)
async process() {
const logoTable = await this.#download()
const nameFileMapping = {}
Object.keys(logoTable.forceToGroupDict).forEach(key => {
nameFileMapping[logoTable.forceToGroupDict[key]] = `${key}.png`;
});
// writeSync(JSON.stringify(list, null), path.join(this.#sharedPath, `logo_table.json`))
}
async #download() {
const logoTable = await this.#downloader.github(`https://api.github.com/repos/Kengxxiao/ArknightsGameData/commits?path=zh_CN/gamedata/art/handbookpos_table.json`, `https://raw.githubusercontent.com/Kengxxiao/ArknightsGameData/master/zh_CN/gamedata/art/handbookpos_table.json`, path.join(this.#sharedPath, `handbookpos_table.json`))
return logoTable
}
lookup() {
const logoTable = JSON.parse(readSync(path.join(this.#sharedPath, `logo_table.json`)))
}
}

View File

@@ -12,6 +12,7 @@
"directory": "node aklive2d directory",
"charwords:update": "node aklive2d charwords:update",
"charwords:build": "node aklive2d charwords:build",
"logo": "node aklive2d logo",
"music": "node aklive2d music",
"vite:dev": "vite",
"vite:build": "vite build",