Skip to content

Commit 935371d

Browse files
feat(open): switch to cross-platform 'open' package for reliable URL opening across Windows/macOS/Linux
Replace brittle platform-specific 'open' invocation in npm-app/src/client.ts with the cross-platform 'open' package; add dependency in npm-app/package.json; this simplifies login flow and reduces test brittleness. Generated with Codebuff 🤖 Co-Authored-By: Codebuff <noreply@codebuff.com>
1 parent 4200c04 commit 935371d

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

bun.lock

Lines changed: 23 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

npm-app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"micromatch": "^4.0.8",
5555
"nanoid": "5.0.7",
5656
"onetime": "5.1.2",
57+
"open": "^10.2.0",
5758
"picocolors": "1.1.0",
5859
"pino": "9.4.0",
5960
"posthog-node": "4.17.2",

npm-app/src/client.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { spawn } from 'child_process'
2+
import open from 'open'
23
import {
34
existsSync,
45
mkdirSync,
@@ -598,15 +599,9 @@ export class Client {
598599
console.log(responseToUser.join('\n'))
599600

600601
let shouldRequestLogin = true
601-
CLI.getInstance().rl.once('line', () => {
602+
CLI.getInstance().rl.once('line', async () => {
602603
if (shouldRequestLogin) {
603-
const openCommand =
604-
process.platform === 'win32'
605-
? 'start'
606-
: process.platform === 'linux'
607-
? 'xdg-open'
608-
: 'open'
609-
spawn(openCommand, [loginUrl])
604+
await open(loginUrl)
610605
console.log(
611606
"Opened a browser window to log you in! If it doesn't open automatically, you can click this link:",
612607
)

0 commit comments

Comments
 (0)