-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
README: update CLI help with latest. Give common examples #2182
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,12 @@ const cliFlags = yargs | |
.showHelpOnFail(false, 'Specify --help for available options') | ||
|
||
.usage('$0 url') | ||
.example('$0 url --view', 'Opens the HTML report in a browser after the run completes') | ||
.example('$0 url --config-path=./myconfig.js', 'Runs Lighthouse with your own configuration: custom audits, report generation, etc.') | ||
.example('$0 url --output=json --output-path=./report.json --save-assets', 'Save trace, screenshots, and named JSON report.') | ||
.example('$0 url --disable-device-emulation --disable-network-throttling', 'Disable device emulation') | ||
.example('$0 url --chrome-flags="--window-size=412,732"', 'Launch Chrome with a specific window size') | ||
.example('$0 url --quiet --chrome-flags="--headless"', 'Launch Headless Chrome, turn off logging') | ||
|
||
// List of options | ||
.group([ | ||
|
@@ -86,7 +92,7 @@ const cliFlags = yargs | |
'list-trace-categories': 'Prints a list of all required trace categories and exits', | ||
'additional-trace-categories': 'Additional categories to capture with the trace (comma-delimited).', | ||
'config-path': 'The path to the config JSON.', | ||
'chrome-flags': 'Custom flags to pass to Chrome.', | ||
'chrome-flags': 'Custom flags to pass to Chrome (space-delimited). For a full list of flags, see http://peter.sh/experiments/chromium-command-line-switches/.', | ||
'perf': 'Use a performance-test-only configuration', | ||
'port': 'The port to use for the debugging protocol. Use 0 for a random port', | ||
'max-wait-for-load': 'The timeout (in milliseconds) to wait before the page is considered done loading and the run should continue. WARNING: Very high values can lead to large traces and instability', | ||
|
@@ -146,6 +152,7 @@ Example: --output-path=./lighthouse-results.html`, | |
|
||
return true; | ||
}) | ||
.epilogue('For more information on Lighthouse, see https://developers.google.com/web/tools/lighthouse/.') | ||
.argv; | ||
|
||
// Process terminating command | ||
|
@@ -209,7 +216,7 @@ function getDebuggableChrome(flags: {skipAutolaunch: boolean, port: number, sele | |
chromeFlags: string}): Promise<ChromeLauncher> { | ||
const chromeLauncher = new ChromeLauncher({ | ||
port: flags.port, | ||
additionalFlags: flags.chromeFlags.split(' '), | ||
chromeFlags: flags.chromeFlags.split(' '), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a breaking change and some other folks rely on the API, but @samccone's work here will break them too and hopefully have some docs so its easy to do the right thing. all that said, +1 to this change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea, I figure we're covered under the 2.0 veil |
||
autoSelectChrome: !flags.selectChrome, | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,43 +44,78 @@ $ lighthouse --help | |
lighthouse <url> | ||
|
||
Logging: | ||
--verbose Displays verbose logging [boolean] | ||
--quiet Displays no progress or debug logs [boolean] | ||
--verbose Displays verbose logging [boolean] | ||
--quiet Displays no progress, debug logs or errors [boolean] | ||
|
||
Configuration: | ||
--disable-device-emulation Disable device emulation [boolean] | ||
--disable-cpu-throttling Disable cpu throttling [boolean] | ||
--disable-network-throttling Disable network throttling [boolean] | ||
--save-assets Save the trace contents & screenshots to disk [boolean] | ||
--save-artifacts Save all gathered artifacts to disk [boolean] | ||
--list-all-audits Prints a list of all available audits and exits [boolean] | ||
--list-trace-categories Prints a list of all required trace categories and exits [boolean] | ||
--config-path The path to the config JSON. | ||
--perf Use a performance-test-only configuration [boolean] | ||
--port The port to use for the debugging protocol. Use 0 for a | ||
random port. [default: 9222] | ||
--max-wait-for-load The timeout (in milliseconds) to wait before the page is | ||
considered done loading and the run should continue. | ||
WARNING: Very high values can lead to large traces and | ||
instability. [default: 25000] | ||
--save-assets Save the trace contents & screenshots to disk | ||
[boolean] | ||
--save-artifacts Save all gathered artifacts to disk [boolean] | ||
--list-all-audits Prints a list of all available audits and exits | ||
[boolean] | ||
--list-trace-categories Prints a list of all required trace categories | ||
and exits [boolean] | ||
--additional-trace-categories Additional categories to capture with the trace | ||
(comma-delimited). | ||
--config-path The path to the config JSON. | ||
--chrome-flags Custom flags to pass to Chrome | ||
(space-delimited). [default: ""] | ||
--perf Use a performance-test-only configuration | ||
[boolean] | ||
--port The port to use for the debugging protocol. Use | ||
0 for a random port [default: 9222] | ||
--max-wait-for-load The timeout (in milliseconds) to wait before | ||
the page is considered done loading and the run | ||
should continue. WARNING: Very high values can | ||
lead to large traces and instability | ||
[default: 25000] | ||
|
||
Output: | ||
--output Reporter for the results, supports multiple values | ||
[choices: "json", "html"] [default: "html"] | ||
[choices: "json", "html", "domhtml"] [default: "html"] | ||
--output-path The file path to output the results. Use 'stdout' to write to | ||
stdout. | ||
If using JSON output, default is stdout. | ||
If using HTML output, default is a file in the working | ||
directory with a name based on the test URL and date. | ||
If using multiple outputs, --output-path is ignored. | ||
Example: --output-path=./lighthouse-results.html [default: "stdout"] | ||
Example: --output-path=./lighthouse-results.html | ||
--view Open HTML report in your browser [boolean] | ||
|
||
Options: | ||
--help Show help [boolean] | ||
--version Show version number [boolean] | ||
--skip-autolaunch Skip autolaunch of Chrome when accessing port 9222 fails [boolean] | ||
--select-chrome Interactively choose version of Chrome to use when multiple | ||
installations are found [boolean] | ||
--help Show help [boolean] | ||
--version Show version number [boolean] | ||
--disable-storage-reset Disable clearing the browser cache and other | ||
storage APIs before a run [boolean] | ||
--disable-device-emulation Disable Nexus 5X emulation [boolean] | ||
--disable-cpu-throttling Disable CPU throttling[boolean] [default: false] | ||
--disable-network-throttling Disable network throttling [boolean] | ||
--skip-autolaunch Skip autolaunch of Chrome when already running | ||
instance is not found [boolean] | ||
--select-chrome Interactively choose version of Chrome to use | ||
when multiple installations are found [boolean] | ||
--interactive Open Lighthouse in interactive mode [boolean] | ||
|
||
Examples: | ||
lighthouse-cli/index.js url --view Opens the HTML report in a browser | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'd repeat this paste with the new terminalWidth change, for less wrapping. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
after the run completes | ||
lighthouse-cli/index.js url Runs Lighthouse with your own | ||
--config-path=./myconfig.js configuration: custom audits, report | ||
generation, etc. | ||
lighthouse-cli/index.js url Save trace, screenshots, and named | ||
--output=json JSON report. | ||
--output-path=./report.json | ||
--save-assets | ||
lighthouse-cli/index.js url Disable device emulation | ||
--disable-device-emulation | ||
--disable-network-throttling | ||
lighthouse-cli/index.js url Launch Chrome with a specific window | ||
--chrome-flags="--window-size=412,732" size | ||
lighthouse-cli/index.js url --quiet Launch Headless Chrome, turn off | ||
--chrome-flags="--headless" logging | ||
|
||
For more information on Lighthouse, see | ||
https://developers.google.com/web/tools/lighthouse/. | ||
``` | ||
|
||
##### Output Examples | ||
|
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.
IMO we should just use "lighthouse" rather than whatever $0 resolves to.
how about with brackets on the url too:
lighthouse <url> --view
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.
done