feat(initializer): update the initializer to change template content

This commit is contained in:
Haoyu Xu
2023-01-20 15:24:20 -05:00
parent 8981f2eb22
commit 580ad1d18d
3 changed files with 10 additions and 4 deletions

View File

@@ -1 +1 @@
3.1.0
3.2.0

View File

@@ -1,6 +1,6 @@
link: chen
type: operator
date: 2021/08
type: operator
title: 'Arknights: Ch''en/Chen the Holungday - 明日方舟:假日威龙陈'
filename: dyn_illust_char_1013_chen2
logo: logo_rhodes_override

View File

@@ -1,9 +1,15 @@
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'
export default function init(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)
}