Crash node applications if wrong node version is detected.

This commit is contained in:
Robin Heggelund Hansen 2024-06-19 23:35:40 +02:00
parent be10d8ab37
commit 1064270e63
No known key found for this signature in database

View File

@ -19,6 +19,10 @@ sandwich moduleName javascript =
let name = Name.toBuilder moduleName
in [r|#!/usr/bin/env node
if (parseInt(process.versions.node.split('.')[0]) < 20) {
throw new Error("This program requires Node v20 or later to run")
}
try {
|]
<> javascript