Skip to content

Commit 010cd27

Browse files
Add constants to the public API
1 parent eb07ac1 commit 010cd27

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

lib/index.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@ import { Helpers } from "./helpers";
77
import { Doctor } from "./doctor";
88
import { AndroidLocalBuildRequirements } from "./local-build-requirements/android-local-build-requirements";
99
import { IosLocalBuildRequirements } from "./local-build-requirements/ios-local-build-requirements";
10+
import { Constants as constants } from "./constants";
1011

1112
const childProcess = new ChildProcess();
12-
const winreg = new WinReg();
13-
const hostInfo = new HostInfo(winreg);
13+
const winReg = new WinReg();
14+
const hostInfo = new HostInfo(winReg);
1415
const fileSystem = new FileSystem();
1516
const helpers = new Helpers();
16-
const sysInfo = new SysInfo(childProcess, fileSystem, helpers, hostInfo, winreg);
17+
const sysInfo = new SysInfo(childProcess, fileSystem, helpers, hostInfo, winReg);
1718

1819
const androidLocalBuildRequirements = new AndroidLocalBuildRequirements(sysInfo);
1920
const iOSLocalBuildRequirements = new IosLocalBuildRequirements(sysInfo, hostInfo);
2021
const doctor = new Doctor(androidLocalBuildRequirements, helpers, hostInfo, iOSLocalBuildRequirements, sysInfo);
2122

2223
export {
2324
sysInfo,
24-
doctor
25+
doctor,
26+
constants
2527
};

lib/sys-info.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class SysInfo {
4343
private fileSystem: FileSystem,
4444
private helpers: Helpers,
4545
private hostInfo: HostInfo,
46-
private winreg: WinReg) { }
46+
private winReg: WinReg) { }
4747

4848
public async getJavaVersion(): Promise<string> {
4949
if (!this.javaVerCache) {
@@ -324,12 +324,12 @@ export class SysInfo {
324324
let productName: string;
325325
let currentVersion: string;
326326
let currentBuild: string;
327-
const hive = this.winreg.registryKeys.HKLM;
327+
const hive = this.winReg.registryKeys.HKLM;
328328
const key = "\\Software\\Microsoft\\Windows NT\\CurrentVersion";
329329

330-
productName = await this.winreg.getRegistryValue("ProductName", hive, key);
331-
currentVersion = await this.winreg.getRegistryValue("CurrentVersion", hive, key);
332-
currentBuild = await this.winreg.getRegistryValue("CurrentBuild", hive, key);
330+
productName = await this.winReg.getRegistryValue("ProductName", hive, key);
331+
currentVersion = await this.winReg.getRegistryValue("CurrentVersion", hive, key);
332+
currentBuild = await this.winReg.getRegistryValue("CurrentBuild", hive, key);
333333

334334
return `${productName} ${currentVersion}.${currentBuild}`;
335335
}

typings/interfaces.ts

+9
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,13 @@ declare module NativeScriptDoctor {
264264
/** Additional information for the warning. */
265265
additionalInformation: string;
266266
}
267+
268+
/**
269+
* Describes the constants used in the module.
270+
*/
271+
interface IConstants {
272+
ANDROID_PLATFORM_NAME: string;
273+
IOS_PLATFORM_NAME: string;
274+
SUPPORTED_PLATFORMS: string[];
275+
}
267276
}

typings/nativescript-doctor.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
declare module "nativescript-doctor" {
55
export const doctor: NativeScriptDoctor.IDoctor;
66
export const sysInfo: NativeScriptDoctor.ISysInfo;
7+
export const constants: NativeScriptDoctor.IConstants;
78
}

0 commit comments

Comments
 (0)