Skip to content

Latest commit

 

History

History
179 lines (135 loc) · 6.53 KB

lh-configuraton.md

File metadata and controls

179 lines (135 loc) · 6.53 KB

Lighthouse configuration

General

User flow wraps lighthouse and executes actions against chromium while measuring. Lighthouse itself can get configured over a json object where any detail regards settings, audits and postprocessing can be placed.

The official docs on how to configure lighthouse are located in their repository's docs. The default lighthouse config can be found in their repository's source.

The CLI will start lighthouse as with its default configuration.

Configuration Options

The CLI provides multiple ways of configuration, every one with a different granularity.

Places to put configurations:

  • in a .user-flowrc.json - used for all flows (global)
  • in the console as CLI param - used for all flows, overwrites rc file (global)
  • in a <user-flow-name>.uf.ts - used for 1 specific flow (local)

Local configurations will overwrite global configurations.

Custom configurations can be provided over a external .json file using --configPath <path/to/config.json>.
This option is also available in the .user-flowrc.json file under the collect.configPath property.

It is also possible to provide the configurations directly as JSON object in the .user-flowrc.json file under the collect.config property.

The configPath property is handy when all parameters should exist as CLI params only.

Configration option short-hands

As the configuration object can get quite big lighthouse provides a couple of shourt-hands to directly configure specific parts over a flag.
The user-flow CLI ports perts of this behavior.

It provides the following short hands:

  • budgets - performance budgets for lighthouse performance budgets for the navigation mode

Those options can be used similar to the general configurations globally as well as locally. Also the placement of budgets is similar to the general configurations in the .user-flowrc.json or as CLI param.

The budgetPath property is handy when all parameters should exist as CLI params only.

Options

RC properties

Used in the rc.json file directly.

Option Type Default Description
collect.configPath string n/a Path to the lighthouse config.json file
collect.config object n/a The lighthouse configuration as JSON object
collect.budgetPath string n/a Path to the lighthouse budget.json file
collect.budget object n/a The lighthouse budgets as JSON object

CLI params

Used in the console as user-flow collect <param>.

Option Type Default Description
-c, --configPath string n/a Path to the lighthouse config.json file
-b, --budgetPath string n/a Path to the lighthouse budget.json file

Configuration over RC properties

collect.configPath property

Property Type Default
collect.configPath string n/a

Usage:

{
  "collect": {
    "configPath": "./config.json",
    # ...  
  },
  # ...
}

Description:
If a lighthouse configuration exists as separate file you can use the collect.configPath to use it. The path is, same as all other paths, relative to the execution context of the CLI.

If possible configuration file looks like this:

./config.json

{
 "extends": "lighthouse:default",
   "settings": {
     "onlyAudits": [
       "first-meaningful-paint",
       "speed-index",
       "interactive"
     ]
   }
}

The usage of it in the rc file looks like this:

./.user-flowrc.json

{
  "collect": {
    "configPath": "./config.json",
    # ...  
  },
  # ...
}

collect.config property

Property Type Default
collect.config object n/a

Usage:

{
  "collect": {
    "config": {
      "extends": "lighthouse:default",
      "settings": {
        "onlyAudits": [
          "first-meaningful-paint",
          "speed-index",
          "interactive"
        ]
      }
    },
    # ...  
  },
  # ...
}

Description:

You can directly use a lighthouse config object in the rc file by placing it under the collect.config property.

./.user-flowrc.json

{
  "collect": {
    "config": {
        "extends": "lighthouse:default",
        "settings": {
          "onlyAudits": [
            "first-meaningful-paint",
            "speed-index",
            "interactive"
          ]
        }
    },
    # ...  
  },
  # ...
}

Lighthouse configuration over the CLI params

configPath

See CLI collect command - configPath

budgetPath

made with ❤ by push-based.io