@loopback/dist-util
Advanced tools
Comparing version 0.3.6 to 0.3.7
@@ -6,2 +6,11 @@ # Change Log | ||
<a name="0.3.7"></a> | ||
## [0.3.7](https://github.com/strongloop/loopback-next/compare/@loopback/dist-util@0.3.6...@loopback/dist-util@0.3.7) (2018-09-10) | ||
**Note:** Version bump only for package @loopback/dist-util | ||
<a name="0.3.6"></a> | ||
@@ -8,0 +17,0 @@ ## [0.3.6](https://github.com/strongloop/loopback-next/compare/@loopback/dist-util@0.3.5...@loopback/dist-util@0.3.6) (2018-08-08) |
27
index.js
@@ -9,11 +9,24 @@ // Copyright IBM Corp. 2018. All Rights Reserved. | ||
const path = require('path'); | ||
const util = require('util'); | ||
const semver = require('semver'); | ||
/** | ||
* Make sure node version meets the requirement. This file intentionally | ||
* only uses ES5 features so that it can be run with lower versions of Node | ||
* to report the version requirement. | ||
*/ | ||
function checkNodeVersion(range) { | ||
const nodeVer = process.versions.node; | ||
const requiredVer = range || require('./package.json').engines.node; | ||
const ok = semver.satisfies(nodeVer, requiredVer); | ||
if (!ok) { | ||
const format = 'Node.js %s is not supported. Please use a version %s.'; | ||
const msg = util.format(format, nodeVer, requiredVer); | ||
throw new Error(msg); | ||
} | ||
} | ||
function getDist() { | ||
checkNodeVersion(); | ||
const nodeMajorVersion = +process.versions.node.split('.')[0]; | ||
if (nodeMajorVersion < 8) { | ||
throw new Error( | ||
`Node.js version ${process.versions.node} is not supported.` + | ||
'Please use Node.js 8.9 or newer.', | ||
); | ||
} | ||
return nodeMajorVersion >= 10 ? './dist10' : './dist8'; | ||
@@ -27,2 +40,2 @@ } | ||
module.exports = {getDist, loadDist}; | ||
module.exports = {getDist, loadDist, checkNodeVersion}; |
{ | ||
"name": "@loopback/dist-util", | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"description": "Select dist directory based on Node.js major version.", | ||
@@ -12,2 +12,5 @@ "homepage": "https://github.com/strongloop/loopback-next/tree/master/packages/dist-select", | ||
}, | ||
"dependencies": { | ||
"semver": "^5.5.1" | ||
}, | ||
"files": [ | ||
@@ -24,3 +27,4 @@ "index.js" | ||
"copyright.owner": "IBM Corp.", | ||
"license": "MIT" | ||
"license": "MIT", | ||
"gitHead": "b351268a9b150252573a3295d4fe650540576a60" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6395
33
1
+ Addedsemver@^5.5.1
+ Addedsemver@5.7.2(transitive)