Reporter: Fix summary code blocks
This commit is contained in:
parent
0561bd1951
commit
dc74d28b86
1 changed files with 15 additions and 13 deletions
|
@ -75,9 +75,11 @@ const IGNORED_DISCORD_ERRORS = [
|
||||||
"Attempting to set fast connect zstd when unsupported"
|
"Attempting to set fast connect zstd when unsupported"
|
||||||
] as Array<string | RegExp>;
|
] as Array<string | RegExp>;
|
||||||
|
|
||||||
function toCodeBlock(s: string) {
|
function toCodeBlock(s: string, indentation = 0, isDiscord = false) {
|
||||||
s = s.replace(/```/g, "`\u200B`\u200B`");
|
s = s.replace(/```/g, "`\u200B`\u200B`");
|
||||||
return "```" + s + " ```";
|
|
||||||
|
const indentationStr = Array(indentation).fill(" ").join("");
|
||||||
|
return `\`\`\`\n${s.split("\n").map(s => indentationStr + s).join("\n")}\n${!isDiscord ? indentationStr : ""}\`\`\``;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function printReport() {
|
async function printReport() {
|
||||||
|
@ -91,35 +93,35 @@ async function printReport() {
|
||||||
report.badPatches.forEach(p => {
|
report.badPatches.forEach(p => {
|
||||||
console.log(`- ${p.plugin} (${p.type})`);
|
console.log(`- ${p.plugin} (${p.type})`);
|
||||||
console.log(` - ID: \`${p.id}\``);
|
console.log(` - ID: \`${p.id}\``);
|
||||||
console.log(` - Match: ${toCodeBlock(p.match)}`);
|
console.log(` - Match: ${toCodeBlock(p.match, " - Match: ".length)}`);
|
||||||
if (p.error) console.log(` - Error: ${toCodeBlock(p.error)}`);
|
if (p.error) console.log(` - Error: ${toCodeBlock(p.error, " - Error: ".length)}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log();
|
console.log();
|
||||||
|
|
||||||
console.log("## Bad Webpack Finds");
|
console.log("## Bad Webpack Finds");
|
||||||
report.badWebpackFinds.forEach(p => console.log("- " + p));
|
report.badWebpackFinds.forEach(p => console.log("- " + toCodeBlock(p, "- ".length)));
|
||||||
|
|
||||||
console.log();
|
console.log();
|
||||||
|
|
||||||
console.log("## Bad Starts");
|
console.log("## Bad Starts");
|
||||||
report.badStarts.forEach(p => {
|
report.badStarts.forEach(p => {
|
||||||
console.log(`- ${p.plugin}`);
|
console.log(`- ${p.plugin}`);
|
||||||
console.log(` - Error: ${toCodeBlock(p.error)}`);
|
console.log(` - Error: ${toCodeBlock(p.error, " - Error: ".length)}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log();
|
console.log();
|
||||||
|
|
||||||
console.log("## Discord Errors");
|
console.log("## Discord Errors");
|
||||||
report.otherErrors.forEach(e => {
|
report.otherErrors.forEach(e => {
|
||||||
console.log(`- ${toCodeBlock(e)}`);
|
console.log(`- ${toCodeBlock(e, "- ".length)}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log();
|
console.log();
|
||||||
|
|
||||||
console.log("## Ignored Discord Errors");
|
console.log("## Ignored Discord Errors");
|
||||||
report.ignoredErrors.forEach(e => {
|
report.ignoredErrors.forEach(e => {
|
||||||
console.log(`- ${toCodeBlock(e)}`);
|
console.log(`- ${toCodeBlock(e, "- ".length)}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log();
|
console.log();
|
||||||
|
@ -141,16 +143,16 @@ async function printReport() {
|
||||||
const lines = [
|
const lines = [
|
||||||
`**__${p.plugin} (${p.type}):__**`,
|
`**__${p.plugin} (${p.type}):__**`,
|
||||||
`ID: \`${p.id}\``,
|
`ID: \`${p.id}\``,
|
||||||
`Match: ${toCodeBlock(p.match)}`
|
`Match: ${toCodeBlock(p.match, "Match: ".length, true)}`
|
||||||
];
|
];
|
||||||
if (p.error) lines.push(`Error: ${toCodeBlock(p.error)}`);
|
if (p.error) lines.push(`Error: ${toCodeBlock(p.error, "Error: ".length, true)}`);
|
||||||
return lines.join("\n");
|
return lines.join("\n");
|
||||||
}).join("\n\n") || "None",
|
}).join("\n\n") || "None",
|
||||||
color: report.badPatches.length ? 0xff0000 : 0x00ff00
|
color: report.badPatches.length ? 0xff0000 : 0x00ff00
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Bad Webpack Finds",
|
title: "Bad Webpack Finds",
|
||||||
description: report.badWebpackFinds.map(toCodeBlock).join("\n") || "None",
|
description: report.badWebpackFinds.map(f => toCodeBlock(f, 0, true)).join("\n") || "None",
|
||||||
color: report.badWebpackFinds.length ? 0xff0000 : 0x00ff00
|
color: report.badWebpackFinds.length ? 0xff0000 : 0x00ff00
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -158,7 +160,7 @@ async function printReport() {
|
||||||
description: report.badStarts.map(p => {
|
description: report.badStarts.map(p => {
|
||||||
const lines = [
|
const lines = [
|
||||||
`**__${p.plugin}:__**`,
|
`**__${p.plugin}:__**`,
|
||||||
toCodeBlock(p.error)
|
toCodeBlock(p.error, 0, true)
|
||||||
];
|
];
|
||||||
return lines.join("\n");
|
return lines.join("\n");
|
||||||
}
|
}
|
||||||
|
@ -167,7 +169,7 @@ async function printReport() {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Discord Errors",
|
title: "Discord Errors",
|
||||||
description: report.otherErrors.length ? toCodeBlock(report.otherErrors.join("\n")) : "None",
|
description: report.otherErrors.length ? toCodeBlock(report.otherErrors.join("\n"), 0, true) : "None",
|
||||||
color: report.otherErrors.length ? 0xff0000 : 0x00ff00
|
color: report.otherErrors.length ? 0xff0000 : 0x00ff00
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue