MCPcopy Create free account
hub / github.com/Effect-TS/effect / createComparisonReport

Method createComparisonReport

packages/tools/bundle/src/Reporter.ts:118–140  ·  view source on GitHub ↗
(
        entries: ReadonlyArray<{
          readonly current: BundleStats
          readonly previous: BundleStats
          readonly filename: string
        }>
      )

Source from the content-addressed store, hash-verified

116 }
117
118 const createComparisonReport = (
119 entries: ReadonlyArray<{
120 readonly current: BundleStats
121 readonly previous: BundleStats
122 readonly filename: string
123 }>
124 ): string => {
125 const lines: Array<string> = [
126 "| File Name | Current Size | Previous Size | Difference |",
127 "|:----------|:------------:|:-------------:|:----------:|"
128 ]
129 for (const { current, previous, filename } of entries) {
130 const comparison = calculateDifference(current, previous)
131 const currKb = `${comparison.currKb} KB`
132 const prevKb = `${comparison.prevKb} KB`
133 const diffKb = `${comparison.diffKb} KB`
134 const diffPct = `${comparison.diffPct.toFixed(2)}%`
135 const sign = comparison.diff === 0 ? "" : comparison.diff > 0 ? "+" : "-"
136 const line = `| \`${filename}\` | ${currKb} | ${prevKb} | ${sign}${diffKb} (${sign}${diffPct}) |`
137 lines.push(line)
138 }
139 return lines.join("\n") + "\n"
140 }
141
142 const createReport = (curr: ReadonlyArray<BundleStats>, prev: ReadonlyArray<BundleStats>): string => {
143 const entries: Array<{

Callers

nothing calls this directly

Calls 2

pushMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected