-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core(cli): accept flags from path #9109
Conversation
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.
neat
lighthouse-cli/cli-flags.js
Outdated
@@ -62,6 +62,9 @@ function getFlags(manualArgv) { | |||
'lighthouse <url> --only-categories=performance,pwa', | |||
'Only run specific categories.') | |||
|
|||
// Accept a file for all of these flags. | |||
.config('cli-settings-path') |
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 you add a description specifying that other flags will override this one? (e.g. --throttling-method=provided
on the command line will override "throttling-method": "devtools"
in the settings file)
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.
also, bikeshed time: should we call it something like cli-flags-path
?
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.
also, copy over to readme :)
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 you add a description specifying that other flags will override this one?
Yes, test added too! 👍
cli-flags-path
WFM!
also, copy over to readme
This feels close to an autopopulate script too if only we made changes more frequently 🤔
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 feels close to an autopopulate script too if only we made changes more frequently 🤔
definitely, and it's a little silly we have it at all, but I know I've at least found it useful in the past, so.... 🤷♀
wfm! 👍 |
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.
LGTM
I don't entirely understand how you're going to use it (is CI going to replicate some of the stuff in bin.js
e.g. for bundget-path and output-path? or is it going to be calling the CLI?), but it makes sense on its own, too, so SG :)
Basically I want to use the existing logic for The solution that works today is a blend of config and flags but it's just so much cleaner to have it all co-located |
Summary
In order to easily accept an LH settings object over in Lighthouse CI, we need a way to easily passthrough the object. This can be done with config today but you miss out on some nice features like being able to use
--budgets-path
, set the--output-path
, etc.This is a low-cost way to enable consumers of the LH CLI that run in a child process programmatic access to all our CLI flags without manually (and error-pronely) constructing an argument list.