feat(initializer): update the initializer to change template content
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
link: chen
|
link: chen
|
||||||
type: operator
|
|
||||||
date: 2021/08
|
date: 2021/08
|
||||||
|
type: operator
|
||||||
title: 'Arknights: Ch''en/Chen the Holungday - 明日方舟:假日威龙陈'
|
title: 'Arknights: Ch''en/Chen the Holungday - 明日方舟:假日威龙陈'
|
||||||
filename: dyn_illust_char_1013_chen2
|
filename: dyn_illust_char_1013_chen2
|
||||||
logo: logo_rhodes_override
|
logo: logo_rhodes_override
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { mkdir, copy } from './file.js'
|
import { stringify } from 'yaml'
|
||||||
|
import { read as readYAML } from './yaml.js'
|
||||||
|
import { mkdir, writeSync } from './file.js'
|
||||||
import { appendMainConfig } from './append.js'
|
import { appendMainConfig } from './append.js'
|
||||||
|
|
||||||
export default function init(extractedDir) {
|
export default function init(extractedDir) {
|
||||||
mkdir(extractedDir)
|
mkdir(extractedDir)
|
||||||
copy(path.join(__dirname, 'config', '_template.yaml'), path.join(__dirname, 'config', `${__operator_name}.yaml`))
|
const date = new Date()
|
||||||
|
const template = readYAML(path.join(__dirname, 'config', '_template.yaml'))
|
||||||
|
template.link = __operator_name
|
||||||
|
template.date = `${date.getFullYear()}/${(date.getMonth() + 1).toString().padStart(2, '0') }`
|
||||||
|
writeSync(stringify(template), path.join(__dirname, 'config', `${__operator_name}.yaml`))
|
||||||
appendMainConfig(__operator_name, __dirname)
|
appendMainConfig(__operator_name, __dirname)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user