UNPKG

@rist/preset-react

Version:
26 lines (25 loc) 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CheckNodeVersion = void 0; const semver = require("semver"); const chalk = require("chalk"); class CheckNodeVersionFactory { constructor(expect, name) { this.getCheckNodeVersion = () => { if (!semver.satisfies(process.version, this.expect)) { console.log(chalk.red('You are using Node ' + process.version + ', but this version of ' + this.name + ' requires Node ' + this.expect + '.\nPlease upgrade your Node version.')); process.exit(1); } if (semver.satisfies(process.version, '9.x')) { console.log(chalk.red(`You are using Node ${process.version}.\n` + `Node.js 9.x has already reached end-of-life and will not be supported in future major releases.\n` + `It's strongly recommended to use an active LTS version instead.`)); process.exit(1); } }; this.expect = expect; this.name = name; } } exports.CheckNodeVersion = CheckNodeVersionFactory;