Skip to content

Commit

Permalink
fix: suggestion output formating bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
wkillerud committed Sep 17, 2024
1 parent f410e0c commit 68b0560
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
17 changes: 7 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export async function verifyConditions(
logger.log(title);
logs.push(title);
for (let suggestion of suggestions) {
let message = ` ${formatMessage(suggestion, packageJson)}`;
let message = ` ${formatMessage(suggestion, packageJson, { color: false })}`;
if (message) {
logger.log(message);
logs.push(message);
Expand All @@ -91,7 +91,7 @@ export async function verifyConditions(
logger.log(title);
logs.push(title);
for (let warning of warnings) {
let message = ` ${formatMessage(warning, packageJson)}`;
let message = ` ${formatMessage(warning, packageJson, { color: false })}`;
if (message) {
logger.log(message);
logs.push(message);
Expand All @@ -104,7 +104,7 @@ export async function verifyConditions(
logger.log(title);
logs.push(title);
for (let error of errors) {
let message = ` ${formatMessage(error, packageJson)}`;
let message = ` ${formatMessage(error, packageJson, { color: false })}`;
if (message) {
logger.log(message);
logs.push(message);
Expand All @@ -113,15 +113,12 @@ export async function verifyConditions(
}

if (shouldThrow) {
let message = `publint reported ${errors.length} errors and ${
warnings.length
} warnings\n${logs.join("\n")}`;
if (DEBUG) {
logger.log(message + ", throwing");
logger.log(`publint reported ${errors.length} errors and ${warnings.length} warnings\n${logs.join("\n")}`);
}
throw new SemanticReleaseError(message, "EPUBLINT", `${suggestions.join("\n")}
${warnings.join("\n")}
${errors.join("\n")}`.trim());

const errorMessage = `publint reported ${errors.length} errors and ${warnings.length} warnings`;
throw new SemanticReleaseError(errorMessage, "EPUBLINT", logs.join("\n"));
}
}
}
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"dependencies": {
"@semantic-release/error": "^4.0.0",
"picocolors": "^1.0.1",
"publint": "^0.2.9"
"publint": "^0.2.11"
},
"devDependencies": {
"semantic-release": "^24.0.0"
Expand Down

0 comments on commit 68b0560

Please sign in to comment.