|
| 1 | +# ⚡️ Frontend Performance Analyzer |
| 2 | + |
| 3 | +**A simple CLI tool to analyze frontend performance using Lighthouse and Puppeteer.** |
| 4 | + |
| 5 | +- 🧠 Built for developers who care about performance |
| 6 | +- 🚀 Powered by headless Chrome and real metrics |
| 7 | +- 📦 Publish-ready for NPM usage |
| 8 | + |
| 9 | +## 📦 Installation |
| 10 | + |
| 11 | +You can run it instantly via `npx`: |
| 12 | + |
| 13 | +```bash |
| 14 | +npx frontend-performance-analyzer --url https://example.com |
| 15 | +``` |
| 16 | + |
| 17 | +Or install it globally: |
| 18 | + |
| 19 | +```bash |
| 20 | +npm install -g frontend-performance-analyzer |
| 21 | +``` |
| 22 | + |
| 23 | +## 🚀 Usage |
| 24 | + |
| 25 | +### Analyze a Single URL |
| 26 | + |
| 27 | +```bash |
| 28 | +frontend-performance-analyzer --url https://example.com |
| 29 | +``` |
| 30 | + |
| 31 | +### Analyze Multiple URLs |
| 32 | + |
| 33 | +```bash |
| 34 | +frontend-performance-analyzer --url https://example.com https://github.com |
| 35 | +``` |
| 36 | + |
| 37 | +### Load URLs from File |
| 38 | + |
| 39 | +```bash |
| 40 | +frontend-performance-analyzer --input urls.txt |
| 41 | +# or |
| 42 | +frontend-performance-analyzer --input urls.json |
| 43 | +``` |
| 44 | + |
| 45 | +### Export Report |
| 46 | + |
| 47 | +```bash |
| 48 | +# Save HTML report |
| 49 | +frontend-performance-analyzer --url https://example.com --output report.html |
| 50 | + |
| 51 | +# Save Markdown summary |
| 52 | +frontend-performance-analyzer --url https://example.com --markdown report.md |
| 53 | + |
| 54 | +# Output raw JSON |
| 55 | +frontend-performance-analyzer --url https://example.com --json |
| 56 | +``` |
| 57 | + |
| 58 | +### Use Performance Threshold |
| 59 | + |
| 60 | +Exit with failure if score is too low: |
| 61 | + |
| 62 | +```bash |
| 63 | +frontend-performance-analyzer --url https://example.com --threshold 85 |
| 64 | +``` |
| 65 | + |
| 66 | +## 📊 Sample Output |
| 67 | + |
| 68 | +``` |
| 69 | +📊 Performance Metrics for https://example.com |
| 70 | +Score: 93/100 |
| 71 | +
|
| 72 | +First Contentful Paint: 1.2 s |
| 73 | +Speed Index: 1.9 s |
| 74 | +Largest Contentful Paint: 1.4 s |
| 75 | +Time to Interactive: 1.6 s |
| 76 | +Total Blocking Time: 30 ms |
| 77 | +Cumulative Layout Shift: 0.01 |
| 78 | +``` |
| 79 | + |
| 80 | +## 📁 Input File Formats |
| 81 | + |
| 82 | +- `.txt`: List of URLs separated by new lines |
| 83 | +- `.json`: JSON array of URLs, e.g. `["https://example.com", "https://github.com"]` |
| 84 | + |
| 85 | +## 🛠 Development |
| 86 | + |
| 87 | +Clone the repo and run: |
| 88 | + |
| 89 | +```bash |
| 90 | +npm install |
| 91 | +node cli.js --url https://example.com |
| 92 | +``` |
| 93 | + |
| 94 | +## 📄 License |
| 95 | + |
| 96 | +MIT © 2025 Oleksandr Zadvornyi |
0 commit comments