nativescript-cloud
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -137,3 +137,3 @@ "use strict"; | ||
const coreModulesVersion = this.$fs.readJson(path.join(projectSettings.projectDir, "package.json")).dependencies["tns-core-modules"]; | ||
const runtimeVersion = this.getRuntimeVersion(platform, projectSettings.nativescriptData, coreModulesVersion); | ||
const runtimeVersion = yield this.getRuntimeVersion(platform, projectSettings.nativescriptData, coreModulesVersion); | ||
const cliVersion = yield this.getCliVersion(runtimeVersion); | ||
@@ -314,8 +314,15 @@ const sanitizedProjectName = this.$projectHelper.sanitizeName(projectSettings.projectName); | ||
getRuntimeVersion(platform, nativescriptData, coreModulesVersion) { | ||
const runtimePackageName = `tns-${platform.toLowerCase()}`; | ||
let runtimeVersion = nativescriptData && nativescriptData[runtimePackageName] && nativescriptData[runtimePackageName].version; | ||
if (!runtimeVersion && coreModulesVersion && semver.valid(coreModulesVersion)) { | ||
runtimeVersion = `${semver.major(coreModulesVersion)}.${semver.minor(coreModulesVersion)}.*`; | ||
} | ||
return runtimeVersion || "2.5.0"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const runtimePackageName = `tns-${platform.toLowerCase()}`; | ||
let runtimeVersion = nativescriptData && nativescriptData[runtimePackageName] && nativescriptData[runtimePackageName].version; | ||
if (!runtimeVersion && coreModulesVersion) { | ||
if (semver.valid(coreModulesVersion)) { | ||
runtimeVersion = `${semver.major(coreModulesVersion)}.${semver.minor(coreModulesVersion)}.*`; | ||
} | ||
else if (semver.validRange(coreModulesVersion)) { | ||
runtimeVersion = yield this.getLatestMatchingVersion(runtimePackageName, coreModulesVersion); | ||
} | ||
} | ||
return runtimeVersion || CloudBuildService.DEFAULT_VERSION; | ||
}); | ||
} | ||
@@ -325,7 +332,7 @@ getCliVersion(runtimeVersion) { | ||
try { | ||
const response = yield this.$httpClient.httpRequest("http://registry.npmjs.org/nativescript"); | ||
const versions = _.keys(JSON.parse(response.body).versions); | ||
return "2.5.0" || semver.maxSatisfying(versions, `~${runtimeVersion}`); | ||
const latestMatchingVersion = yield this.getLatestMatchingVersion("nativescript", `~${runtimeVersion}`); | ||
return latestMatchingVersion || CloudBuildService.DEFAULT_VERSION; | ||
} | ||
catch (err) { | ||
this.$logger.trace(`Unable to get information about CLI versions. Error is: ${err.message}`); | ||
return `${semver.major(runtimeVersion)}.${semver.minor(runtimeVersion)}.0`; | ||
@@ -335,2 +342,24 @@ } | ||
} | ||
getLatestMatchingVersion(packageName, range) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const versions = yield this.getVersionsFromNpm(packageName); | ||
if (versions.length) { | ||
return semver.maxSatisfying(versions, range); | ||
} | ||
return null; | ||
}); | ||
} | ||
getVersionsFromNpm(packageName) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const response = yield this.$httpClient.httpRequest(`http://registry.npmjs.org/${packageName}`); | ||
const versions = _.keys(JSON.parse(response.body).versions); | ||
return versions; | ||
} | ||
catch (err) { | ||
this.$logger.trace(`Unable to get versions of ${packageName} from npm. Error is: ${err.message}.`); | ||
return []; | ||
} | ||
}); | ||
} | ||
getCertificateInfo(certificatePath, certificatePassword) { | ||
@@ -392,3 +421,4 @@ const certificateAbsolutePath = path.resolve(certificatePath); | ||
} | ||
CloudBuildService.DEFAULT_VERSION = "3.0.0"; | ||
exports.CloudBuildService = CloudBuildService; | ||
$injector.register("cloudBuildService", CloudBuildService); |
{ | ||
"name": "nativescript-cloud", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "Used for cloud support in NativeScript CLI", | ||
@@ -5,0 +5,0 @@ "main": "lib/bootstrap.js", |
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
56743
767