This package has been deprecated

Author message:

renamed as nightharbor

lighthouse-keeper

0.4.5 • Public • Published

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'],
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i lighthouse-keeper

Weekly Downloads

1

Version

0.4.5

License

MIT

Unpacked Size

17.8 kB

Total Files

23

Last publish

Collaborators

  • yoshiyuki