Package Exports
- @unlighthouse/cli
- @unlighthouse/cli/ci
Readme
@unlighthouse/cli
The command-line interface and CI integration for Unlighthouse, enabling automated website scanning in development and deployment workflows.
Installation
# Use directly with npx
npx unlighthouse --site https://example.com
# Or install globally
npm install -g @unlighthouse/cliUsage
Basic Scanning
# Scan a website
unlighthouse --site https://example.com
# Enable debug mode
unlighthouse --site https://example.com --debug
# Mobile device simulation
unlighthouse --site https://example.com --mobileAdvanced Options
# Multiple samples with throttling
unlighthouse --site https://example.com --samples 3 --throttle
# Custom URLs and exclusions
unlighthouse --site https://example.com --urls /home,/about,/contact --exclude-urls /admin/*
# With custom configuration
unlighthouse --site https://example.com --config-file ./my-config.tsCI Integration
# CI mode with exit codes for failed audits
unlighthouse-ci --site https://example.com --budget 75Configuration
Create unlighthouse.config.ts in your project root:
import { defineUnlighthouseConfig } from 'unlighthouse/config'
export default defineUnlighthouseConfig({
site: 'https://example.com',
debug: true,
scanner: {
device: 'desktop',
throttle: false,
},
lighthouseOptions: {
onlyCategories: ['performance', 'accessibility'],
}
})Documentation
License
MIT License © 2021-PRESENT Harlan Wilton