-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: messy issues with nodeVersionUtils helper needing semver install…
…ed (#489)
- Loading branch information
Showing
8 changed files
with
35 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const getNodeVersion = require('../../src/lib/getNodeVersion'); | ||
const pkg = require('../../package.json'); | ||
const semver = require('semver'); | ||
|
||
describe('#getNodeVersion()', () => { | ||
it('should extract version that matches range in package.json', () => { | ||
const version = parseInt(getNodeVersion(), 10); | ||
const cleanedVersion = semver.valid(semver.coerce(version)); | ||
expect(semver.satisfies(cleanedVersion, pkg.engines.node)).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const pkg = require('../../package.json'); | ||
|
||
/** | ||
* @example 14 | ||
* @returns {String} The maximum major Node.js version specified in the package.json | ||
*/ | ||
module.exports = function getNodeVersion() { | ||
const { node } = pkg.engines; | ||
return Array.from(node.matchAll(/\d+/g)).pop(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const semver = require('semver'); | ||
const pkg = require('../../package.json'); | ||
|
||
/** | ||
* Determine if the current version of Node is one that we explicitly support. | ||
* | ||
*/ | ||
module.exports = function isSupportedNodeVersion(version) { | ||
return semver.satisfies(semver.coerce(version), pkg.engines.node); | ||
}; |
This file was deleted.
Oops, something went wrong.