-
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: Reorganization and new "Using programmatically" section #1721
Conversation
readme.md
Outdated
|
||
The traceviewer-based trace processor from [node-big-rig](https://github.com/GoogleChrome/node-big-rig/tree/master/lib) was forked into Lighthouse. Additionally, the [DevTools' Timeline Model](https://github.com/paulirish/devtools-timeline-model) is available as well. There may be advantages for using one model over another. | ||
|
||
### Trace processing | ||
|
||
**To update traceviewer source:** |
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 dev instructions for us, and belongs in the contributing.md
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
readme.md
Outdated
DevTools](https://medium.com/@paul_irish/debugging-node-js-nightlies-with-chrome-devtools-7c4a1b95ae27#.59rma3ukm) | ||
for more info. | ||
|
||
## Coding Style |
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.
move to contributing.md
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
readme.md
Outdated
|
||
# The CLI is authored in TypeScript and requires compilation. | ||
# If you need to make changes to the CLI, run the TS compiler in watch mode: | ||
# cd lighthouse-cli && npm run dev |
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.
link to contributing and architecture somewhere around here?
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.
and can you link to architecture doc from contributing.md?
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
readme.md
Outdated
|
||
### Are results sent to a remote server? | ||
|
||
Hope. Lighthouse runs locally, auditing a page using a local version of the Chrome browser installed the |
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.
Hope 🙏
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.
ha
readme.md
Outdated
<p align="center"> | ||
<img src="https://cloud.githubusercontent.com/assets/39191/22478294/23f662f6-e79e-11e6-8de3-ffd7be7bf628.png" alt="Lighthouse logo" height="300"> | ||
<img src="https://cloud.githubusercontent.com/assets/39191/22478294/23f662f6-e79e-11e6-8de3-ffd7be7bf628.png" alt="Lighthouse logo" height="150"> | ||
<br> | ||
<b>Lighthouse</b>, ˈlītˌhous (n): a <s>tower or other structure</s> tool containing a beacon light to warn or guide <s>ships</s> developers at "sea". |
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.
ships at seadevelopers.
IMO slightly better. if you want.
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
@@ -0,0 +1,60 @@ | |||
# Architecture |
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 this file can get merged with API-and-internals.md
and since readme and contributing are in root, i kinda prefer keeping this md file there rather than docs/. wdyt?
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.
Up to you. I figured we'd have more in the future and wanted to declutter.
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.
There's also https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/#publishing-your-github-pages-site-from-a-docs-folder-on-your-master-branch, which we could leverage someday.
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.
Moved and renamed that file to "headless-chrome.md". It didn't contain anything but headless Chrome stuff :)
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.
sg
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.
nice it was due for some cleanup!
docs/architecture.md
Outdated
## Components | ||
|
||
* **Driver** - Interfaces with [Chrome Debugging Protocol](https://developer.chrome.com/devtools/docs/debugger-protocol) ([API viewer](https://chromedevtools.github.io/debugger-protocol-viewer/)) | ||
* **Gathers** - Requesting data from the browser (and maybe post-processing) |
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.
Gatherers?
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
docs/architecture.md
Outdated
* **Artifacts** - The output of gatherers | ||
* **Audits** - Non-performance evaluations of capabilities and issues. Includes a raw value and score of that value. | ||
* **Metrics** - Performance metrics summarizing the UX | ||
* **Diagnoses** - The perf problems that affect those metrics |
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.
Is this still a thing that we call Diagnoses?
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.
removed
readme.md
Outdated
|
||
Some basic unit tests forked are in `/test` and run via mocha. ESLint also checks for style violations. | ||
The example below shows how to setup and run Lighthouse programmatically as a Node module. |
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.
How important is supporting use as a node module to us? If we think it's important, any issues to make basic usage easier than 80 lines? If not, maybe let's move this to separate file and link to it from README.
Personally, I'd love to see chrome launcher published to NPM separately with a slightly friendlier interface (happy to take this up if there's agreement), and a more organized programmatic API that doesn't involve so much digging into our directory tree (more resilient to doing our rename of lighthouse-cli -> cli
etc
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.
Open sourcing a more convenient launcher would be great. That's really the bulk of the example, and something I struggled to get working for my demo.
When looking into a lib, I do really like seeing install + different usages in the main readme. Since a lot of people ask for docs on this, I'd love to keep it front and center. Ironically, an email thread from Addy prompted me to add this to our radme...which then led to a full reorg :)
Happy to move it out though.
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.
When looking into a lib, I do really like seeing install + different usages in the main readme.
Totally agree, I just also would find it off-putting if the usage example was so complicated :) I say let's leave it here, and I'll file issue to improve the API.
PTAL |
readme.md
Outdated
const PERF_CONFIG = require('lighthouse/lighthouse-core/config/perf.json'); | ||
// const DEFAULT_CONFIG = require('lighthouse/lighthouse-core/config/default.json'); | ||
|
||
const _SIGINT = 'SIGINT'; |
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.
Doesn't this seem like overkill? Handling command line args and SIGINT seems out of scope for a readme example
readme.md
Outdated
} | ||
|
||
// Example of extracting the overall score from the results. | ||
getOverallScore(results) { |
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.
Ha, seems like we should already be including this in the lighthouse results
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.
Sure, but I don't think it hurts to show an "Example of extracting" things from our crazy config object.
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.
kept, but moved it as a separate function example
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.
ha, sorry, I meant it's ridiculous that the results object don't currently include the overall score and that it has to be extracted :) Somehow I hadn't noticed that in all this time. We should add it.
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.
Gotcha. I was surprised too. But I guess we've also never come across it. We have the notion of scores for each aggregation, but only have 1 that's scored atm.
readme.md
Outdated
} | ||
} | ||
|
||
const flags = yargs |
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.
yargs especially seems like it could be cut. 9 times out of 10 it seems like people will be calling lighthouse within an existing script or with hardcoded values
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.
+1 to this.
you can see https://github.com/paulirish/pwmetrics/blob/27ee73fd1c9c8ed5457eebafb245b1592ac26a38/lib/index.js#L64-L90 which is how we adopt LH in pwmetrics. it's pretty small.
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
Removed the extras from the example |
Yeah this small example is clutch. Nice! |
@patrickhulce how does this look? |
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.
great improvements!
R: all
Also fixes #1719.
The example is extracted and simplified from lighthouse hue lights thing I made. Happy to rework it a little, but it's pretty chill and is known to be everything you need to call LH programmatically.