@theholocron/lighthouse-config
v7.19.1
Published
A Lighthouse CI configuration for auditing performance and accessibility within the Galaxy.
Maintainers
Readme
Lighthouse Config
A Lighthouse CI configuration with sensible defaults for auditing performance and accessibility within the Galaxy.
Installation
pnpm add -D @theholocron/lighthouse-configInstall @lhci/cli to run audits:
pnpm add -D @lhci/cliUsage
Create a lighthouse.config.js at the project root and pass it to lhci with --config:
import { defineConfig } from "@theholocron/lighthouse-config";
export default defineConfig({
url: "http://localhost:5173/",
startServerCommand: "pnpm dev",
});Run with:
pnpm lhci autorun --config=./lighthouse.config.jsNote:
@lhci/clidoes not support upward directory traversal for config discovery. Always pass--config=./lighthouse.config.jsexplicitly.
Options
| Option | Type | Default | Description |
| -------------------- | --------------------- | ---------------------------- | ------------------------------------------------- |
| url | string \| string[] | — | URL(s) to audit |
| startServerCommand | string | — | Command to start the dev server before collecting |
| assertions | LighthouseAssertion | defaultAssertions | Audit thresholds |
| uploadTarget | string | "temporary-public-storage" | Where to upload results |
Default assertions
The defaultAssertions export contains the standard set of thresholds. All audit at warn level with a minScore of 0.9 (or maxLength: 0 for byte-size audits):
bf-cache,errors-in-console,font-display,labellargest-contentful-paint,lcp-lazy-loadednon-composited-animations,prioritize-lcp-imageunused-javascript,uses-long-cache-ttl
Override individual thresholds by spreading and replacing:
import { defineConfig, defaultAssertions } from "@theholocron/lighthouse-config";
export default defineConfig({
url: "http://localhost:5173/",
startServerCommand: "pnpm dev",
assertions: {
...defaultAssertions,
"largest-contentful-paint": ["error", { minScore: 0.95 }],
},
});