feat(aklive2d): use offical_update to fetch info
This commit is contained in:
@@ -5,13 +5,19 @@ import { read as readYAML } from './yaml.js'
|
||||
import { mkdir, writeSync } from './file.js'
|
||||
import { appendMainConfig } from './append.js'
|
||||
|
||||
export default function init(operatorName, extractedDir) {
|
||||
export default function init(operatorName, extractedDir, officalInfo) {
|
||||
const officalId = process.argv[4]
|
||||
const template = readYAML(path.join(__projectRoot, 'config', '_template.yaml'))
|
||||
extractedDir.forEach((dir) => {
|
||||
mkdir(dir)
|
||||
})
|
||||
const date = new Date()
|
||||
const template = readYAML(path.join(__projectRoot, 'config', '_template.yaml'))
|
||||
template.date = `${date.getFullYear()}/${(date.getMonth() + 1).toString().padStart(2, '0') }`
|
||||
const currentOpertor = officalInfo.find(officalId);
|
||||
if (currentOpertor === undefined) {
|
||||
throw new Error('Invalid operator id')
|
||||
}
|
||||
template.offical_id = currentOpertor.id
|
||||
template.codename = currentOpertor.codename
|
||||
|
||||
writeSync(stringify(template), path.join(__projectRoot, 'config', `${operatorName}.yaml`))
|
||||
appendMainConfig(operatorName)
|
||||
}
|
||||
Reference in New Issue
Block a user