feat(aklive2d): add ability to read and increase version number

This commit is contained in:
Haoyu Xu
2023-02-27 16:33:42 -05:00
parent 5c80834c30
commit 00e6916ad1
19 changed files with 64 additions and 21 deletions

View File

@@ -11,3 +11,4 @@ color: rgba(14, 126, 239, 0.85)
codename: codename:
zh-CN: 假日威龙陈 zh-CN: 假日威龙陈
en-US: Ch'en/Chen the Holungday en-US: Ch'en/Chen the Holungday
portrait: null

View File

@@ -11,3 +11,4 @@ color: rgb(255, 133, 34)
codename: codename:
zh-CN: 重岳 zh-CN: 重岳
en-US: Chongyue en-US: Chongyue
portrait: null

View File

@@ -11,3 +11,4 @@ color: rgb(9, 212, 208)
codename: codename:
zh-CN: zh-CN:
en-US: Dusk en-US: Dusk
portrait: null

View File

@@ -11,3 +11,4 @@ color: rgb(29, 185, 53)
codename: codename:
zh-CN: 百练嘉维尔 zh-CN: 百练嘉维尔
en-US: Gavial the Invincible en-US: Gavial the Invincible
portrait: null

View File

@@ -11,3 +11,4 @@ color: rgb(15, 206, 216)
codename: codename:
zh-CN: zh-CN:
en-US: Ling en-US: Ling
portrait: null

View File

@@ -11,3 +11,4 @@ color: rgb(156, 210, 246)
codename: codename:
zh-CN: 夏日餮宴 · 水月 zh-CN: 夏日餮宴 · 水月
en-US: Summer Feast / Mizuki en-US: Summer Feast / Mizuki
portrait: null

View File

@@ -11,3 +11,4 @@ color: rgba(253, 236, 189, 0.95)
codename: codename:
zh-CN: 耀骑士临光 zh-CN: 耀骑士临光
en-US: Nearl the Radiant Knight en-US: Nearl the Radiant Knight
portrait: null

View File

@@ -11,3 +11,4 @@ color: rgb(255, 48, 0)
codename: codename:
zh-CN: zh-CN:
en-US: Nian en-US: Nian
portrait: null

View File

@@ -11,3 +11,4 @@ color: rgb(158, 2, 2)
codename: codename:
zh-CN: 焦点 · 傀影 zh-CN: 焦点 · 傀影
en-US: Focus / Phatom en-US: Focus / Phatom
portrait: null

View File

@@ -11,3 +11,4 @@ color: rgb(23, 210, 236)
codename: codename:
zh-CN: 迷迭香 zh-CN: 迷迭香
en-US: Rosmontis en-US: Rosmontis
portrait: null

View File

@@ -11,3 +11,4 @@ color: rgb(226, 96, 96)
codename: codename:
zh-CN: 浊心斯卡蒂 zh-CN: 浊心斯卡蒂
en-US: Skadi the Corrupting Heart en-US: Skadi the Corrupting Heart
portrait: null

View File

@@ -11,3 +11,4 @@ color: rgba(14, 124, 203, 0.86)
codename: codename:
zh-CN: 归溟幽灵鲨 zh-CN: 归溟幽灵鲨
en-US: Specter the Unchained en-US: Specter the Unchained
portrait: null

View File

@@ -11,3 +11,4 @@ color: rgba(34, 37, 255, 0.9)
codename: codename:
zh-CN: 缄默德克萨斯 zh-CN: 缄默德克萨斯
en-US: Texas the Omertosa en-US: Texas the Omertosa
portrait: null

View File

@@ -11,3 +11,4 @@ color: rgb(228, 54, 56)
codename: codename:
zh-CN: W zh-CN: W
en-US: W en-US: W
portrait: null

View File

@@ -1,5 +1,6 @@
import path from 'path' import path from 'path'
import { read } from './yaml.js' import { read } from './yaml.js'
import { read as readVersion } from './version.js'
export default function () { export default function () {
return process(read(path.join(__projetRoot, 'config.yaml'))) return process(read(path.join(__projetRoot, 'config.yaml')))
@@ -16,5 +17,11 @@ function process(config) {
operator.link = operatorName operator.link = operatorName
} }
// version
config.version = {
showcase: readVersion(path.join(__projetRoot)),
directory: readVersion(path.join(__projetRoot, 'directory')),
}
return config return config
} }

View File

@@ -49,7 +49,7 @@ class Evalable {
} }
version(prefix, suffix) { version(prefix, suffix) {
return `${prefix}${__config.version}${suffix}` return `${prefix}${__config.version.showcase}${suffix}`
} }
#step(location, varName) { #step(location, varName) {

View File

@@ -10,11 +10,20 @@ export default function () {
const targetFolder = path.join(__projetRoot, __config.folder.release, __config.folder.directory); const targetFolder = path.join(__projetRoot, __config.folder.release, __config.folder.directory);
const sourceFolder = path.join(__projetRoot, __config.folder.operator); const sourceFolder = path.join(__projetRoot, __config.folder.operator);
rmdir(targetFolder); rmdir(targetFolder);
const filesToCopy = []; const filesToCopy = Object.keys(__config.operators)
const directoryJson = [] const directoryJson = {
for (const [key, value] of Object.entries(__config.operators)) { operators: Object.values(
filesToCopy.push(key); Object.values(__config.operators)
directoryJson.push(value); .reduce((acc, cur) => {
const date = cur.date
if (acc[date]) {
acc[date].push(cur)
} else {
acc[date] = [cur]
}
return acc
}, {}))
.sort((a, b) => Date.parse(b[0].date) - Date.parse(a[0].date)),
} }
writeSync(JSON.stringify(directoryJson, null), path.join(targetFolder, "directory.json")) writeSync(JSON.stringify(directoryJson, null), path.join(targetFolder, "directory.json"))
filesToCopy.forEach((key) => { filesToCopy.forEach((key) => {

13
libs/version.js Normal file
View File

@@ -0,0 +1,13 @@
import path from 'path'
import { readSync, writeSync } from './file.js'
export function read (dir) {
return readSync(path.join(dir, 'Version'))
}
export function increase(dir) {
// release version will be lagged by 0.0.1
const version = read(dir)
const [major, minor, patch] = version.split('.')
writeSync(`${major}.${minor}.${+patch + 1}`, path.join(dir, 'Version'))
}

View File

@@ -364,7 +364,7 @@ export default class Voice {
#insertHTML() { #insertHTML() {
this.#el.innerHTML = ` this.#el.innerHTML = `
<audio id="${this.#audioElId}" autoplay> <audio id="${this.#audioElId}" autoplay>
<source type="audio/wav"> <source type="audio/ogg" />
</audio> </audio>
<div class="voice-wrapper" id="voice_wrapper"> <div class="voice-wrapper" id="voice_wrapper">
<div class="voice-title" id="voice_title"></div> <div class="voice-title" id="voice_title"></div>