Skip to content

Commit 6b88f4c

Browse files
NathanWalkerrigor789
authored andcommitted
feat: nativescript 7 support
1 parent 385e3ef commit 6b88f4c

File tree

7 files changed

+33
-16
lines changed

7 files changed

+33
-16
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# nativescript-doctor
1+
# @nativescript/doctor
22
Library that helps identifying if the environment can be used for development of {N} apps.
33

44
# Installation
55
1. Using npm
66
```bash
7-
$ npm install nativescript-doctor --save
7+
$ npm install @nativescript/doctor --save
88
```
99

1010
# Requirements
@@ -14,7 +14,7 @@ Library that helps identifying if the environment can be used for development of
1414
* Module `doctor`:
1515
- Usage:
1616
```TypeScript
17-
import { doctor } from "nativescript-doctor"
17+
import { doctor } from "@nativescript/doctor"
1818

1919
async function main() {
2020
const canExecuteLocalBuildForAndroid = await doctor.canExecuteLocalBuild("Android");
@@ -47,7 +47,7 @@ Library that helps identifying if the environment can be used for development of
4747
}
4848

4949
/**
50-
* Describes warning returned from nativescript-doctor check.
50+
* Describes warning returned from @nativescript/doctor check.
5151
*/
5252
interface IWarning {
5353
/**
@@ -73,7 +73,7 @@ Library that helps identifying if the environment can be used for development of
7373
* Module `sysInfo`:
7474
- Usage:
7575
```TypeScript
76-
import { sysInfo, setShouldCacheSysInfo } from "nativescript-doctor";
76+
import { sysInfo, setShouldCacheSysInfo } from "@nativescript/doctor";
7777

7878
async function main() {
7979
// The default value is true. If set to false the result of each check for each element
@@ -451,7 +451,7 @@ Library that helps identifying if the environment can be used for development of
451451
* Module `androidToolsInfo`:
452452
- Usage:
453453
```TypeScript
454-
import { androidToolsInfo } from "nativescript-doctor"
454+
import { androidToolsInfo } from "@nativescript/doctor"
455455

456456
function main() {
457457
const projectDir = "/Users/username/myProject";
@@ -542,7 +542,7 @@ Library that helps identifying if the environment can be used for development of
542542
* Module `constants`:
543543
- Usage:
544544
```TypeScript
545-
import { constants } from "nativescript-doctor"
545+
import { constants } from "@nativescript/doctor"
546546

547547
function main() {
548548
for(let constantName in constants) {

lib/android-tools-info.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,17 @@ export class AndroidToolsInfo implements NativeScriptDoctor.IAndroidToolsInfo {
373373
const pathToPackageJson = path.join(projectDir, Constants.PACKAGE_JSON);
374374

375375
if (this.fs.exists(pathToPackageJson)) {
376-
const content = this.fs.readJson<INativeScriptProjectPackageJson>(pathToPackageJson);
377-
runtimeVersion = content && content.nativescript && content.nativescript["tns-android"] && content.nativescript["tns-android"].version;
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+
378387
}
379388
}
380389

lib/declarations.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,7 @@ interface INativeScriptNode {
7777
}
7878

7979
interface INativeScriptProjectPackageJson {
80-
nativescript: INativeScriptNode;
80+
nativescript: INativeScriptNode;
81+
dependencies?: any;
82+
devDependencies?: any;
8183
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "nativescript-doctor",
3-
"version": "1.14.2",
2+
"name": "@nativescript/doctor",
3+
"version": "2.0.1",
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",

test/android-tools-info.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ describe("androidToolsInfo", () => {
3333
"tns-android": {
3434
version: runtimeVersion
3535
}
36-
}
36+
},
37+
devDependencies: {
38+
"@nativescript/android": runtimeVersion
39+
}
3740
} : null;
3841
},
3942
readDirectory: (path: string) => {
@@ -231,7 +234,10 @@ describe("androidToolsInfo", () => {
231234
"tns-android": {
232235
version: runtimeVersion
233236
}
234-
}
237+
},
238+
devDependencies: {
239+
"@nativescript/android": runtimeVersion
240+
}
235241
})
236242
};
237243

typings/interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ declare module NativeScriptDoctor {
366366
interface ISysInfoData extends ICommonSysInfoData, IiOSSysInfoData, IAndroidSysInfoData { }
367367

368368
/**
369-
* Describes warning returned from nativescript-doctor check.
369+
* Describes warning returned from @nativescript/doctor check.
370370
*/
371371
interface IWarning {
372372
/**

typings/nativescript-doctor.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// <reference path="./interfaces.ts" />
22

33

4-
declare module "nativescript-doctor" {
4+
declare module "@nativescript/doctor" {
55
export const doctor: NativeScriptDoctor.IDoctor;
66
export const sysInfo: NativeScriptDoctor.ISysInfo;
77
export const constants: NativeScriptDoctor.IConstants;

0 commit comments

Comments
 (0)