VueUI 2 Part 2 - Reporting tool (#10850)

This commit is contained in:
Karolis
2021-01-09 20:26:42 +02:00
committed by GitHub
parent 3afb45ca70
commit f42430957c
24 changed files with 2564 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
const { Signale } = require('signale')
const Vue = require('vue')
const fs = require('fs-extra')
const stages = require('./stages')
// run
const mainLogger = new Signale({scope: 'main'})
var states = {}
async function runStages () {
mainLogger.time('All Stages')
for (const [i, stage] of stages.entries()) {
const name = stage.name()
const subLogger = mainLogger.scope('stage', name)
mainLogger.time(name)
let result = await Promise.resolve(stage.run(subLogger))
mainLogger.timeEnd(name)
states[i] = result
}
mainLogger.timeEnd('All Stages')
}
// Build HTML
async function generateHTML() {
const app = new Vue(require('./src/app')(states, stages))
const renderer = require('vue-server-renderer').createRenderer()
await fs.outputFile('report.htm', await renderer.renderToString(app))
}
async function main() {
await runStages()
await generateHTML()
}
main()