11import { OUTPUT_BUNDLE_BROWSER_DIR, PUBLIC_USER_DIR } from "@/build/constants.js";
22import { logger } from "@/utils/logger.js";
3+ import { measureTime } from "@/utils/time-perf.js";
34import fse from "fs-extra";
4- import { checkPort, getRandomPort } from "get-port-please";
55import { H3, serve, serveStatic } from "h3";
66import kleur from "kleur";
77import { readFile, stat } from "node:fs/promises";
@@ -10,10 +10,9 @@ import { join } from "node:path";
1010export async function start() {
1111 logger.log(kleur.bold().magenta("Pranx Start"));
1212
13- const DEFAULT_PORT = 3030;
14- const isPortUsed = await checkPort(DEFAULT_PORT);
13+ measureTime("pranx-start");
1514
16- const PORT = !isPortUsed ? await getRandomPort() : DEFAULT_PORT ;
15+ const PORT = Number(process.env.PORT) || 3030 ;
1716
1817 const app = new H3();
1918
@@ -51,5 +50,11 @@ export async function start() {
5150 });
5251 });
5352
54- serve(app, { port: PORT });
53+ const SERVER = serve(app, { port: PORT });
54+
55+ await SERVER.ready();
56+
57+ const START_TIME = measureTime("pranx-start");
58+
59+ logger.success(`Start in ${START_TIME} ms`);
5560}
0 commit comments