feat(showcase): add operator voice

This commit is contained in:
Haoyu Xu
2023-02-10 17:54:14 -05:00
parent 36afd6d786
commit 59f113e741
10 changed files with 123 additions and 34 deletions

View File

@@ -23,6 +23,7 @@ export default class EnvGenerator {
`VITE_IMAGE_HEIGHT=2048`,
`VITE_BACKGROUND_FILES=${JSON.stringify(this.#assets.backgrounds)}`,
`VITE_BACKGROUND_FOLDER=${__config.folder.background}`,
`VITE_VOICE_FOLDERS=${JSON.stringify(__config.folder.voice)}`,
].join('\n')
}

View File

@@ -53,6 +53,15 @@ export async function copy(sourcePath, targetPath) {
return await fsP.copyFile(sourcePath, targetPath)
}
export async function copyDir(sourcePath, targetPath) {
if (!exists(sourcePath)) {
console.warn(`Source file ${sourcePath} does not exist.`)
return
}
mkdir(targetPath)
return await fsP.cp(sourcePath, targetPath, { recursive: true })
}
export function appendSync(content, filePath) {
return fs.appendFileSync(filePath, content, 'utf8');
}

View File

@@ -5,7 +5,9 @@ import { mkdir, writeSync } from './file.js'
import { appendMainConfig } from './append.js'
export default function init(operatorName, extractedDir) {
mkdir(extractedDir)
extractedDir.forEach((dir) => {
mkdir(dir)
})
const date = new Date()
const template = readYAML(path.join(__dirname, 'config', '_template.yaml'))
template.link = operatorName