From b99b38d87576ec21605d9745dd0d8cae8f0acdf8 Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Sun, 15 Jan 2017 14:47:33 +0100 Subject: [PATCH] Throw an error if node version is below six --- bin/release.js | 8 ++++++++ package.json | 1 + 2 files changed, 9 insertions(+) diff --git a/bin/release.js b/bin/release.js index 93b3db5..60628f2 100755 --- a/bin/release.js +++ b/bin/release.js @@ -3,6 +3,8 @@ // Packages const asyncToGen = require('async-to-gen/register') const updateNotifier = require('update-notifier') +const {red} = require('chalk') +const nodeVersion = require('node-version') // Ours const pkg = require('../package') @@ -12,6 +14,12 @@ asyncToGen({ excludes: null }) +// Throw an error if node version is too low +if (nodeVersion.major < 6) { + console.error(`${red('Error!')} Now requires at least version 6 of Node. Please upgrade!`) + process.exit(1) +} + // Let user know if there's an update // This isn't important when deployed to Now if (!process.env.NOW) { diff --git a/package.json b/package.json index a977c6a..a7ecb66 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "git-username": "^0.5.0", "github": "^8.0.0", "inquirer": "^2.0.0", + "node-version": "^1.0.0", "open": "0.0.5", "ora": "^0.4.1", "pluralize": "^3.1.0",