Skip to content

Commit 674ca46

Browse files
committed
fix(cli): log versions in main process
1 parent 359a728 commit 674ca46

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/cli/main.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export async function main(mainOpts: MainOptions): Promise<void> {
1818
process.stdout.write(versions(mainOpts).join("\n") + "\n");
1919
process.exit(0);
2020
}
21+
2122
// Handle help flag
2223
if (cliOpts.help) {
2324
console.log(usage(mainOpts));
@@ -37,9 +38,12 @@ export async function main(mainOpts: MainOptions): Promise<void> {
3738

3839
// Running in a child process
3940
if (process.send) {
40-
return startServer(mainOpts, cliOpts);
41+
return startServer(cliOpts);
4142
}
4243

44+
// Log versions
45+
console.log(c.gray([...versions(mainOpts), cliOpts.prod ? "prod" : "dev"].join(" · ")));
46+
4347
// Resolve .env files
4448
const envFiles = [".env", cliOpts.prod ? ".env.production" : ".env.local"].filter((f) =>
4549
existsSync(f),
@@ -56,7 +60,7 @@ export async function main(mainOpts: MainOptions): Promise<void> {
5660
for (const envFile of [...envFiles].reverse() /* overrides first */) {
5761
process.loadEnvFile?.(envFile);
5862
}
59-
await startServer(mainOpts, cliOpts);
63+
await startServer(cliOpts);
6064
return;
6165
}
6266

@@ -151,8 +155,7 @@ function parseArgs(args: string[]): CLIOptions {
151155
return { mode, ...values, url, method };
152156
}
153157

154-
async function startServer(mainOpts: MainOptions, cliOpts: CLIOptions) {
155-
console.log(c.gray([...versions(mainOpts), cliOpts.prod ? "prod" : "dev"].join(" · ")));
158+
async function startServer(cliOpts: CLIOptions) {
156159
setupProcessErrorHandlers();
157160
await cliServe(cliOpts);
158161
}

0 commit comments

Comments
 (0)