Skip to content

Commit

Permalink
feat: move tarball size to table (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
privatenumber authored Dec 12, 2020
1 parent 0bceac9 commit 1049313
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
10 changes: 7 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6778,6 +6778,7 @@ const c$1 = string => `\`${string}\``;
const link = (text, href) => `[${text}](${href})`;
const sub = string => `<sub>${string}</sub>`;
const sup = string => `<sup>${string}</sup>`;
const strong = string => `**${string}**`;

const directionSymbol = value => {
if (value < 0) {
Expand Down Expand Up @@ -6813,10 +6814,15 @@ function generateComment({
) : '—',
]),
[
'**Total** ' + (unchangedFiles === 'show' ? '' : sub('_(Includes all files)_')),
`${strong('Total')} ${(unchangedFiles === 'show' ? '' : sub('_(Includes all files)_'))}`,
c$1(dist(pkgComparison.base.size)),
sup(totalDelta) + c$1(dist(pkgComparison.head.size)),
],
[
strong('Tarball size'),
c$1(dist(pkgComparison.base.tarballSize)),
sup(formatSize(pkgComparison.diff.tarballSize)) + c$1(dist(pkgComparison.head.tarballSize)),
],
], {
align: ['', 'r', 'r'],
});
Expand Down Expand Up @@ -6857,8 +6863,6 @@ function generateComment({
return defaultOutdent`
### 📊 Package size report&nbsp;&nbsp;&nbsp;<kbd>${totalDelta || 'No changes'}</kbd>
**Tarball size** ${c$1(dist(pkgComparison.base.tarballSize))}${sup(formatSize(pkgComparison.diff.tarballSize)) + c$1(dist(pkgComparison.head.tarballSize))}
${table}
${unchangedTable}
Expand Down
11 changes: 7 additions & 4 deletions src/templates/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import byteSize from 'byte-size';
import markdownTable from 'markdown-table';
import outdent from 'outdent';
import {c, sub, sup} from '../utils/markdown';
import {c, sub, sup, strong} from '../utils/markdown';

const directionSymbol = value => {
if (value < 0) {
Expand Down Expand Up @@ -37,10 +37,15 @@ function generateComment({
) : '—',
]),
[
'**Total** ' + (unchangedFiles === 'show' ? '' : sub('_(Includes all files)_')),
`${strong('Total')} ${(unchangedFiles === 'show' ? '' : sub('_(Includes all files)_'))}`,
c(byteSize(pkgComparison.base.size)),
sup(totalDelta) + c(byteSize(pkgComparison.head.size)),
],
[
strong('Tarball size'),
c(byteSize(pkgComparison.base.tarballSize)),
sup(formatSize(pkgComparison.diff.tarballSize)) + c(byteSize(pkgComparison.head.tarballSize)),
],
], {
align: ['', 'r', 'r'],
});
Expand Down Expand Up @@ -81,8 +86,6 @@ function generateComment({
return outdent`
### 📊 Package size report&nbsp;&nbsp;&nbsp;<kbd>${totalDelta || 'No changes'}</kbd>
**Tarball size** ${c(byteSize(pkgComparison.base.tarballSize))}${sup(formatSize(pkgComparison.diff.tarballSize)) + c(byteSize(pkgComparison.head.tarballSize))}
${table}
${unchangedTable}
Expand Down
1 change: 1 addition & 0 deletions src/utils/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export const c = string => `\`${string}\``;
export const link = (text, href) => `[${text}](${href})`;
export const sub = string => `<sub>${string}</sub>`;
export const sup = string => `<sup>${string}</sup>`;
export const strong = string => `**${string}**`;

0 comments on commit 1049313

Please sign in to comment.