3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Verify required Node.js version

This commit is contained in:
Dragory 2018-12-14 06:27:41 +02:00
parent 2e30a3b9e7
commit 42f45af499

View file

@ -4,6 +4,8 @@ import yaml from "js-yaml";
import _fs from "fs";
const fs = _fs.promises;
import { SimpleError } from "./SimpleError";
require("dotenv").config();
process.on("unhandledRejection", (reason, p) => {
@ -22,6 +24,16 @@ process.on("uncaughtException", err => {
}
});
// Verify required Node.js version
const REQUIRED_NODE_VERSION = "10.14.2";
const requiredParts = REQUIRED_NODE_VERSION.split(".").map(v => parseInt(v, 10));
const actualVersionParts = process.versions.node.split(".").map(v => parseInt(v, 10));
for (const [i, part] of actualVersionParts.entries()) {
if (part < requiredParts[i]) {
throw new SimpleError(`Unsupported Node.js version! Must be at least ${REQUIRED_NODE_VERSION}`);
}
}
// Always use UTC
import moment from "moment-timezone";
moment.tz.setDefault("UTC");