Skip to content

Get sysInfos based on specified platform #3455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/common
16 changes: 5 additions & 11 deletions lib/services/doctor-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DoctorService implements IDoctorService {
private $terminalSpinnerService: ITerminalSpinnerService,
private $versionsService: IVersionsService) { }

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will we print this on each tns build ... when there are no issues?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. This will be printed only on doctor command

}

try {
await this.$versionsService.checkComponentsForUpdate();
} catch (err) {
this.$logger.error("Cannot get the latest versions information from npm. Please try again later.");
}

return hasWarnings;
}

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

public async canExecuteLocalBuild(platform?: string): Promise<boolean> {
let infos = await doctor.getInfos();
if (platform) {
infos = this.filterInfosByPlatform(infos, platform);
}
const infos = await doctor.getInfos({ platform });
this.printInfosCore(infos);

const warnings = this.filterInfosByType(infos, constants.WARNING_TYPE_NAME);
if (warnings.length > 0) {
Expand Down Expand Up @@ -149,10 +147,6 @@ class DoctorService implements IDoctorService {
});
}

private filterInfosByPlatform(infos: NativeScriptDoctor.IInfo[], platform: string): NativeScriptDoctor.IInfo[] {
return infos.filter(info => _.includes(info.platforms, platform));
}

private filterInfosByType(infos: NativeScriptDoctor.IInfo[], type: string): NativeScriptDoctor.IInfo[] {
return infos.filter(info => info.type === type);
}
Expand Down
9 changes: 4 additions & 5 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"minimatch": "3.0.2",
"mkdirp": "0.5.1",
"mute-stream": "0.0.5",
"nativescript-doctor": "0.10.0",
"nativescript-doctor": "0.11.0",
"open": "0.0.5",
"ora": "2.0.0",
"osenv": "0.1.3",
Expand Down