From 2170904fe9d094704fc9e5b8ab4b9385c12d47bb Mon Sep 17 00:00:00 2001 From: Chris Swithinbank Date: Thu, 5 Dec 2024 12:58:20 +0100 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20dim=20text=20and=20tweak=20inde?= =?UTF-8?q?ntation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/astro/src/core/messages.ts | 8 +++----- packages/astro/test/units/config/config-validate.test.js | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/astro/src/core/messages.ts b/packages/astro/src/core/messages.ts index 209fbdabacb7..4198e96c3794 100644 --- a/packages/astro/src/core/messages.ts +++ b/packages/astro/src/core/messages.ts @@ -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( diff --git a/packages/astro/test/units/config/config-validate.test.js b/packages/astro/test/units/config/config-validate.test.js index 87494ac79b61..2ef08e4b6a36 100644 --- a/packages/astro/test/units/config/config-validate.test.js +++ b/packages/astro/test/units/config/config-validate.test.js @@ -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"`, ); }); @@ -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"`, ); });