From abd685d7f484bfc17b20a008e8a79fec01455445 Mon Sep 17 00:00:00 2001 From: Rizumu Ayaka Date: Sat, 17 Aug 2024 12:42:29 +0800 Subject: [PATCH] workflow: improve the benchmark scripts --- benchmark/index.js | 13 ++++++++++++- benchmark/package.json | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/benchmark/index.js b/benchmark/index.js index d5ca30893..2d4eedf64 100644 --- a/benchmark/index.js +++ b/benchmark/index.js @@ -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) +} diff --git a/benchmark/package.json b/benchmark/package.json index 8061adff9..091db7a40 100644 --- a/benchmark/package.json +++ b/benchmark/package.json @@ -5,6 +5,7 @@ "license": "MIT", "type": "module", "scripts": { + "dev": "pnpm start --noHeadless --skipBench --vdom", "start": "node index.js" }, "dependencies": {