Skip to content

Commit 8d25017

Browse files
authored
fix URL shown in console (#200)
1 parent 7a14871 commit 8d25017

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

bin/serve.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,11 @@ export async function serve(serveDirectory, key) {
5656
port++
5757
}
5858
}
59-
console.log(`hyperparam server running on http://localhost:${port}`)
60-
const isDev = process.env.NODE_ENV === 'development'
61-
if (!isDev) {
62-
if (!key) openUrl(`http://localhost:${port}`)
63-
else {
64-
key = encodeURIComponent(key)
65-
openUrl(`http://localhost:${port}/files?key=${key}`)
66-
}
59+
const path = key ? `/files?key=${encodeURIComponent(key)}` : '/'
60+
const url = `http://localhost:${port}${path}`
61+
console.log(`hyperparam server running on ${url}`)
62+
if (process.env.NODE_ENV !== 'development') {
63+
openUrl(url)
6764
}
6865
}
6966

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"test": "vitest run",
4444
"typecheck": "tsc --noEmit",
4545
"url": "run-p -l watch:ts watch:vite watch:url",
46+
"preurl": "npm run build",
4647
"watch:ts": "tsc --watch",
4748
"watch:vite": "vite build --watch",
4849
"watch:serve": "NODE_ENV=development nodemon bin/cli.js",

0 commit comments

Comments
 (0)