Skip to content

Commit

Permalink
size only if package info exist too
Browse files Browse the repository at this point in the history
  • Loading branch information
carlesnunez committed Jun 19, 2020
1 parent 47ec0cd commit a3692bd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5441,13 +5441,14 @@ exports.getMarkDownTable = (sizesAdded, sizesRemoved) => {
const removedGzipSize = (parseInt(sizeRemoved.gzip) / 1024).toFixed(1);
const removedRawSize = (sizeRemoved.size / 1024).toFixed(1)
const removedIsBlockedMessage = packageInfo.gzip > core.getInput("threshold") ? "❌" : "✅"
table += `| − | [${sizeRemoved.package}](https://bundlephobia.com/result?p=${sizeRemoved.package}) | ${removedGzipSize}kB | ${removedRawSize}kB | ${removedIsBlockedMessage}
table += `| − | [${sizeRemoved.package}](https://bundlephobia.com/result?p=${sizeRemoved.package}) | ${removedGzipSize}kB | ${removedRawSize}kB |
`;

const gzipedDiff = (((parseInt(packageInfo.gzip) / 1024).toFixed(1)) - ((parseInt(sizeRemoved.gzip) / 1024).toFixed(1))).toFixed(1);
const sizeDiff = (((parseInt(packageInfo.size) / 1024).toFixed(1)) - ((parseInt(sizeRemoved.size) / 1024).toFixed(1))).toFixed(1);

table += `| | | ${Math.sign(gzipedDiff) && gzipedDiff !== '0.0' ? '+' : ''}${gzipedDiff !== '0.0' ? gzipedDiff + 'kB' : ''} | ${Math.sign(sizeDiff) && sizeDiff !== '0.0' ? '+' : ''}${sizeDiff !== '0.0' ? sizeDiff + 'kB' : ''} | `;
table += `| | | ${gzipedDiff !== '0.0' ? gzipedDiff + 'kB' : ''} | ${sizeDiff !== '0.0' ? sizeDiff + 'kB' : ''} |
`;

}
}
Expand Down

0 comments on commit a3692bd

Please sign in to comment.