| 140 | } |
| 141 | |
| 142 | const createReport = (curr: ReadonlyArray<BundleStats>, prev: ReadonlyArray<BundleStats>): string => { |
| 143 | const entries: Array<{ |
| 144 | readonly current: BundleStats |
| 145 | readonly previous: BundleStats |
| 146 | readonly filename: string |
| 147 | }> = [] |
| 148 | for (const current of curr) { |
| 149 | const previous = prev.find((previous) => { |
| 150 | return path.basename(previous.path) === path.basename(current.path) |
| 151 | }) ?? current |
| 152 | entries.push({ |
| 153 | current, |
| 154 | previous, |
| 155 | filename: path.basename(current.path) |
| 156 | }) |
| 157 | } |
| 158 | return createComparisonReport(entries) |
| 159 | } |
| 160 | |
| 161 | const createSelectedReport = (stats: ReadonlyArray<BundleStats>): string => { |
| 162 | const lines: Array<string> = [ |