(results)
| 177 | } |
| 178 | |
| 179 | function generateReport(results) { |
| 180 | logSection('Performance Report Summary'); |
| 181 | |
| 182 | if (results.buildTime) { |
| 183 | log(`Build Time: ${formatTime(results.buildTime)}`, colors.green); |
| 184 | } |
| 185 | |
| 186 | if (results.analysis) { |
| 187 | log(`Total Files: ${results.analysis.totalFiles}`, colors.blue); |
| 188 | log(`Total Size: ${(results.analysis.totalSize / 1024 / 1024).toFixed(2)} MB`, colors.blue); |
| 189 | log(`Chunk Files: ${results.analysis.chunkFiles}`, colors.blue); |
| 190 | } |
| 191 | |
| 192 | if (results.storyFiles) { |
| 193 | log(`Story Files: ${results.storyFiles.length}`, colors.blue); |
| 194 | } |
| 195 | |
| 196 | log('\nRecommendations:', colors.yellow); |
| 197 | |
| 198 | if (results.buildTime && results.buildTime > 60000) { |
| 199 | log(' • Build time is high. Consider enabling more aggressive caching.', colors.yellow); |
| 200 | } else if (results.buildTime) { |
| 201 | log(' ✓ Build time is acceptable.', colors.green); |
| 202 | } |
| 203 | |
| 204 | if (results.analysis && results.analysis.totalSize > 50 * 1024 * 1024) { |
| 205 | log(' • Total size is large. Consider code splitting and lazy loading.', colors.yellow); |
| 206 | } else if (results.analysis) { |
| 207 | log(' ✓ Total size is reasonable.', colors.green); |
| 208 | } |
| 209 | |
| 210 | if (results.analysis && results.analysis.chunkFiles > 0) { |
| 211 | log(' ✓ Code splitting is enabled.', colors.green); |
| 212 | } else { |
| 213 | log(' • Code splitting not detected. Enable splitChunks in webpack config.', colors.yellow); |
| 214 | } |
| 215 | |
| 216 | log('\nPerformance testing complete!', colors.bright + colors.green); |
| 217 | } |
| 218 | |
| 219 | // Main execution |
| 220 | async function main() { |
no test coverage detected