push-based / user-flow

📦 Combine Chrome tooling like Lighthouse userflows and DevTools reconder scripts in your CI
MIT License
118 stars 3 forks source link

Generate budgets file from LHR #224

Closed BioPhoton closed 1 year ago

BioPhoton commented 1 year ago

Problem

Creating budgets files requires to read the lighthouse docs on budgets.

If the basic structure is given there is additional knowledge required on the tested application as well as web performance to get a useful initial budgets file to go with.

That builds up a barrier for users to try it out or work with it.

Solution

A generate command that automatically generates a budgets file under a specific location. This command can also be used with an additional parameter to derive the budgets directly from a lighthouse report.

CLI Example:

generate a budget file npx user-flow init --budgets or with file name npx user-flow init --budgets budgets1.json

This generates a budgets.json file in the executing directory.

generate a budget file from a given LHR npx user-flow init --budgets --lhr ./report.json

This generates a budgets.json file in the executing directory derived from a lhr located under npx user-flow init --budgets --lhr ./report.json.

Potential Optional params:

--useRc - insert the budgets directly into the rc file --useRc .user-flowrc.json - insert the budgets directly into a rc file

Budget Example for new budget:

Resource Type Transfer Size
Script 142.03 KB
Stylesheet 2
Metric Measurement
Largest Contentful Paint 2500 ms
Cumulative Layout Shift 0.25

Budget Example for derived budget:

The following types are derived for transfer size measures:

The type img is excluded as the target may have too dynamic content. The type other is excluded as too unclear if the number is static.

The following types are derived for count size measures:

Todos: