Giter VIP home page Giter VIP logo

lighthouse-ci's Introduction

lighthouse-ci

Run lighthouse in your CI

This CLI will start a chrome instance in headless mode and run lighthouse on the urls you specified, checking that your scores match your expectations.

Install

npm install --save-dev lighthouse-ci
# or
yarn add -D lighthouse-ci

CLI

lighthouse-ci --help
lighthouse-ci

Configuration

Add a .lighthousecirc file at your project root.

Basically you either supply an object or an array of object. This object must contain an url property specifying the url to check and can contain all the configuration options supported by the lighthouse API with the addition of of the following properties:

  • logLevel: 'silent'|'error'|'info'|'verbose';

Example for a single url:

{
	"url": "http://localhost:3000",
	"metrics/first-contentful-paint": 1000,
	"metrics/first-meaningful-paint": 1000,
	"metrics/first-cpu-idle": 1000,
	"metrics/interactive": 1000,
	"byte-efficiency/total-byte-weight": 1000,
	"works-offline": true,
	"budgets": [
		{
			"resourceSizes": [
				{
					"resourceType": "script",
					"budget": 100000
				},
				{
					"resourceType": "image",
					"budget": 100
				},
				{
					"resourceType": "third-party",
					"budget": 200
				},
				{
					"resourceType": "total",
					"budget": 100000
				}
			],
			"resourceCounts": [
				{
					"resourceType": "third-party",
					"budget": 10
				},
				{
					"resourceType": "total",
					"budget": 50
				}
			]
		}
	]
}

Example for multiple urls:

{
	// Defaults for all urls
	"metrics/first-contentful-paint": 1000,
	"metrics/first-meaningful-paint": 1000,
	"metrics/first-cpu-idle": 1000,
	"metrics/interactive": 1000,
	"byte-efficiency/total-byte-weight": 1000,
	"works-offline": true,
	
	"urls": [
		"http://localhost:3000",
		"http://localhost:3000/page",
		{
			"url": "http://localhost:3000/another_page",
			// Specific goals for this url
			"metrics/first-contentful-paint": 1000,
			"metrics/first-meaningful-paint": 1000,
			"metrics/first-cpu-idle": 1000,
			"metrics/interactive": 1000,
			"byte-efficiency/total-byte-weight": 1000,
		}
	]
}

Development

There are 2 available commands:

  • npm run dev - Start development mode and recompile on change
  • npm run build - Build a final distributable for npm

Roadmap

  • Supports simple binary and numeric metrics
  • Supports complex numeric metrics (such as user-timings)
  • Supports budgets
  • Human readable display for values and goals

lighthouse-ci's People

Contributors

djhi avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.