From 0769c5b200fe27d9dfb77db097f0c8b71e166893 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 16 Jan 2020 11:40:54 -0800 Subject: [PATCH] allow new majors of node to be automatically considered supported PR-URL: https://github.com/npm/cli/pull/697 Credit: @ljharb Close: #697 Reviewed-by: @isaacs --- lib/utils/unsupported.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/utils/unsupported.js b/lib/utils/unsupported.js index c34e17374e040..8e0d729b307fd 100644 --- a/lib/utils/unsupported.js +++ b/lib/utils/unsupported.js @@ -1,5 +1,6 @@ 'use strict' var semver = require('semver') +var earliestSupportedNode = '9.3.0' var supportedNode = [ {ver: '6', min: '6.0.0'}, {ver: '8', min: '8.0.0'}, @@ -14,10 +15,11 @@ var knownBroken = '<6.2.0 || 9.0 - 9.2' var checkVersion = exports.checkVersion = function (version) { var versionNoPrerelease = version.replace(/-.*$/, '') + var isExplicitlySupportedNode = semver.satisfies(versionNoPrerelease, supportedNode.map(function (n) { return '^' + n.min }).join('||')) return { version: versionNoPrerelease, broken: semver.satisfies(versionNoPrerelease, knownBroken), - unsupported: !semver.satisfies(versionNoPrerelease, supportedNode.map(function (n) { return '^' + n.min }).join('||')) + unsupported: !isExplicitlySupportedNode || !semver.gte(versionNoPrerelease, earliestSupportedNode) } }