Skip to content

Commit 5de1a91

Browse files
ci: fix "size report" (bundle size) markdown table comment formatting (#6318)
## Summary Fixes #6136 by adding empty lines between html and markdown in the bundle size report comments. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6318-ci-fix-size-report-bundle-size-markdown-table-comment-formatting-2996d73d36508104872be56c238339a8) by [Unito](https://www.unito.io)
1 parent b3eee54 commit 5de1a91

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

scripts/size-report.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,11 @@ function renderCategoryDetails(report) {
314314

315315
for (const category of report.categories) {
316316
lines.push(renderCategoryBlock(category, report.hasBaseline))
317+
lines.push('')
318+
}
319+
320+
if (report.categories.length > 0) {
321+
lines.pop()
317322
}
318323

319324
lines.push('</details>')
@@ -339,9 +344,11 @@ function renderCategoryBlock(category, hasBaseline) {
339344

340345
summaryParts.push('</summary>')
341346
lines.push(summaryParts.join(''))
347+
lines.push('')
342348

343349
if (category.description) {
344350
lines.push(`_${category.description}_`)
351+
lines.push('')
345352
}
346353

347354
if (category.bundles.length === 0) {
@@ -382,6 +389,7 @@ function renderCategoryBlock(category, hasBaseline) {
382389
})
383390

384391
lines.push(markdownTable([headers, ...rows]))
392+
lines.push('')
385393

386394
const statusParts = []
387395
if (category.counts.added) statusParts.push(`${category.counts.added} added`)
@@ -393,10 +401,11 @@ function renderCategoryBlock(category, hasBaseline) {
393401
statusParts.push(`${category.counts.decreased} shrank`)
394402

395403
if (statusParts.length > 0) {
396-
lines.push(`\n_Status:_ ${statusParts.join(' / ')}`)
404+
lines.push(`_Status:_ ${statusParts.join(' / ')}`)
405+
lines.push('')
397406
}
398407

399-
lines.push('</details>\n')
408+
lines.push('</details>')
400409
return lines.join('\n')
401410
}
402411

0 commit comments

Comments
 (0)