Skip to content

Commit 82884e3

Browse files
authored
feat: use tables instead of lists (#23)
* feat: use tables instead of lists * chore: emojis
1 parent 4a92b99 commit 82884e3

File tree

2 files changed

+36
-30
lines changed

2 files changed

+36
-30
lines changed

main.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24475,24 +24475,26 @@ async function run() {
2447524475
This PR adds ${depIncrease} new dependencies (${baseDepCount} \u2192 ${currentDepCount}), which exceeds the threshold of ${dependencyThreshold}.`
2447624476
);
2447724477
}
24478-
const duplicateWarnings = [];
24478+
const duplicateRows = [];
2447924479
for (const [packageName, currentVersionSet] of currentDeps) {
2448024480
if (currentVersionSet.size > duplicateThreshold) {
2448124481
const versions = Array.from(currentVersionSet).sort();
24482-
duplicateWarnings.push(
24483-
`\u{1F4E6} **${packageName}**: ${currentVersionSet.size} versions (${versions.join(", ")})`
24482+
duplicateRows.push(
24483+
`| ${packageName} | ${currentVersionSet.size} versions | ${versions.join(", ")} |`
2448424484
);
2448524485
}
2448624486
}
24487-
if (duplicateWarnings.length > 0) {
24487+
if (duplicateRows.length > 0) {
2448824488
const exampleCommand = getLsCommand(lockfilePath, "example-package");
2448924489
const helpMessage = exampleCommand ? `
2449024490

2449124491
\u{1F4A1} To find out what depends on a specific package, run: \`${exampleCommand}\`` : "";
2449224492
messages.push(
2449324493
`## \u26A0\uFE0F Duplicate Dependencies (threshold: ${duplicateThreshold})
2449424494

24495-
${duplicateWarnings.join("\n")}${helpMessage}`
24495+
| \u{1F4E6} Package | \u{1F522} Version Count | \u{1F4CB} Versions |
24496+
| --- | --- | --- |
24497+
${duplicateRows.join("\n")}${helpMessage}`
2449624498
);
2449724499
}
2449824500
const newVersions = [];
@@ -24519,16 +24521,16 @@ ${duplicateWarnings.join("\n")}${helpMessage}`
2451924521

2452024522
This PR adds ${formatBytes(sizeData.totalSize)} of new dependencies, which exceeds the threshold of ${formatBytes(sizeThreshold)}.
2452124523

24522-
| Package | Size |
24523-
|---------|------|
24524+
| \u{1F4E6} Package | \u{1F4CF} Size |
24525+
| --- | --- |
2452424526
${packageRows}`
2452524527
);
2452624528
}
2452724529
} catch (err) {
2452824530
core4.info(`Failed to calculate total dependency size increase: ${err}`);
2452924531
}
2453024532
}
24531-
const provenanceWarnings = [];
24533+
const provenanceRows = [];
2453224534
for (const [packageName, currentVersionSet] of currentDeps) {
2453324535
const baseVersionSet = baseDeps.get(packageName);
2453424536
if (!baseVersionSet || baseVersionSet.size === 0) {
@@ -24552,24 +24554,24 @@ ${packageRows}`
2455224554
const minBaseTrust = getMinTrustLevel(baseProvenances.values());
2455324555
const minCurrentTrust = getMinTrustLevel(currentProvenances.values());
2455424556
if (minCurrentTrust.level < minBaseTrust.level) {
24555-
provenanceWarnings.push(
24556-
`\u{1F512} **${packageName}**: trust level decreased (${minBaseTrust.status} \u2192 ${minCurrentTrust.status})`
24557+
provenanceRows.push(
24558+
`| ${packageName} | ${minBaseTrust.status} | ${minCurrentTrust.status} |`
2455724559
);
2455824560
}
2455924561
} catch (err) {
2456024562
core4.info(`Failed to check provenance for ${packageName}: ${err}`);
2456124563
}
2456224564
}
24563-
if (provenanceWarnings.length > 0) {
24565+
if (provenanceRows.length > 0) {
2456424566
messages.push(
2456524567
`## \u26A0\uFE0F Package Trust Level Decreased
2456624568

2456724569
> [!CAUTION]
2456824570
> Decreased trust levels may indicate a higher risk of supply chain attacks. Please review these changes carefully.
2456924571

24570-
These packages have decreased trust levels:
24571-
24572-
${provenanceWarnings.join("\n")}`
24572+
| \u{1F4E6} Package | \u{1F512} Before | \u{1F513} After |
24573+
| --- | --- | --- |
24574+
${provenanceRows.join("\n")}`
2457324575
);
2457424576
}
2457524577
const basePackagesPattern = core4.getInput("base-packages");
@@ -24605,8 +24607,8 @@ ${provenanceWarnings.join("\n")}`
2460524607

2460624608
These packages exceed the size increase threshold of ${formatBytes(packSizeThreshold)}:
2460724609

24608-
| Package | Base Size | Source Size | Size Change |
24609-
|---------|-----------|-------------|-------------|
24610+
| \u{1F4E6} Package | \u{1F4CF} Base Size | \u{1F4CF} Source Size | \u{1F4C8} Size Change |
24611+
| --- | --- | --- | --- |
2461024612
${packRows}`
2461124613
);
2461224614
}

src/main.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -131,25 +131,27 @@ This PR adds ${depIncrease} new dependencies (${baseDepCount} → ${currentDepCo
131131
);
132132
}
133133

134-
const duplicateWarnings: string[] = [];
134+
const duplicateRows: string[] = [];
135135
for (const [packageName, currentVersionSet] of currentDeps) {
136136
if (currentVersionSet.size > duplicateThreshold) {
137137
const versions = Array.from(currentVersionSet).sort();
138-
duplicateWarnings.push(
139-
`📦 **${packageName}**: ${currentVersionSet.size} versions (${versions.join(', ')})`
138+
duplicateRows.push(
139+
`| ${packageName} | ${currentVersionSet.size} versions | ${versions.join(', ')} |`
140140
);
141141
}
142142
}
143143

144-
if (duplicateWarnings.length > 0) {
144+
if (duplicateRows.length > 0) {
145145
const exampleCommand = getLsCommand(lockfilePath, 'example-package');
146146
const helpMessage = exampleCommand
147147
? `\n\n💡 To find out what depends on a specific package, run: \`${exampleCommand}\``
148148
: '';
149149
messages.push(
150150
`## ⚠️ Duplicate Dependencies (threshold: ${duplicateThreshold})
151151
152-
${duplicateWarnings.join('\n')}${helpMessage}`
152+
| 📦 Package | 🔢 Version Count | 📋 Versions |
153+
| --- | --- | --- |
154+
${duplicateRows.join('\n')}${helpMessage}`
153155
);
154156
}
155157

@@ -191,7 +193,8 @@ ${duplicateWarnings.join('\n')}${helpMessage}`
191193
192194
This PR adds ${formatBytes(sizeData.totalSize)} of new dependencies, which exceeds the threshold of ${formatBytes(sizeThreshold)}.
193195
194-
| Package | Size |\n|---------|------|
196+
| 📦 Package | 📏 Size |
197+
| --- | --- |
195198
${packageRows}`
196199
);
197200
}
@@ -200,7 +203,7 @@ ${packageRows}`
200203
}
201204
}
202205

203-
const provenanceWarnings: string[] = [];
206+
const provenanceRows: string[] = [];
204207

205208
for (const [packageName, currentVersionSet] of currentDeps) {
206209
const baseVersionSet = baseDeps.get(packageName);
@@ -231,25 +234,25 @@ ${packageRows}`
231234
const minCurrentTrust = getMinTrustLevel(currentProvenances.values());
232235

233236
if (minCurrentTrust.level < minBaseTrust.level) {
234-
provenanceWarnings.push(
235-
`🔒 **${packageName}**: trust level decreased (${minBaseTrust.status} ${minCurrentTrust.status})`
237+
provenanceRows.push(
238+
`| ${packageName} | ${minBaseTrust.status} | ${minCurrentTrust.status} |`
236239
);
237240
}
238241
} catch (err) {
239242
core.info(`Failed to check provenance for ${packageName}: ${err}`);
240243
}
241244
}
242245

243-
if (provenanceWarnings.length > 0) {
246+
if (provenanceRows.length > 0) {
244247
messages.push(
245248
`## ⚠️ Package Trust Level Decreased
246249
247250
> [!CAUTION]
248251
> Decreased trust levels may indicate a higher risk of supply chain attacks. Please review these changes carefully.
249252
250-
These packages have decreased trust levels:
251-
252-
${provenanceWarnings.join('\n')}`
253+
| 📦 Package | 🔒 Before | 🔓 After |
254+
| --- | --- | --- |
255+
${provenanceRows.join('\n')}`
253256
);
254257
}
255258

@@ -299,7 +302,8 @@ ${provenanceWarnings.join('\n')}`
299302
300303
These packages exceed the size increase threshold of ${formatBytes(packSizeThreshold)}:
301304
302-
| Package | Base Size | Source Size | Size Change |\n|---------|-----------|-------------|-------------|
305+
| 📦 Package | 📏 Base Size | 📏 Source Size | 📈 Size Change |
306+
| --- | --- | --- | --- |
303307
${packRows}`
304308
);
305309
}

0 commit comments

Comments
 (0)