-
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
plots: better support power use cases #2464
Conversation
lighthouse-core/config/plots.json
Outdated
@@ -10,7 +10,6 @@ | |||
"first-meaningful-paint", | |||
"speed-index-metric", | |||
"estimated-input-latency", | |||
"time-to-interactive", |
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.
oops sorry :) **/*.js
strikes again
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.
true. @wwwillchen since you'll have to sort out this conflict anyhow...
can you change the plots.json to plots-config.js?
nice to have comments. ;)
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
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.
are there back compat considerations? I'm guessing our existing plots data will need to be regenerated
plots/charts/chart-loader.js
Outdated
|
||
/* eslint-env browser */ | ||
|
||
function parseQueryParameters(queryParams) { |
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.
use URLSearchParams instead?
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.
@patrickhulce for backwards compatibility:
I think we can focus on backwards compat once plots over time (#2413) is implemented since it'll be vital then. For now, there's workarounds (e.g. checkout older lighthouse commit) to view old plots. Does that work for the team? |
Yeah sgtm, not a big deal until we have the historical view we'll want to preserve. |
lighthouse-core/config/plots.json
Outdated
@@ -10,7 +10,6 @@ | |||
"first-meaningful-paint", | |||
"speed-index-metric", | |||
"estimated-input-latency", | |||
"time-to-interactive", |
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.
true. @wwwillchen since you'll have to sort out this conflict anyhow...
can you change the plots.json to plots-config.js?
nice to have comments. ;)
@@ -16,14 +16,10 @@ | |||
</head> | |||
|
|||
<body> | |||
<nav> | |||
<nav id="nav"> |
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.
u got some .html files in /plots to delete still.
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.
my b
* @return {string} | ||
*/ | ||
function generateOutPath() { | ||
if (args.out) { |
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.
missing readme docs on this
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
plots/utils.js
Outdated
* @param {string} src | ||
* @param {string} dest | ||
*/ | ||
function copyRecursive(src, dest) { |
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.
lets use a module for this :)
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
plots/charts/chart-loader.js
Outdated
const queryParams = new URLSearchParams(window.location.search); | ||
const chartParam = queryParams.get('chart') || './grouped-by-metric.js'; | ||
|
||
const chartScript = document.createElement('script'); |
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 a bit clunky, plus the three metrics files are already overlapping pretty hard.
let's merge all of charts/*.js into one file.
you can hook up generateBloxPlotPerSite()
, or generateBoxPlotChartPerMetric(); generateLinePlotChartPerMetric();
or generateGroupedBarChart();
depending on which view we're in.
would rather have a simple slug (e.g. 'by-metric') in the query param or hash instead of a file or function name.
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
plots/utils.js
Outdated
* @param {string} filePath | ||
*/ | ||
function removeRecursive(filePath) { | ||
try { |
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.
u can use rimraf
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.
I've removed this (I think I can do away with it since I'm just copying the files individually into the correct out folder).
plots/charts/index.html
Outdated
</nav> | ||
<script src="./out/generatedResults.js"></script> | ||
<script src="./bars-per-site.js"></script> | ||
<script src="../generated-results.js"></script> |
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 if you're going to leave gen-results in the root of out
then you should put index.html
there as well.
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.
OK.
plots/analyze.js
Outdated
@@ -48,17 +57,17 @@ main(); | |||
function analyzeSite(sitePath) { | |||
console.log('Analyzing', sitePath); // eslint-disable-line no-console | |||
const runResults = []; | |||
fs.readdirSync(sitePath).forEach(runDir => { | |||
fs.readdirSync(sitePath).sort().forEach(runDir => { |
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.
dunno if it's useful but you might want to use localeCompare instead..
.sort((a, b) => a.localeCompare(b))
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
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.
@paulirish - please take another look.
lighthouse-core/config/plots.json
Outdated
@@ -10,7 +10,6 @@ | |||
"first-meaningful-paint", | |||
"speed-index-metric", | |||
"estimated-input-latency", | |||
"time-to-interactive", |
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
plots/analyze.js
Outdated
@@ -48,17 +57,17 @@ main(); | |||
function analyzeSite(sitePath) { | |||
console.log('Analyzing', sitePath); // eslint-disable-line no-console | |||
const runResults = []; | |||
fs.readdirSync(sitePath).forEach(runDir => { | |||
fs.readdirSync(sitePath).sort().forEach(runDir => { |
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
plots/charts/chart-loader.js
Outdated
const queryParams = new URLSearchParams(window.location.search); | ||
const chartParam = queryParams.get('chart') || './grouped-by-metric.js'; | ||
|
||
const chartScript = document.createElement('script'); |
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
@@ -16,14 +16,10 @@ | |||
</head> | |||
|
|||
<body> | |||
<nav> | |||
<nav id="nav"> |
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.
my b
plots/utils.js
Outdated
* @param {string} filePath | ||
*/ | ||
function removeRecursive(filePath) { | ||
try { |
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.
I've removed this (I think I can do away with it since I'm just copying the files individually into the correct out folder).
plots/utils.js
Outdated
* @param {string} src | ||
* @param {string} dest | ||
*/ | ||
function copyRecursive(src, dest) { |
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
* @return {string} | ||
*/ | ||
function generateOutPath() { | ||
if (args.out) { |
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
plots/charts/index.html
Outdated
</nav> | ||
<script src="./out/generatedResults.js"></script> | ||
<script src="./bars-per-site.js"></script> | ||
<script src="../generated-results.js"></script> |
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.
OK.
if (args.out) { | ||
return path.resolve(__dirname, args.out); | ||
} | ||
const date = new Date().toISOString(); |
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 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.
fixed.
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
added 3 commits that fix my remaining concerns. :) |
@paulirish - thanks for the changes! let's merge? |
This closes #2412
I'm copying the charts folder into each out directory because:
opn
, so the initial load of charts/index.html has to bootstrap properly without any query params [0][0] Filed an issue here: sindresorhus/open#55