Skip to content

Commit

Permalink
chore: move minimum Node version to 18
Browse files Browse the repository at this point in the history
  • Loading branch information
fwouts committed Jan 2, 2024
1 parent abda6a6 commit bc9795a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 35 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test-app-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ jobs:
os: [ubuntu-22.04, macos-11, windows-2022]
group: [1, 2, 3]
include:
- node-version: 16.x
- node-version: 18.x
os: ubuntu-22.04
group: 1
- node-version: 16.x
- node-version: 18.x
os: ubuntu-22.04
group: 2
- node-version: 16.x
- node-version: 18.x
os: ubuntu-22.04
group: 3
steps:
Expand Down
36 changes: 15 additions & 21 deletions framework-plugins/svelte/tests/smoke-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,21 @@ test.describe.parallel("smoke tests", () => {
ids: {
svelte3: ["src/App.svelte:App"],
svelte4: ["src/App.svelte:App"],
...(parseInt(process.versions.node.split(".")[0]!) >= 16
? {
// SvelteKit requires Node 16.
// See https://github.com/sveltejs/kit/issues/2412
"sveltekit-app": ["src/routes/+page.svelte:+page"],
"sveltekit-demo": [
"src/routes/+page.svelte:+page",
"src/routes/Header.svelte:Header",
],
"vite-storybook-js": [
"src/stories/Button.stories.js:Primary",
"src/stories/Page.stories.js:LoggedOut",
"src/stories/Page.stories.js:LoggedIn",
],
"vite-storybook-ts": [
"src/stories/Button.stories.ts:Primary",
"src/stories/Page.stories.ts:LoggedOut",
"src/stories/Page.stories.ts:LoggedIn",
],
}
: {}),
"sveltekit-app": ["src/routes/+page.svelte:+page"],
"sveltekit-demo": [
"src/routes/+page.svelte:+page",
"src/routes/Header.svelte:Header",
],
"vite-storybook-js": [
"src/stories/Button.stories.js:Primary",
"src/stories/Page.stories.js:LoggedOut",
"src/stories/Page.stories.js:LoggedIn",
],
"vite-storybook-ts": [
"src/stories/Button.stories.ts:Primary",
"src/stories/Page.stories.ts:LoggedOut",
"src/stories/Page.stories.ts:LoggedIn",
],
},
});
});
2 changes: 1 addition & 1 deletion integrations/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
"typescript": "^5.3.3"
},
"engines": {
"node": "^16.20.0 || ^18 || ^20"
"node": ">=18"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,8 @@ ${e.stackTraceToString()}""",
val matchResult = "v(\\d+)\\.(\\d+)".toRegex().find(nodeVersion)
matchResult?.let {
val majorVersion = matchResult.groups[1]!!.value.toInt()
val minorVersion = matchResult.groups[2]!!.value.toInt()
// Minimum version: 16.14.0.
if (majorVersion < 16 || majorVersion == 16 && minorVersion < 14) {
throw NodeVersionError("Preview.js needs NodeJS 16.14.0+ to run, but current version is: ${nodeVersion}\n\nPlease upgrade then restart your IDE.")
if (majorVersion < 18) {
throw NodeVersionError("Preview.js needs NodeJS 18+ to run, but current version is: ${nodeVersion}\n\nPlease upgrade then restart your IDE.")
}
}
}
Expand Down
8 changes: 3 additions & 5 deletions integrations/vscode/src/start-daemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,22 +205,20 @@ function checkNodeVersionResult(result: ExecaReturnValue<string>):
result.exitCode !== 0 ? ` with exit code ${result.exitCode}` : "";
return {
kind: "invalid",
message: `Preview.js needs NodeJS 16.14.0+ but running \`node\` failed${withExitCode}.\n\nIs it installed? You may need to restart your IDE.\n`,
message: `Preview.js needs NodeJS 18+ but running \`node\` failed${withExitCode}.\n\nIs it installed? You may need to restart your IDE.\n`,
};
}
const nodeVersion = stripAnsi(result.stdout).split("\n").at(-1)!.trim();
const match = nodeVersion.match(/^v(\d+)\.(\d+).*$/);
const invalidVersion = {
kind: "invalid",
message: `Preview.js needs NodeJS 16.14.0+ to run.\n\nPlease upgrade then restart your IDE.`,
message: `Preview.js needs NodeJS 18+ to run.\n\nPlease upgrade then restart your IDE.`,
} as const;
if (!match) {
return invalidVersion;
}
const majorVersion = parseInt(match[1]!, 10);
const minorVersion = parseInt(match[2]!, 10);
// Minimum version: 16.14.0.
if (majorVersion < 16 || (majorVersion === 16 && minorVersion < 14)) {
if (majorVersion < 18) {
return invalidVersion;
}

Expand Down
2 changes: 1 addition & 1 deletion screenshot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"e2e-test": "cd test-app && node generate-screenshots.js"
},
"engines": {
"node": "^14.18.0 || >=16.0.0"
"node": ">=18"
},
"dependencies": {
"@previewjs/analyzer-api": "^0.1.5",
Expand Down

0 comments on commit bc9795a

Please sign in to comment.