Skip to content
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

core(lightwallet): add path to budget.json #9453

Merged
merged 12 commits into from
Aug 16, 2019
Merged

core(lightwallet): add path to budget.json #9453

merged 12 commits into from
Aug 16, 2019

Conversation

khempenius
Copy link
Collaborator

@khempenius khempenius commented Jul 25, 2019

The optional path property is used in budget.json to indicate which page(s) a budget applies to. The path property is specified using the robots.txt format.

Example of usage:

// budget.json
[{
  "path": "/",
  "resourceSizes": "...",
}, {
  "path": "/blog*",
  "resourceSizes": "..."
}] 

In the above example, the first budget would apply to all pages except those matching /blog*, and the second budget would apply to all pages matching /blog*

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @khempenius this looks great!

lighthouse-core/test/results/artifacts/artifacts.json Outdated Show resolved Hide resolved
lighthouse-core/audits/performance-budget.js Outdated Show resolved Hide resolved
lighthouse-core/config/budget.js Outdated Show resolved Hide resolved
lighthouse-core/config/budget.js Outdated Show resolved Hide resolved
lighthouse-core/config/budget.js Outdated Show resolved Hide resolved
lighthouse-core/test/config/budget-test.js Show resolved Hide resolved
lighthouse-core/test/config/budget-test.js Show resolved Hide resolved
types/budget.d.ts Outdated Show resolved Hide resolved
lighthouse-core/test/config/budget-test.js Show resolved Hide resolved
lighthouse-core/test/config/budget-test.js Outdated Show resolved Hide resolved
Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this LGTM once the fixtures are reverted! 👍 (simplest way to resolve the conflicts anyhow 😃 )

lighthouse-core/test/results/sample_v2.json Outdated Show resolved Hide resolved
@khempenius
Copy link
Collaborator Author

@patrickhulce ready for review :)

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % possible foo*foo$ bug resolution

lighthouse-core/audits/performance-budget.js Outdated Show resolved Hide resolved
lighthouse-core/config/budget.js Outdated Show resolved Hide resolved
lighthouse-core/test/audits/performance-budget-test.js Outdated Show resolved Hide resolved
lighthouse-core/test/config/budget-test.js Show resolved Hide resolved
lighthouse-core/test/config/budget-test.js Show resolved Hide resolved
lighthouse-core/test/config/budget-test.js Show resolved Hide resolved
"resourceSizes": [
{
"resourceType": "total",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK the next series of commentary is mostly for other reviewers since I was puzzled following this train...

Stage 1

I think I see what you were asking me now @khempenius sorry I didn't understand before!
since none of these changes are necessary to test out the functionality and don't result in changes to our golden report JSON fixture, we wouldn't normally check this in. they can be reverted.

Stage 2

but later in our sample JSON it looks like this was already out of date and you're just updating to match it?

Stage 3
#8870 updated the sample report and the config to these values but not the artifacts.json here, why? Well in that same PR the update sample report command was changed to pull the config directly from sample-config.js so in effect the entire config settings object here is ignored.

Conclusion
we don't really need to update these values ever, but it doesn't seem like a terrible idea to keep them in sync so 🤷‍♂

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#8870 updated the sample report and the config to these values but not the artifacts.json here, why? Well in that same PR the update sample report command was changed to pull the config directly from sample-config.js so in effect the entire config settings object here is ignored.

so, it's down to the weirdness of having the same config for -G and -A and that we save all our settings in the artifacts even if they aren't used in -G and we ignore them in -A cause we use the -A config's settings then?

It wasn't the best set of decisions when you think about it like that :) But I guess no one uses -G/-A but us...

so 🤷‍♂

👍 👍

@exterkamp
Copy link
Member

exterkamp commented Aug 13, 2019

Can I get a description of these changes in the PR desc? or a link to a bug? I think I'm out of the loop.

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great!

lighthouse-core/config/budget.js Outdated Show resolved Hide resolved
types/budget.d.ts Show resolved Hide resolved
types/budget.d.ts Outdated Show resolved Hide resolved
"resourceSizes": [
{
"resourceType": "total",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#8870 updated the sample report and the config to these values but not the artifacts.json here, why? Well in that same PR the update sample report command was changed to pull the config directly from sample-config.js so in effect the entire config settings object here is ignored.

so, it's down to the weirdness of having the same config for -G and -A and that we save all our settings in the artifacts even if they aren't used in -G and we ignore them in -A cause we use the -A config's settings then?

It wasn't the best set of decisions when you think about it like that :) But I guess no one uses -G/-A but us...

so 🤷‍♂

👍 👍

lighthouse-core/config/budget.js Outdated Show resolved Hide resolved
lighthouse-core/config/budget.js Outdated Show resolved Hide resolved
lighthouse-core/config/budget.js Outdated Show resolved Hide resolved
* @param {string} pattern
* @return {boolean}
*/
static urlMatchesPattern(url, pattern) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOVE the documentation and style of this function here :D

agreed, this is great

lighthouse-core/config/budget.js Outdated Show resolved Hide resolved
lighthouse-core/test/config/budget-test.js Outdated Show resolved Hide resolved
Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚖️⏱+ 🛣

LGTM, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants