-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 4297693 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
commit: |
There was a problem hiding this 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'; |
There was a problem hiding this comment.
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.
Lines 87 to 89 in 5831535
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'); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Closes: #199