Skip to content

Commit

Permalink
🤫 Quiet webp warnings (#1499)
Browse files Browse the repository at this point in the history
Only show webp warnings on debug by default. Can turn this back on with an errorRule.
  • Loading branch information
rowanc1 committed Aug 31, 2024
1 parent 8ba7b73 commit 9864473
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/rotten-tools-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"myst-cli": patch
---

Quiet webp warnings to debug
2 changes: 1 addition & 1 deletion packages/myst-cli/src/store/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type ExternalLinkResult = {
statusText?: string;
};

export type WarningKind = 'error' | 'warn' | 'info';
export type WarningKind = 'error' | 'warn' | 'info' | 'debug';

export type BuildWarning = {
message: string;
Expand Down
5 changes: 4 additions & 1 deletion packages/myst-cli/src/utils/addWarningForFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ export function addWarningForFile(
session.log.error(`⛔️ ${prefix}${formatted}`);
break;
case 'warn':
default:
session.log.warn(`⚠️ ${prefix}${formatted}`);
break;
case 'debug':
default:
session.log.debug(`${prefix}${formatted}`);
break;
}
if (opts?.ruleId) {
session.log.debug(
Expand Down
6 changes: 3 additions & 3 deletions packages/myst-cli/src/utils/imagemagick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export async function convertImageToWebp(
session,
image,
`Image is too large (${inMB} MB) to convert to webp (build will be slow).`,
'warn',
(isGif2webpAvailable() && imageExt === '.gif') || isWebpAvailable() ? 'warn' : 'debug',
{ ruleId: RuleId.imageFormatOptimizes },
);
return null;
Expand Down Expand Up @@ -227,7 +227,7 @@ export async function convertImageToWebp(
session,
image,
`Could not convert from image ${image} to webp:\ngif2webp is required\n`,
'warn',
'debug',
{ ruleId: RuleId.imageFormatOptimizes },
);
return null;
Expand All @@ -239,7 +239,7 @@ export async function convertImageToWebp(
session,
image,
`Could not convert from image ${image} to webp:\ncwebp is required\n`,
'warn',
'debug',
{ ruleId: RuleId.imageFormatOptimizes },
);
return null;
Expand Down

0 comments on commit 9864473

Please sign in to comment.