Skip to content

Commit

Permalink
chore: Change unsupported runtime error (#1011)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianGonz97 authored Apr 10, 2024
1 parent 734b1b0 commit 6a30f8a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/fluffy-cobras-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"shadcn-svelte": patch
---

fix: Changed unsupported runtime error into a warning and fixed a Bun specific issue
7 changes: 0 additions & 7 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ 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
4 changes: 2 additions & 2 deletions packages/cli/src/utils/auto-detect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ function find(dirPath: string, ignores: { dirPath: string; ig: Ignore }[]): stri
}

for (const file of files) {
const filepath = path.join(file.path, file.name);
const filepath = path.join(dirPath, file.name);
// ignore any of the common suspects
if (IGNORE.some((name) => file.path.includes(name))) continue;
if (IGNORE.some((name) => dirPath.includes(name))) continue;

// check if file is ignored
const ignored = ignores.some((parent) => {
Expand Down
7 changes: 7 additions & 0 deletions packages/cli/src/utils/prompt-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ export function intro() {
const title = color.bgHex("#FF5500").black(" shadcn-svelte ");
const version = color.gray(` v${packageInfo.version} `);
p.intro(title + version);

// @ts-expect-error types for these globals are not defined
if (typeof Bun !== "undefined" || typeof Deno !== "undefined") {
p.log.warn(
`You are currently using an unsupported runtime. Only Node.js v18 or higher is officially supported. Continue at your own risk.`
);
}
}

export function cancel() {
Expand Down

0 comments on commit 6a30f8a

Please sign in to comment.