Skip to content

Commit 617d769

Browse files
committed
Get sysInfos based on specified platform
Related to this PR NativeScript/nativescript-doctor#30
1 parent 62eeb66 commit 617d769

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

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+
7775
this.printInfosCore(infos);
7876

7977
const warnings = this.filterInfosByType(infos, constants.WARNING_TYPE_NAME);
@@ -145,10 +143,6 @@ class DoctorService implements IDoctorService {
145143
});
146144
}
147145

148-
private filterInfosByPlatform(infos: NativeScriptDoctor.IInfo[], platform: string): NativeScriptDoctor.IInfo[] {
149-
return infos.filter(info => _.includes(info.platforms, platform));
150-
}
151-
152146
private filterInfosByType(infos: NativeScriptDoctor.IInfo[], type: string): NativeScriptDoctor.IInfo[] {
153147
return infos.filter(info => info.type === type);
154148
}

0 commit comments

Comments
 (0)