Skip to content

Commit a2443d2

Browse files
authored
chore: improve messaging (#16)
1 parent 5149878 commit a2443d2

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

main.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24415,7 +24415,9 @@ async function run() {
2441524415
core4.info(`Dependency count increase: ${depIncrease}`);
2441624416
if (depIncrease >= dependencyThreshold) {
2441724417
messages.push(
24418-
`\u26A0\uFE0F **Dependency Count Warning**: This PR adds ${depIncrease} new dependencies (${baseDepCount} \u2192 ${currentDepCount}), which exceeds the threshold of ${dependencyThreshold}.`
24418+
`## \u26A0\uFE0F Dependency Count
24419+
24420+
This PR adds ${depIncrease} new dependencies (${baseDepCount} \u2192 ${currentDepCount}), which exceeds the threshold of ${dependencyThreshold}.`
2441924421
);
2442024422
}
2442124423
const duplicateWarnings = [];
@@ -24433,7 +24435,7 @@ async function run() {
2443324435

2443424436
\u{1F4A1} To find out what depends on a specific package, run: \`${exampleCommand}\`` : "";
2443524437
messages.push(
24436-
`\u26A0\uFE0F **Duplicate Dependencies Warning** (threshold: ${duplicateThreshold}):
24438+
`## \u26A0\uFE0F Duplicate Dependencies (threshold: ${duplicateThreshold})
2443724439

2443824440
${duplicateWarnings.join("\n")}${helpMessage}`
2443924441
);
@@ -24458,7 +24460,9 @@ ${duplicateWarnings.join("\n")}${helpMessage}`
2445824460
if (sizeData !== null && sizeData.totalSize >= sizeThreshold) {
2445924461
const packageRows = Array.from(sizeData.packageSizes.entries()).sort(([, a], [, b]) => b - a).map(([pkg, size]) => `| ${pkg} | ${formatBytes(size)} |`).join("\n");
2446024462
messages.push(
24461-
`\u26A0\uFE0F **Large Dependency Size Increase**: This PR adds ${formatBytes(sizeData.totalSize)} of new dependencies, which exceeds the threshold of ${formatBytes(sizeThreshold)}.
24463+
`## \u26A0\uFE0F Large Dependency Size Increase
24464+
24465+
This PR adds ${formatBytes(sizeData.totalSize)} of new dependencies, which exceeds the threshold of ${formatBytes(sizeThreshold)}.
2446224466

2446324467
| Package | Size |
2446424468
|---------|------|
@@ -24498,7 +24502,9 @@ ${packageRows}`
2449824502
return `| ${change.name} | ${baseSize} | ${sourceSize} | ${sizeChange} |`;
2449924503
}).join("\n");
2450024504
messages.push(
24501-
`\u26A0\uFE0F **Package Size Increase Warning**: These packages exceed the size increase threshold of ${formatBytes(packSizeThreshold)}:
24505+
`## \u26A0\uFE0F Package Size Increase
24506+
24507+
These packages exceed the size increase threshold of ${formatBytes(packSizeThreshold)}:
2450224508

2450324509
| Package | Base Size | Source Size | Size Change |
2450424510
|---------|-----------|-------------|-------------|

src/main.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ async function run(): Promise<void> {
121121

122122
if (depIncrease >= dependencyThreshold) {
123123
messages.push(
124-
`⚠️ **Dependency Count Warning**: This PR adds ${depIncrease} new dependencies (${baseDepCount}${currentDepCount}), which exceeds the threshold of ${dependencyThreshold}.`
124+
`## ⚠️ Dependency Count
125+
126+
This PR adds ${depIncrease} new dependencies (${baseDepCount}${currentDepCount}), which exceeds the threshold of ${dependencyThreshold}.`
125127
);
126128
}
127129

@@ -141,7 +143,9 @@ async function run(): Promise<void> {
141143
? `\n\n💡 To find out what depends on a specific package, run: \`${exampleCommand}\``
142144
: '';
143145
messages.push(
144-
`⚠️ **Duplicate Dependencies Warning** (threshold: ${duplicateThreshold}):\n\n${duplicateWarnings.join('\n')}${helpMessage}`
146+
`## ⚠️ Duplicate Dependencies (threshold: ${duplicateThreshold})
147+
148+
${duplicateWarnings.join('\n')}${helpMessage}`
145149
);
146150
}
147151

@@ -179,7 +183,12 @@ async function run(): Promise<void> {
179183
.join('\n');
180184

181185
messages.push(
182-
`⚠️ **Large Dependency Size Increase**: This PR adds ${formatBytes(sizeData.totalSize)} of new dependencies, which exceeds the threshold of ${formatBytes(sizeThreshold)}.\n\n| Package | Size |\n|---------|------|\n${packageRows}`
186+
`## ⚠️ Large Dependency Size Increase
187+
188+
This PR adds ${formatBytes(sizeData.totalSize)} of new dependencies, which exceeds the threshold of ${formatBytes(sizeThreshold)}.
189+
190+
| Package | Size |\n|---------|------|
191+
${packageRows}`
183192
);
184193
}
185194
} catch (err) {
@@ -229,7 +238,12 @@ async function run(): Promise<void> {
229238
.join('\n');
230239

231240
messages.push(
232-
`⚠️ **Package Size Increase Warning**: These packages exceed the size increase threshold of ${formatBytes(packSizeThreshold)}:\n\n| Package | Base Size | Source Size | Size Change |\n|---------|-----------|-------------|-------------|\n${packRows}`
241+
`## ⚠️ Package Size Increase
242+
243+
These packages exceed the size increase threshold of ${formatBytes(packSizeThreshold)}:
244+
245+
| Package | Base Size | Source Size | Size Change |\n|---------|-----------|-------------|-------------|
246+
${packRows}`
233247
);
234248
}
235249
}

0 commit comments

Comments
 (0)