• Stars
    star
    214
  • Rank 184,678 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 7 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿšฆ Generate badges (shields.io) based on Lighthouse performance.

Build Status Code Coverage NPM downloads NPM version License

Lighthouse Badges

Lighthouse

This package allows you to easily create Lighthouse badges for all Lighthouse categories.
Ever wanted to brag about your sites's awesome Lighthouse performance? Then this is the package for you!

Examples

All Badges

Lighthouse Accessibility Badge Lighthouse Best Practices Badge Lighthouse Performance Badge Lighthouse PWA Badge Lighthouse SEO Badge

Single Badge

Lighthouse

Usage

Help

usage: lighthouse-badges [-h] [-v] [-s] [-b {flat,flat-square,plastic,for-the-badge,popout,popout-square,social}] [-o OUTPUT_PATH] [-r] -u URL

Generate gh-badges (shields.io) based on lighthouse performance.

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -s, --single-badge    Output only one single badge averaging all lighthouse categories' scores
  -b {flat,flat-square,plastic,for-the-badge,popout,popout-square,social}, --badge-style {flat,flat-square,plastic,for-the-badge,popout,popout-square,social}
                        Define look and feel for the badge
  -o OUTPUT_PATH, --output-path OUTPUT_PATH
                        Define output path for artifacts
  -r, --save-report     Save lighthouse report as html for every supplied url

Required arguments:
  -u URL, --url URL     The lighthouse badge(s) will contain the score(s) of all the supplied url

Additionally, you can pass parameters configurations to the lighthouse process directly via environment variable path to the config file:

# The variable name matters, but the path can be anything
export LIGHTHOUSE_BADGES_CONFIGURATION_PATH="~/.lhb-config.json" 

# "extends": "lighthouse:default" is needed, the rest is optional
cat << EOF >! $LIGHTHOUSE_BADGES_CONFIGURATION_PATH
{
  "extends": "lighthouse:default",
  "settings": {
    "extraHeaders": {
      "Authorization": "Bearer ..."
    },
    "onlyCategories": [
      "performance",
      "pwa"
    ],
    "formFactor": "mobile"
  }
}
EOF

lighthouse-badges --url https://www.youtube.com/

See here for more configuration examples in the official lighthouse docs.

Run

node >= 16 is required.

Option 1: npm

npm i -g lighthouse-badges
lighthouse-badges --url https://www.youtube.com/ -o test_results

Option 2: npx

npx lighthouse-badges --url https://www.youtube.com/ -o test_results

Option 3: Docker

# Warning, the docker version may alter the lighthouse results
docker run --rm \
    -v $PWD/test_results:/home/chrome/reports \
    emazzotta/lighthouse-badges \
    /bin/sh -c "lighthouse-badges --url https://www.youtube.com/"

Develop

npm run dev # Starts babel transpiler in watch mode
npm run start # To run the lighthouse-badges code on google.com

Contributing

See contribution guideline

Sponsors

Sponsored by JetBrains

Jetbrains Logo

Author

Emanuele Mazzotta

More Repositories

1

docker-nginx-lua

๐Ÿณ Dockerized Nginx with modules "more_set_headers", "ngx_pagespeed" and "accept-language"
Dockerfile
10
star
2

unity-tower-defense

๐Ÿ•น This is a simple tower defense game in Unity
C#
6
star
3

carstatus

๐Ÿš˜ Get the current status of your Tesla
Python
6
star
4

dotfiles

โšก๏ธ Collection of my dotfiles
Shell
6
star
5

mvp-statistics-bot

โœ‰๏ธ A telegram bot to keep track of who's been voted MVP in your group chat.
Python
5
star
6

openstack-client

๐Ÿ”… Openstack container with Heat pre-installed
Dockerfile
4
star
7

aerospikedown

๐Ÿ’พ A LevelDOWN API compatible Aerospike adapter for LevelUP
JavaScript
4
star
8

timetracker

โŒš ๏ธPython script to connect to Harvest API to find out my over- or undertime
Python
3
star
9

cli-adventure-game

๐Ÿ•น Created for Java programming course at university
Java
3
star
10

simple-fileserver-docker

๐Ÿ“„ A simple filserver in Docker
Makefile
2
star
11

emazzotta

๐Ÿ—’๐Ÿ‘จ Profile-level README
2
star
12

morsecoder

ใ€ฐ๏ธ Simple Morse Code Encode/Decode and Play Library
Java
2
star
13

information-engineering-project

๐ŸŽ“ A IE1 project solution
Python
2
star
14

caddy

๐Ÿณ A simple Caddy server Docker container
HTML
2
star
15

docker-openssl

๐Ÿณ Simple alpine openssl docker container
Dockerfile
1
star
16

showip

โš™๏ธ A "as simple as it gets" script to determine your machine's internal and external ip address
Shell
1
star
17

bukkit-home-teleport-plugin

โ› A Minecraft Bukkit Plugin to enable the player to set homes, teleport to those homes and invite other players to their home.
Java
1
star
18

docker-git-crypt

๐Ÿณ Simple alpine git-crypt docker container
Dockerfile
1
star