Skip to content

Commit

Permalink
chore: improve unsupported environment message (#152)
Browse files Browse the repository at this point in the history
Co-authored-by: AdrianGonz97 <[email protected]>
  • Loading branch information
manuel3108 and AdrianGonz97 authored Oct 16, 2024
1 parent f0edc6d commit 7027e5d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/fast-icons-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'sv': patch
---

chore: improve unsupported environment message
15 changes: 10 additions & 5 deletions packages/cli/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
}
]
Expand Down

0 comments on commit 7027e5d

Please sign in to comment.