-
Notifications
You must be signed in to change notification settings - Fork 191
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
add method for printing found chrome path #255
Conversation
This is better, but importing |
@@ -13,6 +13,9 @@ | |||
"type-check": "tsc --allowJs --checkJs --noEmit --target es2019 *.js", | |||
"prepublishOnly": "npm run build && npm run test" | |||
}, | |||
"bin": { | |||
"print-chrome-path": "bin/print-chrome-path.js" |
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.
add this file plz :)
@@ -0,0 +1,16 @@ | |||
#!/usr/bin/env node |
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.
I assume this was chmod +x
'd, although I don't know if there is a way to confirm that in GH ui.
related, benefits to using shebang vs just setting the bin script to node bin/print-chrome-path.js
?
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.
I assume this was
chmod +x
'd, although I don't know if there is a way to confirm that in GH ui
npm/yarn does the chmod on install
related, benefits to using shebang vs just setting the bin script to
node bin/print-chrome-path.js
?
unlike script
entries, bin
entries are just filenames that are symlinked into node_modules/.bin
, so need the shebang
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.
TIL, thx!
Using Lighthouse user flows, I find myself alternating between being fine with the version of Chrome shipped with puppeteer and needing the Canary installed on my machine, depending on what I'm doing, but it's awkward to set the path manually, and it's not portable (e.g. for sample code)
chrome-launcher
is already set up to find Canary, so I've been wanting a way to be able to easily run something likeI don't see any non-ugly way of reaching into
chrome-launcher
to do this (someone correct me if I'm wrong), so this PR exposes a function to do this.Also adds a bin option as I've also wanted it on the command line, e.g.
CHROME_PATH="$(npm exec print-chrome-path)"
. Please suggest better approaches for that too, if there are any :)