Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isaacs/simplify supported node #945

Closed
wants to merge 8 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
allow new majors of node to be automatically considered supported
PR-URL: #697
Credit: @ljharb
Close: #697
Reviewed-by: @isaacs
ljharb authored and isaacs committed Feb 25, 2020

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit e34373f27a6b89b4a57b33d75da281343e9b5e9e
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'},
@@ -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)
}
}