install-nativescript
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -66,3 +66,3 @@ const _ = require("lodash"); | ||
const findCLI = (minVersion) => { | ||
const findCLI = (versionRange) => { | ||
return getNativeScriptCliVersion() | ||
@@ -84,9 +84,9 @@ .then((cliVersion) => { | ||
.then((cliVersion) => { | ||
const hasMinRequirement = !_.isNil(minVersion) && !_.isNull(semver.valid(minVersion)); | ||
const hasRangeRequirement = !_.isNil(versionRange) && !_.isNull(semver.validRange(versionRange)); | ||
if (!hasMinRequirement || semver.gte(cliVersion, minVersion)) { | ||
if (!hasRangeRequirement || semver.satisfies(cliVersion, versionRange)) { | ||
return Promise.resolve(cliVersion); | ||
} | ||
const errorMessage = `Found version ${cliVersion} does not satisfy required minVersion ${minVersion}.`; | ||
const errorMessage = `Found version ${cliVersion} does not satisfy required range ${versionRange}.`; | ||
const error = new Error(errorMessage); | ||
@@ -102,4 +102,4 @@ | ||
const ensureCLI = ({ version = "latest", minVersion } = {}) => { | ||
return findCLI(minVersion) | ||
const ensureCLI = ({ version = "latest", versionRange } = {}) => { | ||
return findCLI(versionRange) | ||
.catch((error) => { | ||
@@ -116,3 +116,3 @@ if (!error || !error.ignoreInstallation) { | ||
return findCLI(minVersion); | ||
return findCLI(versionRange); | ||
}); | ||
@@ -119,0 +119,0 @@ }; |
{ | ||
"name": "install-nativescript", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "Package that helps you install Node.js, npm and nativescript-cli. Works only on Windows and Mac.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -43,3 +43,3 @@ # install-nativescript | ||
- In case it cannot detect it, the method installs it globally using npm. You can pass a specific NativeScript CLI version to install. In case it is not provided, the method installs the latest official version. | ||
- In case it detects a version, the method will update it in case you pass a specific minVersion and the current version does not satisfy the requirement. Again, in case a specific version is not provided, the method installs the latest official version. | ||
- In case it detects a version, the method will update it in case you pass a specific versionRange and the current version does not satisfy the requirement. Again, in case a specific version is not provided, the method installs the latest official version. | ||
@@ -46,0 +46,0 @@ Usage: |
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
31885