Skip to content

Commit 258ed59

Browse files
authored
fix: enforce Node.js version >= 24.0.0 or crash at runtime (#564)
Closes #563 Example on node 22: ```sh ❯ pnpm tui run > @tui-sandbox/[email protected] tui /Users/mikavilpas/git/tui-sandbox > pnpm --filter=library build && pnpm --filter integration-tests exec tui run packages/library |  WARN  Unsupported engine: wanted: {"node":">=24.0.0"} (current: {"node":"v22.18.0","pnpm":"10.14.0"}) > @tui-sandbox/[email protected] build /Users/mikavilpas/git/tui-sandbox/packages/library > concurrently --names 'vite,tsc' 'vite build' 'tsc' --prefix-colors blue,green [vite] vite v7.0.6 building for production... [vite] transforming... [vite] ✓ 114 modules transformed. [vite] rendering chunks... [vite] computing gzip size... [vite] dist/browser/index.html 0.34 kB │ gzip: 0.23 kB [vite] dist/browser/assets/DejaVuSansMNerdFontMono-Regular-CRJgiq0O.ttf 2,395.67 kB [vite] dist/browser/assets/index-BYvynUT_.css 4.48 kB │ gzip: 1.82 kB [vite] dist/browser/assets/index-BYVmuU8p.js 403.92 kB │ gzip: 103.39 kB [vite] ✓ built in 804ms [vite] vite build exited with code 0 [tsc] tsc exited with code 0 packages/library |  WARN  Unsupported engine: wanted: {"node":">=24.0.0"} (current: {"node":"v22.18.0","pnpm":"10.14.0"}) tui-sandbox error: Node.js >= 24.0.0 is required. You are using v22.18.0. /Users/mikavilpas/git/tui-sandbox/packages/integration-tests:  ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command failed with exit code 1: tui run  ELIFECYCLE  Command failed with exit code 1. ```
1 parent 12f6331 commit 258ed59

File tree

1 file changed

+10
-0
lines changed
  • packages/library/src/scripts

1 file changed

+10
-0
lines changed

packages/library/src/scripts/tui.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import assert from "node:assert"
12
import path from "node:path"
23
import type { TestServerConfig } from "../server/index.js"
34
import { commandRun } from "./commands/commandRun.js"
@@ -10,6 +11,15 @@ import { parseArguments } from "./parseArguments.js"
1011
// This is the main entrypoint to tui-sandbox
1112
//
1213

14+
const [major] = process.versions.node.split(".").map(Number)
15+
assert(major)
16+
assert(!isNaN(major))
17+
18+
if (major < 24) {
19+
console.error(`tui-sandbox error: Node.js >= 24.0.0 is required. You are using ${process.version}.`)
20+
process.exit(1)
21+
}
22+
1323
const outputFileName = "MyTestDirectory.ts"
1424

1525
/** The cwd in the user's directory when they are running this script. Not the

0 commit comments

Comments
 (0)