Skip to content

Commit 147c0c2

Browse files
Fatmerosen-vladimirov
authored andcommitted
Get sysInfos based on specified platform
Related to this PR NativeScript/nativescript-doctor#30
1 parent 5c884a3 commit 147c0c2

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

Diff for: lib/services/doctor-service.ts

+5-11
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class DoctorService implements IDoctorService {
2020
private $terminalSpinnerService: ITerminalSpinnerService,
2121
private $versionsService: IVersionsService) { }
2222

23-
public async printWarnings(configOptions?: { trackResult: boolean }): Promise<boolean> {
23+
public async printWarnings(configOptions?: { trackResult: boolean }): Promise<void> {
2424
const infos = await this.$terminalSpinnerService.execute<NativeScriptDoctor.IInfo[]>({
2525
text: `Getting environment information ${EOL}`
2626
}, () => doctor.getInfos());
@@ -42,15 +42,15 @@ class DoctorService implements IDoctorService {
4242
if (hasWarnings) {
4343
this.$logger.info("There seem to be issues with your configuration.");
4444
await this.promptForHelp();
45+
} else {
46+
this.$logger.out("No issues were detected.".bold);
4547
}
4648

4749
try {
4850
await this.$versionsService.checkComponentsForUpdate();
4951
} catch (err) {
5052
this.$logger.error("Cannot get the latest versions information from npm. Please try again later.");
5153
}
52-
53-
return hasWarnings;
5454
}
5555

5656
public runSetupScript(): Promise<ISpawnResult> {
@@ -70,10 +70,8 @@ class DoctorService implements IDoctorService {
7070
}
7171

7272
public async canExecuteLocalBuild(platform?: string): Promise<boolean> {
73-
let infos = await doctor.getInfos();
74-
if (platform) {
75-
infos = this.filterInfosByPlatform(infos, platform);
76-
}
73+
const infos = await doctor.getInfos({ platform });
74+
this.printInfosCore(infos);
7775

7876
const warnings = this.filterInfosByType(infos, constants.WARNING_TYPE_NAME);
7977
if (warnings.length > 0) {
@@ -149,10 +147,6 @@ class DoctorService implements IDoctorService {
149147
});
150148
}
151149

152-
private filterInfosByPlatform(infos: NativeScriptDoctor.IInfo[], platform: string): NativeScriptDoctor.IInfo[] {
153-
return infos.filter(info => _.includes(info.platforms, platform));
154-
}
155-
156150
private filterInfosByType(infos: NativeScriptDoctor.IInfo[], type: string): NativeScriptDoctor.IInfo[] {
157151
return infos.filter(info => info.type === type);
158152
}

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"minimatch": "3.0.2",
5757
"mkdirp": "0.5.1",
5858
"mute-stream": "0.0.5",
59-
"nativescript-doctor": "0.10.0",
59+
"nativescript-doctor": "0.11.0",
6060
"open": "0.0.5",
6161
"ora": "2.0.0",
6262
"osenv": "0.1.3",

0 commit comments

Comments
 (0)