refactor(runner): rename preprocessing to runner and update directory structure

This commit is contained in:
Haoyu Xu
2023-01-17 10:08:22 -05:00
parent 09ca22d7c7
commit 4fa886be90
16 changed files with 34 additions and 30 deletions

32
libs/env_generator.js Normal file
View File

@@ -0,0 +1,32 @@
import path from 'path'
export default class EnvGenerator {
#config
constructor(config, operatorName) {
this.#config = config.operators[operatorName]
}
async generate(dimensions) {
return await this.#promise(dimensions)
}
#promise(dimensions) {
return new Promise((resolve, reject) => {
resolve([
`VITE_TITLE="${this.#config.title}"`,
`VITE_FILENAME=${this.#config.filename.replace('#', '%23')}`,
`VITE_LOGO_FILENAME=${this.#config.logo}`,
`VITE_FALLBACK_FILENAME=${this.#config.fallback_name.replace('#', '%23')}`,
`VITE_VIEWPORT_LEFT=${this.#config.viewport_left}`,
`VITE_VIEWPORT_RIGHT=${this.#config.viewport_right}`,
`VITE_VIEWPORT_TOP=${this.#config.viewport_top}`,
`VITE_VIEWPORT_BOTTOM=${this.#config.viewport_bottom}`,
`VITE_INVERT_FILTER=${this.#config.invert_filter}`,
`VITE_IMAGE_WIDTH=${dimensions[0]}`,
`VITE_IMAGE_HEIGHT=${dimensions[1]}`,
].join('\n'))
})
}
}