7
7
- 📦 Publish-ready for NPM usage
8
8
- 🔍 Automatically validates URL accessibility before analysis
9
9
- 📊 Comprehensive progress reporting and analysis summaries
10
+ - 📝 Multiple export formats (HTML, JSON, Markdown)
10
11
11
12
## 📦 Installation
12
13
@@ -50,13 +51,26 @@ frontend-performance-analyzer --input urls.json
50
51
# Save HTML report (automatically named based on URL)
51
52
frontend-performance-analyzer --url https://example.com --output
52
53
54
+ # Save JSON report to file
55
+ frontend-performance-analyzer --url https://example.com --json-file report.json
56
+
53
57
# Save Markdown summary (automatically named based on URL)
54
58
frontend-performance-analyzer --url https://example.com --markdown
55
59
56
60
# Output raw JSON to console
57
61
frontend-performance-analyzer --url https://example.com --json
58
62
```
59
63
64
+ ### Logging and Verbosity Options
65
+
66
+ ``` bash
67
+ # Verbose output with debugging details
68
+ frontend-performance-analyzer --url https://example.com --verbose
69
+
70
+ # Minimal output (errors and final results only)
71
+ frontend-performance-analyzer --url https://example.com --silent
72
+ ```
73
+
60
74
### Use Performance Threshold
61
75
62
76
Exit with failure if score is below threshold:
@@ -70,9 +84,10 @@ frontend-performance-analyzer --url https://example.com --threshold 85
70
84
The tool automatically:
71
85
72
86
- ✅ Validates URL format before analysis
73
- - 🔍 Checks URL accessibility with HEAD requests
87
+ - 🔍 Checks URL accessibility with HEAD requests and 10-second timeout
74
88
- ⚠️ Warns about inaccessible URLs and skips them
75
89
- 📊 Provides detailed progress reporting during analysis
90
+ - 🔄 Continues analysis even if some URLs fail
76
91
77
92
## 📊 Sample Output
78
93
@@ -108,15 +123,61 @@ Cumulative Layout Shift: 0.01
108
123
- ` .txt ` : List of URLs separated by new lines
109
124
- ` .json ` : JSON array of URLs, e.g. ` ["https://example.com", "https://github.com"] `
110
125
111
- ## 🚨 Error Handling
126
+ ## 📄 Export Formats
127
+
128
+ ### HTML Reports
129
+
130
+ - Full Lighthouse HTML report with all details
131
+ - Automatically named based on URL (e.g., ` example_com.html ` )
132
+
133
+ ### JSON Reports
134
+
135
+ - Structured JSON output with performance metrics
136
+ - Includes timestamp, tool version, and detailed scores
137
+ - Supports both single URL and batch analysis
138
+ - Contains all Lighthouse categories (Performance, Accessibility, Best Practices, SEO, PWA)
139
+
140
+ ### Markdown Reports
141
+
142
+ - Human-readable performance summary
143
+ - Core Web Vitals breakdown with visual indicators
144
+ - Performance opportunities and diagnostics
145
+ - Category scores with emoji indicators
146
+ - Automatically named based on URL (e.g., ` example_com.md ` )
112
147
113
- The tool provides comprehensive validation:
148
+ ## 🚨 Error Handling & Validation
114
149
115
- - ** Invalid URLs** : checks URL format before processing
116
- - ** Inaccessible URLs** : tests connectivity and skips unreachable sites
117
- - ** File validation** : ensures input files exist and have correct extensions
150
+ The tool provides comprehensive validation and error handling:
151
+
152
+ - ** Invalid URLs** : validates URL format before processing
153
+ - ** Inaccessible URLs** : tests connectivity with HEAD requests and 10-second timeout
154
+ - ** File validation** : ensures input files exist and have correct extensions (.txt or .json)
118
155
- ** Threshold validation** : validates threshold values are between 0-100
119
156
- ** Graceful failures** : continues analysis even if some URLs fail
157
+ - ** Lighthouse warnings** : filters internal Lighthouse warnings for cleaner output
158
+ - ** Browser management** : proper cleanup of browser instances
159
+
160
+ ## 🔧 Advanced Features
161
+
162
+ ### Logging Levels
163
+
164
+ - ** Normal** : standard output with progress indicators
165
+ - ** Verbose** (` --verbose ` ): detailed debugging information including timing
166
+ - ** Silent** (` --silent ` ): minimal output, errors and final results only
167
+
168
+ ### Performance Monitoring
169
+
170
+ - Tracks analysis time per URL
171
+ - Reports overall performance (URLs/second)
172
+ - Browser launch and close timing
173
+ - Accessibility check timing
174
+
175
+ ### Batch Processing
176
+
177
+ - Supports multiple URL analysis in a single run
178
+ - Consolidated JSON export for batch results
179
+ - Individual file exports for each URL
180
+ - Progress tracking with clear indicators
120
181
121
182
## 🛠 Development
122
183
@@ -127,6 +188,20 @@ npm install
127
188
node cli.js --url https://example.com
128
189
```
129
190
191
+ ### Project Structure
192
+
193
+ ```
194
+ ├── cli.js # Main CLI entry point
195
+ ├── lib/
196
+ │ ├── lighthouse.js # Lighthouse analysis logic
197
+ │ ├── logger.js # Logging utilities
198
+ │ └── url-utils.js # URL validation and processing
199
+ └── report-formatters/
200
+ ├── console.js # Console output formatting
201
+ ├── json.js # JSON export functionality
202
+ └── markdown.js # Markdown report generation
203
+ ```
204
+
130
205
## 📄 License
131
206
132
207
MIT © 2025 Oleksandr Zadvornyi
0 commit comments