New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI: Fix open storybook in default browser #16844
CLI: Fix open storybook in default browser #16844
Conversation
Nx Cloud ReportCI ran the following commands for commit 3a7ab52. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch
Sent with 💌 from NxCloud. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@richorrichard Thanks so much for taking this on! 🙏 A couple comments/questions:
name: 'firefox', | ||
}, | ||
}); | ||
} catch (error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move the try/catch
around the whole thing to remove duplicate code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call - I adjusted in the following commit.
browser by default. | ||
`); | ||
} | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't the logic be switched here where we use betterOpn
for chrome/chromium only, and then use open
for everything else? my understanding of the original issue is that betterOpn
always prefers chrome if it's available and that's what was annoying users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also much simpler. I was originally turned off to this idea because of the way betterOpn triages versions of chrome. I updated to test for Chrome and checked it against every browser I could get my hands on for Mac and this approach works wonderfully, and it's much simpler to read. Thanks for the feedback and review!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome -- thanks so much for the follow-up, this turned out great!
You're very welcome! I'm looking forward to moving on to my next contribution :) Last question - I see there are non-required failed checks. Is that something I should dig into and try to fix? Let me know if there's anything else I need to do to prepare it for merge. |
Hey @richorrichard nice contribution! I originally swapped Edit: |
@yannbf doesn't it reuse tabs if your browser is set the chrome? and respect your setting if your browser is not set to chrome? i haven't tested the branch but assuming that's the behavior i would consider that a fix not a regression. i agree having the fix in |
@yannbf and @shilman I agree that using My reasoning is that |
Well said @richorrichard ... works for me! 🙏 |
Issue: #15316
What I did
Updated
open-in-browser.ts
to find the user's default browser, and attempt to honor that default browser (when default is Firefox or Safari) instead of automatically opening in a Chromium-based browser.x-default-browser
to detect the user's system default browseropen
to handle cross-platform versions of FirefoxHow to test
If your answer is yes to any of these, please make sure to include it in your PR.