Skip to content

Commit 8309be7

Browse files
feat(ux): improve debug info for run script (#619)
Signed-off-by: Victor Adossi <[email protected]>
1 parent 5159984 commit 8309be7

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

examples/components/http-hello-world/demo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async function main() {
3838
// Wait for the server to start
3939
await new Promise((resolve) => {
4040
proc.stderr.on("data", (data) => {
41-
if (data.includes("Server listening on port")) {
41+
if (data.includes("Server listening")) {
4242
resolve();
4343
}
4444
});

src/cmd/run.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import process from 'node:process';
77
import { fileURLToPath, pathToFileURL } from 'node:url';
88
import c from 'chalk-template';
99

10+
const DEFAULT_SERVE_HOST = 'localhost';
11+
1012
export async function run(componentPath, args, opts) {
1113
// Ensure that `args` is an array
1214
args = [...args];
@@ -42,6 +44,7 @@ export async function serve(componentPath, args, opts) {
4244
}
4345
// Ensure that `args` is an array
4446
args = [...args];
47+
host = host ?? DEFAULT_SERVE_HOST;
4548
return runComponent(
4649
componentPath,
4750
args,
@@ -66,7 +69,7 @@ export async function serve(componentPath, args, opts) {
6669
`
6770
: `server.listen(port, ${JSON.stringify(host)})`
6871
}
69-
console.error(\`Server listening on port...\`);
72+
console.error(\`Server listening @ ${host}:${port}...\`);
7073
`
7174
);
7275
}

0 commit comments

Comments
 (0)