Skip to content

feat(add): Add minimum Node.js version warning if below 16. #625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jycouet
Copy link
Contributor

@jycouet jycouet commented Jun 29, 2025

Closes: #199

Copy link

changeset-bot bot commented Jun 29, 2025

🦋 Changeset detected

Latest commit: 4297693

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
sv Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

pkg-pr-new bot commented Jun 29, 2025

Open in StackBlitz

npx https://pkg.pr.new/sveltejs/cli/sv@625
npx https://pkg.pr.new/sveltejs/cli/svelte-migrate@625

commit: 4297693

Copy link
Member

@manuel3108 manuel3108 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great start!

@@ -4,6 +4,7 @@ import * as p from '@clack/prompts';
import type { Argument, HelpConfiguration, Option } from 'commander';
import { UnsupportedError } from './errors.ts';
import process from 'node:process';
import semver from 'semver';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already this code in the repo, that seems to be more elaborate. Also it does not require an additional dependency. We could probably extract that into a separate function.

const nodeVersion = process.versions.node;
const isDenoOrBun = Boolean(process.versions.deno ?? process.versions.bun);
const [major] = nodeVersion.split('.');

@@ -75,6 +76,15 @@ type MaybePromise = () => Promise<void> | void;
export async function runCommand(action: MaybePromise): Promise<void> {
try {
p.intro(`Welcome to the Svelte CLI! ${pc.gray(`(v${pkg.version})`)}`);

const isUnSupportedNodeVersion =
process.versions.node && semver.lt(process.versions.node, '16.0.0');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for choosing version 16? According to https://nodejs.org/en/about/previous-releases the latest non end of life version would be 20. Alternatively, we could align with kit and go with version 18.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think any version it runs on should be allowed. I'd at least support Node 18 if the CLI works there since kit supports it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add minimum Node.js version warning to sv
3 participants