0.4.5 • Published 6 years ago

lighthouse-keeper v0.4.5

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

lighthouse-keeper

npm CircleCI codecov codebeat badge Greenkeeper badge

A wrapper tool of lighthouse to collect multiple web-site performance data.

use from cli

$ npm i -g lighthouse-keeper
$ lhk --config [path to config]

use from program

$ npm i lighthouse-keeper
const lhk = require("lighthouse-keeper");
const config = require("./path/to/config");

lhk.exec(config)
  .then((context) => {
    console.log(context.getResults());
  })
  .catch((err) => {
    console.error(err);
  });

configuration

{
  targets: [{ url: "https://google.com" }...],
  reporters: [Reporter...],
  chromeNum: 2,
  puppeteerConfig: {puppeteerConfig},
  lighthouseConfig: {lighthouseConfig}
}

targets required

Array of target to perform audits by lighthouse. The target object must contains url property as follows:

{ url: "https://google.com" }

use csv target list

url
https://google.com
const {readCsvTargetList} = require("lighthouse-keeper").config;

module.exports = {
  targets: readCsvTargetList("/path/to/*.csv"),
  ...
}

reporters required

Array of Reporter instance.

use built-in reporters

There are two built-in reporters; JsonReporter and CsvReporter.

const {JsonReporter,CsvReporter} = require("lighthouse-keeper").reporter;

module.exports = {
  targets: [{ url: "https://google.com" }...],
  reporters: [
    new JsonReporter("path/to/output.json"),
    new CsvReporter("path/to/output.csv")
  ],
  ...
}

use custom reporters

const {Reporter} = require("lighthouse-keeper").reporter;

class MyReporter extends Reporter{
  constructor(){
    super();
  }
  open(){...}
  write(){...}
  close(){...}
}
const MyReporter = require("path/to/my-reporter");

{
  targets: [{ url: "https://google.com" }...],
  reporters: [
    new MyReporter()
  ],
  ...
}

chromeNum option

Number of chromes to launch for running lighthouse.
This parameter is optional. Default value is 1;

puppeteerConfig option

Object of options to launch chrome via puppeteer. See launch config of puppeteer
This parameter is optional. Default value is follows:

{
  headless: true
}

lighthouseConfig option

Object of options to run lighthouse. See config of LightHouse
This parameter is optional. Default value is follows:

{
  extends: 'lighthouse:default',
  settings: {
    onlyCategories: ['performance'],
  }
}
0.4.5

6 years ago

0.4.4

6 years ago

0.4.3

6 years ago

0.4.3-beta

6 years ago

0.4.2-beta

6 years ago

0.4.1-beta

6 years ago

0.4.0-beta

6 years ago

0.4.0-alpha

6 years ago

0.3.5

6 years ago

0.3.5-beta

6 years ago

0.3.4

6 years ago

0.3.4-beta

6 years ago

0.3.3-beta

6 years ago

0.3.2-beta

6 years ago

0.3.2-alpha

6 years ago

0.3.1-alpha

6 years ago

0.3.0

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago