Skip to content

Commit 918726f

Browse files
authored
Check Node.js version (#857)
1 parent 2125b4f commit 918726f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/tstl.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,20 @@ function updateWatchCompilationHost(
204204
};
205205
}
206206

207+
function checkNodeVersion(): void {
208+
const [major, minor] = process.version
209+
.slice(1)
210+
.split(".")
211+
.map(Number);
212+
const isValid = major > 12 || (major === 12 && minor >= 13);
213+
if (!isValid) {
214+
console.error(`TypeScriptToLua requires Node.js >=12.13.0, the current version is ${process.version}`);
215+
process.exit(1);
216+
}
217+
}
218+
219+
checkNodeVersion();
220+
207221
if (ts.sys.setBlocking) {
208222
ts.sys.setBlocking();
209223
}

0 commit comments

Comments
 (0)