workflow: improve the benchmark scripts

This commit is contained in:
Rizumu Ayaka 2024-08-17 12:42:29 +08:00
parent 7b3c1766be
commit abd685d7f4
No known key found for this signature in database
2 changed files with 13 additions and 1 deletions

View File

@ -177,7 +177,7 @@ async function buildApp(isVapor) {
function startServer() {
const server = connect().use(sirv('./client/dist')).listen(port)
console.info(`\n\nServer started at`, colors.blue(`http://localhost:${port}`))
printPort(port)
process.on('SIGTERM', () => server.close())
return server
}
@ -338,3 +338,14 @@ function compute(array) {
function round(n) {
return +n.toFixed(2)
}
/** @param {number} port */
function printPort(port) {
const vaporLink = !noVapor
? `\nVapor: ${colors.blue(`http://localhost:${port}/vapor`)}`
: ''
const vdomLink = vdom
? `\nvDom: ${colors.blue(`http://localhost:${port}/vdom`)}`
: ''
console.info(`\n\nServer started at`, vaporLink, vdomLink)
}

View File

@ -5,6 +5,7 @@
"license": "MIT",
"type": "module",
"scripts": {
"dev": "pnpm start --noHeadless --skipBench --vdom",
"start": "node index.js"
},
"dependencies": {