Skip to content

Commit 20641e7

Browse files
committed
fix: support tgz runtime versions
1 parent 6b88f4c commit 20641e7

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

lib/android-tools-info.ts

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -368,22 +368,33 @@ export class AndroidToolsInfo implements NativeScriptDoctor.IAndroidToolsInfo {
368368
}
369369

370370
private getAndroidRuntimeVersionFromProjectDir(projectDir: string): string {
371+
let runtimePackage: string = null;
371372
let runtimeVersion: string = null;
372373
if (projectDir && this.fs.exists(projectDir)) {
373374
const pathToPackageJson = path.join(projectDir, Constants.PACKAGE_JSON);
374375

375376
if (this.fs.exists(pathToPackageJson)) {
376-
const content = this.fs.readJson<INativeScriptProjectPackageJson>(pathToPackageJson);
377-
const scopedRuntime = "@nativescript/android";
378-
const oldRuntime = "tns-android";
379-
if (content) {
380-
if (content.devDependencies && content.devDependencies[scopedRuntime]) {
381-
runtimeVersion = content.devDependencies[scopedRuntime];
382-
} else if (content.nativescript && content.nativescript[oldRuntime] && content.nativescript[oldRuntime].version) {
383-
runtimeVersion = content && content.nativescript && content.nativescript[oldRuntime] && content.nativescript[oldRuntime].version;
384-
}
385-
}
386-
377+
const content = this.fs.readJson<INativeScriptProjectPackageJson>(pathToPackageJson);
378+
const scopedRuntime = "@nativescript/android";
379+
const oldRuntime = "tns-android";
380+
if (content) {
381+
if (content.devDependencies && content.devDependencies[scopedRuntime]) {
382+
runtimePackage = scopedRuntime;
383+
runtimeVersion = content.devDependencies[scopedRuntime];
384+
} else if (content.nativescript && content.nativescript[oldRuntime] && content.nativescript[oldRuntime].version) {
385+
runtimePackage = oldRuntime;
386+
runtimeVersion = content && content.nativescript && content.nativescript[oldRuntime] && content.nativescript[oldRuntime].version;
387+
}
388+
}
389+
390+
}
391+
}
392+
393+
if (runtimeVersion && runtimeVersion.includes('tgz')) {
394+
try {
395+
runtimeVersion = require(`${runtimePackage}/package.json`).version;
396+
} catch (err) {
397+
runtimeVersion = null;
387398
}
388399
}
389400

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/doctor",
3-
"version": "2.0.1",
3+
"version": "2.0.3",
44
"description": "Library that helps identifying if the environment can be used for development of {N} apps.",
55
"main": "lib/index.js",
66
"types": "./typings/nativescript-doctor.d.ts",

0 commit comments

Comments
 (0)