From 7027e5dc7e95c7de23f10ba8506a2c7e6cc92fd4 Mon Sep 17 00:00:00 2001 From: Manuel <30698007+manuel3108@users.noreply.github.com> Date: Wed, 16 Oct 2024 19:08:38 +0200 Subject: [PATCH] chore: improve unsupported environment message (#152) Co-authored-by: AdrianGonz97 <31664583+AdrianGonz97@users.noreply.github.com> --- .changeset/fast-icons-clean.md | 5 +++++ packages/cli/common.ts | 15 ++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 .changeset/fast-icons-clean.md diff --git a/.changeset/fast-icons-clean.md b/.changeset/fast-icons-clean.md new file mode 100644 index 00000000..ef8dc272 --- /dev/null +++ b/.changeset/fast-icons-clean.md @@ -0,0 +1,5 @@ +--- +'sv': patch +--- + +chore: improve unsupported environment message diff --git a/packages/cli/common.ts b/packages/cli/common.ts index 829030bc..981af31d 100644 --- a/packages/cli/common.ts +++ b/packages/cli/common.ts @@ -164,14 +164,19 @@ export function getGlobalPreconditions( return false; }); - if (addersForInvalidEnvironment.length == 0) { + if (addersForInvalidEnvironment.length === 0) { return { success: true, message: undefined }; } - const messages = addersForInvalidEnvironment.map( - (a) => `"${a.id}" does not support "${projectType}"` - ); - return { success: false, message: messages.join(' / ') }; + const messages = addersForInvalidEnvironment.map((a) => { + if (projectType === 'kit') { + return `'${a.id}' does not support SvelteKit`; + } else { + return `'${a.id}' requires SvelteKit`; + } + }); + + throw new Error(messages.join('\n')); } } ]