foghorn
v1.1.1
Published
A CLI tool to generate, compare, and analyze Lighthouse reports, ideal for performance tracking and CI/CD integration
Downloads
19
Readme
Foghorn
Lighthouse Report Generator
This project generates Lighthouse reports for specified URLs and provides a comparison with previous reports.
Prerequisites
- Bun (v1.1.21 or later)
- Node.js (v14 or later, for Lighthouse)
Installation
Clone the repository:
git clone https://github.com/your-username/lighthouse-report-generator.git cd lighthouse-report-generator
Install dependencies:
bun install
Usage
To generate a Lighthouse report for a URL:
bun index.js -u https://example.com
Replace https://example.com
with the URL you want to analyze.
Project Structure
index.js
: Main entry point of the applicationreportGenerator.js
: Handles report generation and comparisonreportStorage.js
: Manages storage and retrieval of reportstemplates/report.ejs
: EJS template for the HTML report
Configuration
You can modify the following files to customize the report generation:
reportStorage.js
: Adjust theBASE_DIR
constant to change the directory where reports are storedtemplates/report.ejs
: Modify the HTML template to change the report layout
Output
The script generates two files for each run:
- An HTML report:
test-output/<domain>/html/report-<timestamp>.html
- A JSON report:
test-output/<domain>/json/report-<timestamp>.json
The HTML report includes:
- Current scores
- A comparison chart of the last 5 reports
- A table comparing the last 5 reports
Troubleshooting
If you encounter any issues:
- Ensure you have the latest version of Bun installed
- Check that all dependencies are correctly installed
- Verify that you have the necessary permissions to write to the
test-output
directory
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License.