Skip to content

Commit

Permalink
Don’t dim text and tweak indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
delucis committed Dec 5, 2024
1 parent 2c93b93 commit 2170904
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions packages/astro/src/core/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,10 @@ export function formatConfigErrorMessage(err: ZodError) {
const errorList = err.issues.map((issue) =>
`! ${renderErrorMarkdown(issue.message, 'cli')}`
// Make text wrapped in backticks blue.
.replaceAll(codeRegex, cyan('$1'))
.replaceAll(codeRegex, blue('$1'))
// Make the first line red and indent the rest.
.split('\n')
// Dim all lines in an issue except for the first which should be red.
.map((line, index) => (index > 0 ? dim(line) : red(line)))
// Indent all lines.
.map((line) => ' ' + line)
.map((line, index) => (index === 0 ? red(line) : ' ' + line))
.join('\n'),
);
return `${red('[config]')} Astro found issue(s) with your configuration:\n\n${errorList.join(
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/test/units/config/config-validate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('Config Validation', () => {
formattedError,
`[config] Astro found issue(s) with your configuration:
! site: Expected type "string", received "number"`,
! site: Expected type "string", received "number"`,
);
});

Expand All @@ -40,9 +40,9 @@ describe('Config Validation', () => {
formattedError,
`[config] Astro found issue(s) with your configuration:
! integrations.0: Expected type "object", received "number"
! integrations.0: Expected type "object", received "number"
! build.format: Did not match union.
! build.format: Did not match union.
> Expected "file" | "directory" | "preserve", received "invalid"`,
);
});
Expand Down

0 comments on commit 2170904

Please sign in to comment.