Skip to content

Commit e037e21

Browse files
Merge pull request #11 from treosh/core-web-vitals
Core Web Vitals
2 parents a08664c + 787d631 commit e037e21

21 files changed

+3744
-4349
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
node-version: '10.x'
1212
- name: Install, link plugin locally, and test
1313
run: |
14-
npm install
15-
npm link
16-
npm link lighthouse-plugin-field-performance
17-
npm test
14+
yarn install
15+
yarn link
16+
yarn link lighthouse-plugin-field-performance
17+
yarn test

CONTRIBUTING.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ We'd love to accept your patches and contributions!
66
#### 1. Install dependencies
77

88
```bash
9-
npm install
9+
yarn install
1010
```
1111

1212
#### 2. Run plugin
1313

1414
```bash
15-
npm install # install deps
16-
npm link # create a global link for lighthouse-plugin-field-performance
17-
npm link lighthouse-plugin-field-performance # add symlink to test the plugin locally
15+
yarn install # install deps
16+
yarn link # create a global link for lighthouse-plugin-field-performance
17+
yarn link lighthouse-plugin-field-performance # add symlink to test the plugin locally
1818

19-
npm run mobile-run https://www.apple.com # test plugin with a real PSI API response
20-
npm run desktop-run https://www.google.com
19+
yarn mobile-run https://www.apple.com/ # test plugin with a real PSI API response
20+
yarn desktop-run https://www.booking.com/
2121

22-
npm run mobile-run https://treo.sh # empty response
23-
npm run desktop-run https://treo.sh # just origin
22+
yarn mobile-run https://treo.sh/ # empty response
23+
yarn desktop-run https://treo.sh/ # just origin
2424
```
2525

2626
`lighthouse-plugin-field-performance` folder is made of symlinks for a simple local testing.
@@ -42,10 +42,10 @@ We use [JSDoc](http://usejsdoc.org/) with [TypeScript](https://github.com/Micros
4242

4343
```bash
4444
# https://github.com/GoogleChrome/lighthouse/issues/9050#issuecomment-495678706
45-
npm link && npm link lighthouse-plugin-field-performance # install plugin locally
45+
yarn link && yarn link lighthouse-plugin-field-performance # install plugin locally
4646

47-
npm test # run all linters && tests
48-
npx tsc -p . # run typescript checks
49-
npx ava test/index.js # run just AVA tests
50-
npx ava test/index.js -u # update AVA snapshots
47+
yarn test # run all linters && tests
48+
yarn tsc -p . # run typescript checks
49+
yarn ava test/index.js # run just AVA tests
50+
yarn ava test/index.js -u # update AVA snapshots
5151
```

README.md

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
# lighthouse-plugin-field-performance
22

3-
> Lighthouse plugin that displays "field" performance of your page using real-world data from by Chrome UX Report.
3+
> A Lighthouse plugin that displays the field performance of your page.
4+
> It uses real-world data from Chrome UX Report and Core Web Vitals to estimate the score.
45
5-
[An example report](https://googlechrome.github.io/lighthouse/viewer/?gist=d9072ab8ccb30622deab48e6d5ee229c):
6+
[An example report for github.com](https://googlechrome.github.io/lighthouse/viewer/?gist=d9072ab8ccb30622deab48e6d5ee229c):
67

78
<a href="https://googlechrome.github.io/lighthouse/viewer/?gist=d9072ab8ccb30622deab48e6d5ee229c">
8-
<img width="1138" alt="Lighthouse Field Performance Plugin" src="https://user-images.githubusercontent.com/158189/82894895-a5252b80-9f53-11ea-80ea-cb27f2897728.png">
9+
<img width="1087" alt="Lighthouse Field Performance Plugin" src="https://user-images.githubusercontent.com/158189/83190516-d3ad2d00-a132-11ea-9f4a-68ead5b6a1b9.png">
910
</a>
1011

1112
<br />
1213
<br />
1314

14-
This plugin adds a field performance section with the real-world data from [Chrome UX Report](https://developers.google.com/web/tools/chrome-user-experience-report/). It's similar to [PageSpeed Insights](https://developers.google.com/speed/pagespeed/insights/), with an addion of overall score.
15+
This plugin adds a field performance category with real-world data from [Chrome UX Report](https://developers.google.com/web/tools/chrome-user-experience-report/). It's exactly like [PageSpeed Insights](https://developers.google.com/speed/pagespeed/insights/), but for your local run and with a field performance score.
1516

16-
The scoring algorithm uses [PSI recommendations](https://developers.google.com/speed/docs/insights/v5/about#faq) and applies estimation for First Contentful Paint and First Input Delay. (_Note_: the origin values does not affect score).
17+
The scoring algorithm uses [Core Web Vitals](https://web.dev/vitals/). It weigths values for Largest Contentful Paint, First Input Delay, and Cumulative Layout Shift. (_Note_: FCP and the origin values do not affect the score, [see the source](./src/index.js))
1718

1819
Check out the parity between Field & Lab performance on mobile:
1920

@@ -23,7 +24,7 @@ And on desktop:
2324

2425
<img width="974" alt="Field & lab performance on desktop" src="https://user-images.githubusercontent.com/158189/65246645-4a4b5280-daef-11e9-92aa-e3495aebfa4b.png">
2526

26-
Sometimes field data is missing because the URL doesn't have enough anonymous traffic. In this case, the lab data is the only available measurement. Optimize, get more traffic, and measure again.
27+
Sometimes field data is missing because a URL doesn't have enough anonymous traffic. In this case, the lab data is the only available measurement.
2728

2829
## Install
2930

@@ -35,17 +36,13 @@ $ npm install lighthouse lighthouse-plugin-field-performance
3536

3637
## Usage
3738

38-
Use the plugin with [Lighthouse CLI](https://github.com/GoogleChrome/lighthouse) or Node.js.
39-
40-
### CLI
41-
42-
Pass plugin to Lighthouse:
39+
Use the plugin with [Lighthouse CLI](https://github.com/GoogleChrome/lighthouse):
4340

4441
```bash
4542
$ npx lighthouse https://www.apple.com/ --plugins=lighthouse-plugin-field-performance
4643
```
4744

48-
Pass your [PageSpeed Insights token](https://developers.google.com/speed/docs/insights/v5/get-started) with a custom config:
45+
Provide your [PageSpeed Insights token](https://developers.google.com/speed/docs/insights/v5/get-started) to run more requests (in production) with a custom config:
4946

5047
```bash
5148
$ npx lighthouse https://www.apple.com/ --config-path=./config.js
@@ -63,18 +60,6 @@ module.exports = {
6360
}
6461
```
6562

66-
### Node.js
67-
68-
```js
69-
const { runLighthouse } = require('lighthouse/lighthouse-cli/run')
70-
71-
runLighthouse('https://www.apple.com', {
72-
plugins: ['lighthouse-plugin-field-performance'],
73-
}).then((result) => {
74-
console.log(result)
75-
})
76-
```
77-
7863
## Credits
7964

8065
Sponsored by [Treo.sh - Page speed monitoring made simple](https://treo.sh).

0 commit comments

Comments
 (0)