feat(runner): updated the way runner works

This commit is contained in:
Haoyu Xu
2023-01-17 20:29:26 -05:00
parent 4fa886be90
commit 61e5ffd214
8 changed files with 118 additions and 73 deletions

View File

@@ -1,12 +1,28 @@
import { execSync } from 'child_process'
import { createServer, build } from 'vite'
export function buildAll(config) {
for (const [key, _] of Object.entries(config.operators)) {
if (key.startsWith('_')) break;
console.log(execSync(`O=${key} node runner.js && O=${key} pnpm run build`).toString());
console.log(execSync(`node runner.js --build ${key}`).toString());
}
}
export function runDev(config) {
export function runDev(rootDir) {
; (async () => {
const server = await createServer({
root: rootDir,
})
await server.listen()
server.printUrls()
})()
}
export function runBuild(rootDir) {
; (async () => {
await build({
root: rootDir,
})
})()
}