-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathinterfaces.ts
578 lines (515 loc) · 16.5 KB
/
interfaces.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
declare module NativeScriptDoctor {
/**
* Describes methods which helps collecting system information.
*/
interface ISysInfo {
/**
* Returns the currently installed Java compiler version.
* @return {Promise<string>} The currently installed Java compiler version.
*/
getJavaCompilerVersion(): Promise<string>;
/**
* Returns the currently installed Java version.
* @return {Promise<string>} The currently installed Java version.
*/
getJavaVersion(): Promise<string>;
/**
* Returns the currently installed Java path based on JAVA_HOME and PATH..
* @return {Promise<string>} The currently installed Java path.
*/
getJavaPath(): Promise<string>;
/**
* Gets JAVA version based on the executable in PATH.
* @return {Promise<string>}
*/
getJavaVersionFromPath(): Promise<string>;
/**
* Gets JAVA version based on the JAVA from JAVA_HOME.
* @return {Promise<string>}
*/
getJavaVersionFromJavaHome(): Promise<string>;
/**
* Returns the currently installed version of Xcode.
* @return {Promise<string>} Returns the currently installed version of Xcode or null if Xcode is not installed or executed on Linux or Windows.
*/
getXcodeVersion(): Promise<string>;
/**
* Returns the currently installed Node.js version.
* @return {Promise<string>} Returns the currently installed Node.js version.
*/
getNodeVersion(): Promise<string>;
/**
* Returns the currently installed Npm version.
* @return {Promise<string>} Returns the currently installed npm version.
*/
getNpmVersion(): Promise<string>;
/**
* Returns the currently installed node-gyp version.
* @return {Promise<string>} Returns the currently installed node-gyp version. If node-gyp is not installed it will return null.
*/
getNodeGypVersion(): Promise<string>;
/**
* Returns the xcodeproj location.
* @return {Promise<string>} Returns the xcodeproj location. If the the xcodeproj is not installed it will return null.
*/
getXcodeprojLocation(): Promise<string>;
/**
* Checks if iTunes is installed.
* @return {Promise<string>} Returns true if iTunes is installed.
*/
isITunesInstalled(): Promise<boolean>;
/**
* Returns the currently installed Cocoapods version.
* @return {Promise<string>} Returns the currently installed Cocoapods version. It will return null if Cocoapods is not installed.
*/
getCocoaPodsVersion(): Promise<string>;
/**
* Returns the os name.
* @return {Promise<string>} Returns the os name.
*/
getOs(): Promise<string>;
/**
* Returns the currently installed ADB version.
* @param {string} pathToAdb Defines path to adb
* @return {Promise<string>} Returns the currently installed ADB version. It will return null if ADB is not installed.
*/
getAdbVersion(pathToAdb?: string): Promise<string>;
/**
* Checks if Android is installed.
* @return {Promise<boolean>} Returns true if Android is installed.
*/
isAndroidInstalled(): Promise<boolean>;
/**
* Returns the currently installed Mono version.
* @return {Promise<string>} Returns the currently installed Mono version. It will return null if Mono is not installed.
*/
getMonoVersion(): Promise<string>;
/**
* Returns the currently installed Git version.
* @return {Promise<string>} Returns the currently installed Git version. It will return null if Git is not installed.
*/
getGitVersion(): Promise<string>;
/**
* Returns the path to the currently installed Git.
* @return {Promise<string>} Returns the path to the currently installed Git. It will return null if Git is not installed.
*/
getGitPath(): Promise<string>;
/**
* Returns the currently installed Gradle version.
* @return {Promise<string>} Returns the currently installed Gradle version. It will return null if Gradle is not installed.
*/
getGradleVersion(): Promise<string>;
/**
* Checks if CocoaPods is working correctly by trying to install one pod.
* @return {Promise<boolean>} Returns true if CocoaPods is working correctly.
*/
isCocoaPodsWorkingCorrectly(): Promise<boolean>;
/**
* Returns the version of the globally installed NativeScript CLI.
* @return {Promise<string>} Returns the version of the globally installed NativeScript CLI.
*/
getNativeScriptCliVersion(): Promise<string>;
/**
* Checks if xcproj is required to build projects and if it is installed.
* @return {Promise<IXcprojInfo>} Returns the collected information aboud xcproj.
*/
getXcprojInfo(): Promise<IXcprojInfo>;
/**
* Checks if the current version of CocoaPods is compatible with the installed Xcode.
* @return {Promise<boolean>} true if an update us require.
*/
isCocoaPodsUpdateRequired(): Promise<boolean>;
/**
* Checks if the Android SDK Tools are installed and configured correctly.
* @return {Promise<boolean>} true if the Android SDK Tools are installed and configured correctly.
*/
isAndroidSdkConfiguredCorrectly(): Promise<boolean>;
/**
* Returns the whole system information.
* @param {ISysInfoConfig} config
* @return {Promise<ISysInfoData>} The system information.
*/
getSysInfo(config?: ISysInfoConfig): Promise<ISysInfoData>;
/**
* If set to true each method will cache it's result. The default value is true.
* @param {boolean} shouldCache The cache switch.
* @return {void}
*/
setShouldCacheSysInfo(shouldCache: boolean): void;
}
interface ISysInfoConfig {
/**
* The platform for which to check if environment is properly configured.
*/
platform?: string;
/**
* Path to package.json file of NativeScript CLI
* @type {string}
*/
pathToNativeScriptCliPackageJson?: string;
/**
* Android tools data
* @type {{pathToAdb: string}}
*/
androidToolsInfo?: {
/**
* Path to adb
* @type {string}
*/
pathToAdb: string;
};
/**
* The project directory. Used to determine the Android Runtime version and validate the Java compiler version against it.
* If it is not passed or the project does not have Android runtime, this validation is skipped.
*/
projectDir?: string;
/**
* The runtime version against which the validation is executed. In case this parameter is passed, it takes precedence over the projectDir argument.
*/
androidRuntimeVersion?: string;
}
/**
* Describes methods which help identifying if the environment can be used for development of {N} apps.
*/
interface IDoctor {
/**
* Checks if a local build can be executed on the current machine.
* @param {string} platform The platform for which to check if local build is possible.
* @param {string} projectDir @optional The project directory. Used to determine the Android Runtime version and validate the Java compiler version against it.
* If it is not passed or the project does not have Android runtime, this validation is skipped.
* @param {string} runtimeVersion @optional The runtime version against which the validation is executed. In case this parameter is passed, it takes precedence over the projectDir argument.
* @return {Promise<boolean>} true if local build can be executed for the provided platform.
*/
canExecuteLocalBuild(
platform: string,
projectDir?: string,
runtimeVersion?: string
): Promise<boolean>;
/**
* Executes all checks for the current environment and returns the warnings from each check.
* @return {Promise<IWarning[]>} Array of all the warnings from all checks. If there are no warnings will return empty array.
*/
getWarnings(): Promise<IWarning[]>;
/**
* Executes all checks for the current environment and returns the info from each check
* @param {NativeScriptDoctor.ISysInfoConfig}
* @return {Promise<IInfo[]>} Array of all the infos from all checks.
*/
getInfos(config?: NativeScriptDoctor.ISysInfoConfig): Promise<IInfo[]>;
}
interface ICommonSysInfoData {
/**
* Os platform flavour, reported by os.platform.
* @type {string}
*/
platform: string;
/**
* Full os name, like `uname -a` on unix, registry query on win.
* @type {string}
*/
os: string;
/**
* The command shell in use, usually bash or cmd.
* @type {string}
*/
shell: string;
/**
* node.js version, returned by node -v.
* @type {string}
*/
nodeVer: string;
/**
* npm version, returned by `npm -v`.
* @type {string}
*/
npmVer: string;
/**
* Process architecture, returned by `process.arch`.
* @type {string}
*/
procArch: string;
/**
* node-gyp version as returned by `node-gyp -v`.
* @type {string}
*/
nodeGypVer: string;
/**
* git version string, as returned by `git --version`.
* @type {string}
*/
gitVer: string;
/**
* NativeScript CLI version string, as returned by `tns --version`.
* @type {string}
*/
nativeScriptCliVersion: string;
}
interface IiOSSysInfoData {
/**
* Xcode version string as returned by `xcodebuild -version`. Valid only on Mac.
* @type {string}
*/
xcodeVer: string;
/**
* Whether iTunes is installed on the machine.
* @type {boolean}
*/
itunesInstalled: boolean;
/**
* pod version string, as returned by `pod --version`.
* @type {string}
*/
cocoaPodsVer: string;
/**
* xcodeproj location, as returned by `which xcodeproj`.
* @type {string}
*/
xcodeprojLocation: string;
/**
* true id CocoaPods can successfully execute pod install.
* @type {boolean}
*/
isCocoaPodsWorkingCorrectly: boolean;
/**
* Information about xcproj.
* @type {string}
*/
xcprojInfo: IXcprojInfo;
/**
* true if the system requires xcproj to build projects successfully and the CocoaPods version is not compatible with the Xcode.
* @type {boolean}
*/
isCocoaPodsUpdateRequired: boolean;
/**
* Information about python installation
*/
pythonInfo: IPythonInfo;
}
interface IAndroidSysInfoData {
/**
* Version string of adb, as returned by `adb version`.
* @type {string}
*/
adbVer: string;
/**
* Whether `android` executable can be run.
* @type {boolean}
*/
androidInstalled: boolean;
/**
* mono version, relevant on Mac only.
* @type {string}
*/
monoVer: string;
/**
* gradle version string as returned by `gradle -v`.
* @type {string}
*/
gradleVer: string;
/**
* javac version string as returned by `javac -version`.
* @type {string}
*/
javacVersion: string;
/**
* java version string as returned by `java -version`.
* @type {string}
*/
javaVersion: string;
/**
* java path based on JAVA_HOME and PATH.
* @type {string}
*/
javaPath: string;
/**
* true if the Android SDK Tools are installed and configured correctly.
* @type {boolean}
*/
isAndroidSdkConfiguredCorrectly: boolean;
/**
* .net version, applicable to windows only.
* @type {string}
*/
dotNetVer?: string;
}
interface ISysInfoData
extends ICommonSysInfoData,
IiOSSysInfoData,
IAndroidSysInfoData {}
/**
* Describes warning returned from @nativescript/doctor check.
*/
interface IWarning {
/**
* The warning.
* @type {string}
*/
warning: string;
/**
* Additional information for the warning.
* @type {string}
*/
additionalInformation: string;
/**
* The platforms which are affected by this warning.
* @type {string[]}
*/
platforms: string[];
}
interface IInfo {
/**
* The message.
* @type {string}
*/
message: string;
/**
* Additional information for the warning.
* @type {string}
*/
additionalInformation?: string;
/**
* The platforms which are affected by this warning.
* @type {string[]}
*/
platforms: string[];
/**
* The warning.
* @type {string} // can be warning, note or info
*/
type: string;
}
/**
* Describes information about xcproj brew formula.
*/
interface IXcprojInfo {
/**
* Determines whether the system needs xcproj to execute ios builds sucessfully.
*/
shouldUseXcproj: boolean;
/**
* Determines whether xcproj can be called from the command line.
*/
xcprojAvailable: boolean;
}
/**
* Describes information about python
*/
interface IPythonInfo {
/**
* Determines whether python is installed on the host machine
*/
isInstalled: boolean;
/**
* Determines whether python six package is installed
*/
isSixPackageInstalled: boolean;
/**
* Error message from installation check
*/
installationErrorMessage?: string;
}
/**
* Describes the constants used in the module.
*/
interface IConstants {
ANDROID_PLATFORM_NAME: string;
IOS_PLATFORM_NAME: string;
SUPPORTED_PLATFORMS: string[];
INFO_TYPE_NAME: string;
WARNING_TYPE_NAME: string;
}
/**
* Describes methods for getting and validating Android tools.
*/
interface IAndroidToolsInfo {
ANDROID_TARGET_PREFIX: string;
androidHome: string;
/**
* Returns the Android tools info.
* @return {NativeScriptDoctor.IAndroidToolsInfoData} returns the Android tools info.
*/
getToolsInfo(config: IProjectDir): NativeScriptDoctor.IAndroidToolsInfoData;
/**
* Checks if the Android tools are valid.
* @return {NativeScriptDoctor.IWarning[]} An array of errors from the validation checks. If there are no errors will return [].
*/
validateInfo(config: IProjectDir): NativeScriptDoctor.IWarning[];
/**
* Checks if the current javac version is valid.
* @param {string} installedJavaVersion The version of javac to check.
* @param {string} projectDir @optional The project directory. Used to determine the Android Runtime version and validate the Java compiler version against it.
* If it is not passed or the project does not have Android runtime, this validation is skipped.
* @param {string} runtimeVersion @optional The runtime version against which the validation is executed. In case this parameter is passed, it takes precedence over the projectDir argument.
* @return {NativeScriptDoctor.IWarning[]} An array of errors from the validation checks. If there are no errors will return [].
*/
validateJavacVersion(
installedJavaVersion: string,
projectDir?: string,
runtimeVersion?: string
): NativeScriptDoctor.IWarning[];
/**
* Returns the path to the adb which is located in ANDROID_HOME or ANDROID_SDK_ROOT.
* @return {Promise<string>} Path to the adb which is located in ANDROID_HOME or ANDROID_SDK_ROOT.
*/
getPathToAdbFromAndroidHome(): Promise<string>;
/**
* Checks if the ANDROID_HOME variable is set to the correct folder.
* @return {NativeScriptDoctor.IWarning[]} An array of errors from the validation checks. If there are no errors will return [].
*/
validateAndroidHomeEnvVariable(): NativeScriptDoctor.IWarning[];
/**
* Validates if the provided targetSdk is greater that the minimum supported target SDK.
* @param {ITargetValidationOptions} options The targetSdk to be validated and the project directory - used to determine the Android Runtime version.
* @return {NativeScriptDoctor.IWarning[]} An array of errors from the validation checks. If there are no errors will return [].
*/
validateMinSupportedTargetSdk(
options: ITargetValidationOptions
): NativeScriptDoctor.IWarning[];
/**
* Validates if the provided targetSdk is lower that the maximum supported target SDK.
* @param {ITargetValidationOptions} options The targetSdk to be validated and the project directory - used to determine the Android Runtime version.
* @return {NativeScriptDoctor.IWarning[]} An array of errors from the validation checks. If there are no errors will return [].
*/
validataMaxSupportedTargetSdk(
options: ITargetValidationOptions
): NativeScriptDoctor.IWarning[];
/**
* Returns the path to the emulator executable.
* @return {string} The path to the emulator executable.
*/
getPathToEmulatorExecutable(): string;
}
/**
* The targetSdk to be validated.
*/
interface ITargetValidationOptions extends Partial<IProjectDir> {
targetSdk: number;
}
/**
* Describes information about installed Android tools and SDKs.
*/
interface IAndroidToolsInfoData {
/**
* The value of ANDROID_HOME environment variable.
*/
androidHomeEnvVar: string;
/**
* The latest installed version of Android Build Tools that satisfies CLI's requirements.
*/
buildToolsVersion: string;
/**
* The latest installed version of Android SDK that satisfies CLI's requirements.
*/
compileSdkVersion: number;
/**
* A list of the installed Android SDKs.
*/
installedTargets: string[];
}
/**
* Object with a single property - projectDir. This is the root directory where NativeScript project is located.
*/
interface IProjectDir {
projectDir: string;
}
}