emazzotta/lighthouse-badges
์๊ฐ
๐ฆ Generate badges (shields.io) based on Lighthouse performance.
์์คํ ๋ฐ ์ธํ๋ผ์ธก์ ๋ ์คํ ์ฆ๊ฐ
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- ๊ธฐ๋ก ์์ง ์ค
์๋ก ๊ฒน์น๋ ๊ธฐ๊ฐ์ ์์ฆ๊ฐ๋์ด๋ฉฐ ์ผ๋ณ ํฉ๊ณ๊ฐ ์๋๋๋ค. ์ธก์ ๊ฐ์ด ์์ผ๋ฉด ๋น์ ๋ก๋๋ค. ์คํ๋ ๊ด์ฌ๋๋ฅผ ๋ํ๋ด๋ฉฐ ํ์ง์ ๋ณด์ฅํ์ง ์์ต๋๋ค.
README.md
OriginalLighthouse Badges
This package allows you to easily create Lighthouse badges for all Lighthouse categories.
Ever wanted to brag about your site's awesome Lighthouse performance? Then this is the package for you!
https://github.com/user-attachments/assets/c94f48eb-3ac5-4013-8b4e-9327ec108a8c
Examples
All Badges
Single Badge
Usage
Help
usage: lighthouse-badges [-h] [-v] [-s]
[-b {flat,flat-square,plastic,for-the-badge,social}]
[-o OUTPUT_PATH] [-r] -u URL
Generate gh-badges (shields.io) based on lighthouse performance.
options:
-h, --help show this help message and exit
-v, --version Show the version of the tool
-s, --single-badge Output only one single badge averaging all lighthouse
categories' scores
-b, --badge-style {flat,flat-square,plastic,for-the-badge,social}
Define look and feel for the badge
-o, --output-path OUTPUT_PATH
Define output path for artifacts
-r, --save-report Save the lighthouse report as html next to the badges
Required arguments:
-u, --url URL The url whose lighthouse scores the badge(s) will show
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="$HOME/.lhb-config.json"
# "extends": "lighthouse:default" is needed, the rest is optional
cat >| "$LIGHTHOUSE_BADGES_CONFIGURATION_PATH" << 'EOF'
{
"extends": "lighthouse:default",
"settings": {
"extraHeaders": {
"Authorization": "Bearer ..."
},
"onlyCategories": [
"performance",
"seo"
],
"formFactor": "mobile"
}
}
EOF
lighthouse-badges --url https://www.youtube.com/
See here for more configuration examples in the official lighthouse docs.
Chrome runs with its sandbox. Where the sandbox cannot start, for example as root in a container, set LIGHTHOUSE_BADGES_DISABLE_SANDBOX=true to pass --no-sandbox. The Docker image sets it.
Run
Options 1 and 2 install with Bun and run the command on Node.js >= 22.19, which Lighthouse 13 requires. The Docker image brings its own runtime.
Option 1: bun
bun install -g lighthouse-badges
lighthouse-badges --url https://www.youtube.com/ -o test_results
Option 2: bunx
bunx lighthouse-badges --url https://www.youtube.com/ -o test_results
Option 3: Docker
# May alter lighthouse results due to performance differences compared to running directly on host
docker run --rm \
-v $PWD/test_results:/home/chrome/reports \
emazzotta/lighthouse-badges \
/bin/sh -c "lighthouse-badges --url https://www.youtube.com/"
Develop
The build needs jq on the PATH.
bun run start # To run the lighthouse-badges code on google.com
Contributing
Sponsors
Sponsored by JetBrains
Author
๊ด๋ จ ํ๋ก์ ํธ ์ดํด๋ณด๊ธฐ
๋ถ๋ฌ์ค๋ ์คโฆ