Skip to content

Commit

Permalink
allow new majors of node to be automatically considered supported
Browse files Browse the repository at this point in the history
PR-URL: #697
Credit: @ljharb
Close: #697
Reviewed-by: @isaacs
  • Loading branch information
ljharb authored and darcyclarke committed Feb 25, 2020
1 parent 30f1708 commit 0769c5b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/utils/unsupported.js
Original file line number Diff line number Diff line change
@@ -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'},
Expand All @@ -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)
}
}

Expand Down

0 comments on commit 0769c5b

Please sign in to comment.