Skip to content

Commit aa595d4

Browse files
authored
feat(showcase): add lcp,inp,ttfb (#7515)
lcp and inp are core web vitals but were missing. the display already shows them, this makes it so the page info stores them.
1 parent 966f19c commit aa595d4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

packages/docs/scripts/showcase.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async function captureMultipleScreenshots() {
2323
try {
2424
const data = fs.readFileSync(OUTPUT_JSON, 'utf8');
2525
existingJson = JSON.parse(data);
26-
} catch (e) {
26+
} catch {
2727
// ignore
2828
}
2929

@@ -91,6 +91,14 @@ async function captureMultipleScreenshots() {
9191
const lcpScore =
9292
pagespeedOutput?.lighthouseResult?.audits?.['largest-contentful-paint']?.score;
9393

94+
const loadExpMetrics = pagespeedOutput.loadingExperience?.metrics;
95+
// ms score of the 75th percentile of the page users
96+
const inpMs = loadExpMetrics?.INTERACTION_TO_NEXT_PAINT?.percentile;
97+
// no unit, less than 0.1 is good
98+
const clsScore = loadExpMetrics?.CUMULATIVE_LAYOUT_SHIFT_SCORE?.percentile / 100;
99+
// not core but interesting
100+
const ttfbMs = loadExpMetrics?.EXPERIMENTAL_TIME_TO_FIRST_BYTE?.percentile;
101+
94102
const ttiDisplay = pagespeedOutput?.lighthouseResult?.audits?.interactive?.displayValue;
95103
const ttiScore = pagespeedOutput?.lighthouseResult?.audits?.interactive?.score;
96104

@@ -99,6 +107,9 @@ async function captureMultipleScreenshots() {
99107
const score = pagespeedOutput?.lighthouseResult?.categories?.performance?.score;
100108
const perf = {
101109
score,
110+
inpMs,
111+
clsScore,
112+
ttfbMs,
102113
fcpDisplay,
103114
fcpScore,
104115
lcpDisplay,

0 commit comments

Comments
 (0)