Skip to content

Commit

Permalink
fix: Add an error for unsupported runtimes (#1007)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianGonz97 authored Apr 10, 2024
1 parent 5f142c7 commit 9c20e7a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-mails-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"shadcn-svelte": patch
---

fix: Added an error for unsupported runtimes
7 changes: 7 additions & 0 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ const currentVersion = process.versions.node;
const currentMajorVersion = Number.parseInt(currentVersion.split(".")[0]!, 10);
const minimumMajorVersion = 18;

// @ts-expect-error types for these globals are not defined
if (typeof Bun !== "undefined" || typeof Deno !== "undefined") {
console.error("You are currently using an unsupported runtime!");
console.error(`Please use Node.js v${minimumMajorVersion} or higher.`);
process.exit(1);
}

if (currentMajorVersion < minimumMajorVersion) {
console.error(`Node.js v${currentVersion} is out of date and unsupported!`);
console.error(`Please use Node.js v${minimumMajorVersion} or higher.`);
Expand Down

0 comments on commit 9c20e7a

Please sign in to comment.