From 25a9b4aa3a049a3ddfefd4f1ef2f8973d9a35e83 Mon Sep 17 00:00:00 2001 From: Austin Burdine Date: Tue, 20 Sep 2016 02:24:42 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20remove=20preinstall=20node=20ver?= =?UTF-8?q?sion=20check=20(#7403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit no issue - this is now handled in Ghost-CLI --- core/server/utils/npm/preinstall.js | 47 ----------------------------- package.json | 1 - 2 files changed, 48 deletions(-) delete mode 100644 core/server/utils/npm/preinstall.js diff --git a/core/server/utils/npm/preinstall.js b/core/server/utils/npm/preinstall.js deleted file mode 100644 index 46781b276d..0000000000 --- a/core/server/utils/npm/preinstall.js +++ /dev/null @@ -1,47 +0,0 @@ -var validVersions = process.env.npm_package_engines_node.split(' || '), - currentVersion = process.versions.node, - foundMatch = false, - majMinRegex = /(\d+\.\d+)/, - majorRegex = /^\d+/, - minorRegex = /\d+$/, - exitCodes = { - NODE_VERSION_UNSUPPORTED: 231 - }; - -function doError() { - console.error('\x1B[31mERROR: Unsupported version of Node'); - console.error('\x1B[37mGhost supports LTS Node versions: ' + process.env.npm_package_engines_node); - console.error('You are currently using version: ' + process.versions.node + '\033[0m'); - console.error('\x1B[32mThis check can be overridden, see http://support.ghost.org/supported-node-versions/ for more info\033[0m'); - - process.exit(exitCodes.NODE_VERSION_UNSUPPORTED); -} - -if (process.env.GHOST_NODE_VERSION_CHECK === 'false') { - console.log('\x1B[33mSkipping Node version check\033[0m'); -} else { - try { - currentVersion = currentVersion.match(majMinRegex)[0]; - - validVersions.forEach(function (version) { - var matchChar = version.charAt(0), - versionString = version.match(majMinRegex)[0]; - - if ( - (matchChar === '~' && currentVersion === versionString) - || (matchChar === '^' - && currentVersion.match(majorRegex)[0] === versionString.match(majorRegex)[0] - && currentVersion.match(minorRegex)[0] >= versionString.match(minorRegex)[0] - ) - ) { - foundMatch = true; - } - }); - - if (foundMatch !== true) { - doError(); - } - } catch (e) { - doError(); - } -} diff --git a/package.json b/package.json index 61390bd1e4..42a09805da 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "license": "MIT", "main": "./core/index", "scripts": { - "preinstall": "node core/server/utils/npm/preinstall.js", "start": "node index", "test": "grunt validate --verbose" },