appium-xcode 6.0.2 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [6.1.0](https://github.com/appium/appium-xcode/compare/v6.0.2...v6.1.0) (2025-10-14)
2
+
3
+ ### Features
4
+
5
+ * Port to typescript ([#156](https://github.com/appium/appium-xcode/issues/156)) ([c17d76b](https://github.com/appium/appium-xcode/commit/c17d76b199c91bf4009bfefc27e6e1098f526386))
6
+
1
7
  ## [6.0.2](https://github.com/appium/appium-xcode/compare/v6.0.1...v6.0.2) (2025-10-09)
2
8
 
3
9
  ### Bug Fixes
@@ -1,25 +1,26 @@
1
+ import type { TeenProcessExecResult } from 'teen_process';
2
+ export declare const XCRUN_TIMEOUT = 15000;
1
3
  /**
2
4
  * Executes 'xcrun' command line utility
3
5
  *
4
- * @param {string[]} args xcrun arguments
5
- * @param {number} timeout [15000] The maximum number of milliseconds to wait until xcrun exists
6
- * @returns {Promise<import("teen_process").TeenProcessExecResult>} The result of xcrun execution
6
+ * @param args xcrun arguments
7
+ * @param timeout The maximum number of milliseconds to wait until xcrun exists
8
+ * @returns The result of xcrun execution
7
9
  * @throws {Error} If xcrun returned non-zero exit code or timed out
8
10
  */
9
- export function runXcrunCommand(args: string[], timeout?: number): Promise<import("teen_process").TeenProcessExecResult<any>>;
11
+ export declare function runXcrunCommand(args: string[], timeout?: number): Promise<TeenProcessExecResult<string>>;
10
12
  /**
11
13
  * Uses macOS Spotlight service to detect where the given app is installed
12
14
  *
13
- * @param {string} bundleId Bundle identifier of the target app
14
- * @returns {Promise<string[]>} Full paths to where the app with the given bundle id is present.
15
+ * @param bundleId Bundle identifier of the target app
16
+ * @returns Full paths to where the app with the given bundle id is present.
15
17
  */
16
- export function findAppPaths(bundleId: string): Promise<string[]>;
18
+ export declare function findAppPaths(bundleId: string): Promise<string[]>;
17
19
  /**
18
20
  * Finds and retrieves the content of the Xcode's Info.plist file
19
21
  *
20
- * @param {string} developerRoot Full path to the Contents/Developer folder under Xcode.app root
21
- * @returns {Promise<object>} All plist entries as an object or an empty object if no plist was found
22
+ * @param developerRoot Full path to the Contents/Developer folder under Xcode.app root
23
+ * @returns All plist entries as an object or an empty object if no plist was found
22
24
  */
23
- export function readXcodePlist(developerRoot: string): Promise<object>;
24
- export const XCRUN_TIMEOUT: 15000;
25
+ export declare function readXcodePlist(developerRoot: string): Promise<Record<string, any>>;
25
26
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../lib/helpers.js"],"names":[],"mappings":"AAQA;;;;;;;GAOG;AACH,sCALW,MAAM,EAAE,YACR,MAAM,GACJ,OAAO,CAAC,iDAA4C,CAAC,CAcjE;AAED;;;;;GAKG;AACH,uCAHW,MAAM,GACJ,OAAO,CAAC,MAAM,EAAE,CAAC,CAyB7B;AAED;;;;;GAKG;AACH,8CAHW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAO3B;AAjED,4BAA6B,KAAK,CAAC"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../lib/helpers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAI1D,eAAO,MAAM,aAAa,QAAQ,CAAC;AAEnC;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAW7H;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAuBtE;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAKxF"}
@@ -11,14 +11,14 @@ const lodash_1 = __importDefault(require("lodash"));
11
11
  const bluebird_1 = __importDefault(require("bluebird"));
12
12
  const teen_process_1 = require("teen_process");
13
13
  const support_1 = require("@appium/support");
14
- const path_1 = __importDefault(require("path"));
14
+ const node_path_1 = __importDefault(require("node:path"));
15
15
  exports.XCRUN_TIMEOUT = 15000;
16
16
  /**
17
17
  * Executes 'xcrun' command line utility
18
18
  *
19
- * @param {string[]} args xcrun arguments
20
- * @param {number} timeout [15000] The maximum number of milliseconds to wait until xcrun exists
21
- * @returns {Promise<import("teen_process").TeenProcessExecResult>} The result of xcrun execution
19
+ * @param args xcrun arguments
20
+ * @param timeout The maximum number of milliseconds to wait until xcrun exists
21
+ * @returns The result of xcrun execution
22
22
  * @throws {Error} If xcrun returned non-zero exit code or timed out
23
23
  */
24
24
  async function runXcrunCommand(args, timeout = exports.XCRUN_TIMEOUT) {
@@ -36,8 +36,8 @@ async function runXcrunCommand(args, timeout = exports.XCRUN_TIMEOUT) {
36
36
  /**
37
37
  * Uses macOS Spotlight service to detect where the given app is installed
38
38
  *
39
- * @param {string} bundleId Bundle identifier of the target app
40
- * @returns {Promise<string[]>} Full paths to where the app with the given bundle id is present.
39
+ * @param bundleId Bundle identifier of the target app
40
+ * @returns Full paths to where the app with the given bundle id is present.
41
41
  */
42
42
  async function findAppPaths(bundleId) {
43
43
  let stdout;
@@ -61,16 +61,16 @@ async function findAppPaths(bundleId) {
61
61
  return p;
62
62
  }
63
63
  })());
64
- return /** @type {string[]} */ (await bluebird_1.default.all(results)).filter(Boolean);
64
+ return (await bluebird_1.default.all(results)).filter(Boolean);
65
65
  }
66
66
  /**
67
67
  * Finds and retrieves the content of the Xcode's Info.plist file
68
68
  *
69
- * @param {string} developerRoot Full path to the Contents/Developer folder under Xcode.app root
70
- * @returns {Promise<object>} All plist entries as an object or an empty object if no plist was found
69
+ * @param developerRoot Full path to the Contents/Developer folder under Xcode.app root
70
+ * @returns All plist entries as an object or an empty object if no plist was found
71
71
  */
72
72
  async function readXcodePlist(developerRoot) {
73
- const plistPath = path_1.default.resolve(developerRoot, '..', 'Info.plist');
73
+ const plistPath = node_path_1.default.resolve(developerRoot, '..', 'Info.plist');
74
74
  return await support_1.fs.exists(plistPath)
75
75
  ? await support_1.plist.parsePlistFile(plistPath)
76
76
  : {};
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../lib/helpers.js"],"names":[],"mappings":";;;;;;AAgBA,0CAWC;AAQD,oCAuBC;AAQD,wCAKC;AAvED,oDAAuB;AACvB,wDAAyB;AACzB,+CAAoC;AACpC,6CAA4C;AAC5C,gDAAwB;AAEX,QAAA,aAAa,GAAG,KAAK,CAAC;AAEnC;;;;;;;GAOG;AACI,KAAK,UAAU,eAAe,CAAE,IAAI,EAAE,OAAO,GAAG,qBAAa;IAClE,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,mBAAI,EAAC,OAAO,EAAE,IAAI,EAAE,EAAC,OAAO,EAAC,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,iDAAiD;QACjD,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YACf,GAAG,CAAC,OAAO,GAAG,GAAG,GAAG,CAAC,OAAO,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC;QAChD,CAAC;QAED,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,YAAY,CAAE,QAAQ;IAC1C,IAAI,MAAM,CAAC;IACX,IAAI,CAAC;QACH,CAAC,EAAC,MAAM,EAAC,GAAG,MAAM,IAAA,mBAAI,EAAC,iBAAiB,EAAE;YACxC,6BAA6B,QAAQ,EAAE;SACxC,CAAC,CAAC,CAAC;IACN,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,YAAY,GAAG,gBAAC,CAAC,IAAI,CAAC,MAAM,CA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AU,cAAc,CAAC,aAAqB;IACxD,MAAM,SAAS,GAAG,mBAAI,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;IAClE,OAAO,MAAM,YAAE,CAAC,MAAM,CAAC,SAAS,CAAC;QAC/B,CAAC,CAAC,MAAM,eAAK,CAAC,cAAc,CAAC,SAAS,CAAC;QACvC,CAAC,CAAC,EAAE,CAAC;AACT,CAAC"}
@@ -1,16 +1,12 @@
1
- export default xcode;
2
- export type XcodeVersion = import("./xcode").XcodeVersion;
3
- import { getPath } from './xcode';
4
- import { getVersion } from './xcode';
5
- import { getMaxIOSSDK } from './xcode';
6
- import { getMaxTVOSSDK } from './xcode';
7
- import { getClangVersion } from './xcode';
8
- declare namespace xcode {
9
- export { getPath };
10
- export { getVersion };
11
- export { getMaxIOSSDK };
12
- export { getMaxTVOSSDK };
13
- export { getClangVersion };
14
- }
1
+ import { getPath, getVersion, getMaxIOSSDK, getMaxTVOSSDK, getClangVersion } from './xcode';
2
+ declare const xcode: {
3
+ getPath: ((timeout?: number) => Promise<string>) & import("lodash").MemoizedFunction;
4
+ getVersion: typeof getVersion;
5
+ getMaxIOSSDK: ((retries?: number, timeout?: number) => Promise<string | null>) & import("lodash").MemoizedFunction;
6
+ getMaxTVOSSDK: ((retries?: number, timeout?: number) => Promise<string>) & import("lodash").MemoizedFunction;
7
+ getClangVersion: typeof getClangVersion;
8
+ };
15
9
  export { getPath, getVersion, getMaxIOSSDK, getMaxTVOSSDK, getClangVersion };
10
+ export default xcode;
11
+ export type { XcodeVersion } from './types';
16
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.js"],"names":[],"mappings":";2BA2Ba,OAAO,SAAS,EAAE,YAAY;wBApBpC,SAAS;2BAAT,SAAS;6BAAT,SAAS;8BAAT,SAAS;gCAAT,SAAS"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,UAAU,EACV,YAAY,EACZ,aAAa,EACb,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,QAAA,MAAM,KAAK;;;;;;CAMV,CAAC;AAEF,OAAO,EACL,OAAO,EACP,UAAU,EACV,YAAY,EACZ,aAAa,EACb,eAAe,EAChB,CAAC;AACF,eAAe,KAAK,CAAC;AAErB,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
@@ -16,7 +16,4 @@ const xcode = {
16
16
  getClangVersion: xcode_1.getClangVersion
17
17
  };
18
18
  exports.default = xcode;
19
- /**
20
- * @typedef {import('./xcode').XcodeVersion} XcodeVersion
21
- */
22
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.js"],"names":[],"mappings":";;;AAAA,iBAAiB;AACjB,mCAMiB;AAWf,wFAhBA,eAAO,OAgBA;AACP,2FAhBA,kBAAU,OAgBA;AACV,6FAhBA,oBAAY,OAgBA;AACZ,8FAhBA,qBAAa,OAgBA;AACb,gGAhBA,uBAAe,OAgBA;AAbjB,MAAM,KAAK,GAAG;IACZ,OAAO,EAAP,eAAO;IACP,UAAU,EAAV,kBAAU;IACV,YAAY,EAAZ,oBAAY;IACZ,aAAa,EAAb,qBAAa;IACb,eAAe,EAAf,uBAAe;CAChB,CAAC;AASF,kBAAe,KAAK,CAAC;AAErB;;GAEG"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":";;;AAAA,iBAAiB;AACjB,mCAMiB;AAWf,wFAhBA,eAAO,OAgBA;AACP,2FAhBA,kBAAU,OAgBA;AACV,6FAhBA,oBAAY,OAgBA;AACZ,8FAhBA,qBAAa,OAgBA;AACb,gGAhBA,uBAAe,OAgBA;AAbjB,MAAM,KAAK,GAAG;IACZ,OAAO,EAAP,eAAO;IACP,UAAU,EAAV,kBAAU;IACV,YAAY,EAAZ,oBAAY;IACZ,aAAa,EAAb,qBAAa;IACb,eAAe,EAAf,uBAAe;CAChB,CAAC;AASF,kBAAe,KAAK,CAAC"}
@@ -0,0 +1,9 @@
1
+ export interface XcodeVersion {
2
+ versionString: string;
3
+ versionFloat: number;
4
+ major: number;
5
+ minor: number;
6
+ patch?: number;
7
+ toString(): string;
8
+ }
9
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../lib/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,IAAI,MAAM,CAAC;CACpB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../lib/types.ts"],"names":[],"mappings":""}
@@ -1,111 +1,81 @@
1
- export type XcodeVersion = {
2
- /**
3
- * Xcode version as a string
4
- */
5
- versionString: string;
6
- /**
7
- * Xcode version as a float number
8
- */
9
- versionFloat: number;
10
- /**
11
- * Major number of Xcode version
12
- */
13
- major: number;
14
- /**
15
- * Minor number of Xcode version
16
- */
17
- minor: number;
18
- /**
19
- * Patch number of Xcode version (if exists)
20
- */
21
- patch?: number | undefined;
22
- /**
23
- * Returns Xcode version as a string
24
- */
25
- toString: () => string;
26
- };
1
+ import _ from 'lodash';
2
+ import type { XcodeVersion } from './types';
3
+ /**
4
+ * Retrieves the full path to Xcode Developer subfolder via xcode-select
5
+ *
6
+ * @param timeout The maximum timeout for xcode-select execution
7
+ * @returns Full path to Xcode Developer subfolder
8
+ * @throws {Error} If it is not possible to retrieve a proper path
9
+ */
10
+ export declare function getPathFromXcodeSelect(timeout?: number): Promise<string>;
11
+ /**
12
+ * Retrieves the full path to Xcode Developer subfolder via `DEVELOPER_DIR` environment variable
13
+ *
14
+ * @returns Full path to Xcode Developer subfolder
15
+ * @throws {Error} If it is not possible to retrieve a proper path
16
+ * @privateRemarks This method assumes `DEVELOPER_DIR` is defined.
17
+ */
18
+ export declare function getPathFromDeveloperDir(): Promise<string>;
27
19
  /**
28
20
  * Retrieves the full path to Xcode Developer subfolder.
29
21
  * If `DEVELOPER_DIR` environment variable is provided then its value has a priority.
30
- * @param {number} timeout The maximum timeout for xcode-select execution
31
- * @returns {Promise<string>} Full path to Xcode Developer subfolder timeout
22
+ * @param timeout The maximum timeout for xcode-select execution
23
+ * @returns Full path to Xcode Developer subfolder timeout
32
24
  * @throws {Error} If there was an error while retrieving the path.
33
25
  */
34
- export const getPath: ((timeout?: number) => Promise<string>) & _.MemoizedFunction;
35
- /**
36
- * @typedef {Object} XcodeVersion
37
- * @property {string} versionString Xcode version as a string
38
- * @property {number} versionFloat Xcode version as a float number
39
- * @property {number} major Major number of Xcode version
40
- * @property {number} minor Minor number of Xcode version
41
- * @property {number} [patch] Patch number of Xcode version (if exists)
42
- * @property {() => string} toString Returns Xcode version as a string
43
- */
26
+ export declare const getPath: ((timeout?: number) => Promise<string>) & _.MemoizedFunction;
44
27
  /**
45
28
  * Retrieves Xcode version
46
29
  *
47
- * @param {boolean} parse [false] Whether to parse the version to a XcodeVersion version
48
- * @param {number} retries [2] How many retries to apply for getting the version number
49
- * @param {number} timeout [15000] Timeout of milliseconds to wait for terminal commands
50
- * @returns {Promise<XcodeVersion | string>} Xcode version depending on the value of `parse` flag
30
+ * @param parse Whether to parse the version to a XcodeVersion version
31
+ * @param retries How many retries to apply for getting the version number
32
+ * @param timeout Timeout of milliseconds to wait for terminal commands
33
+ * @returns Xcode version depending on the value of `parse` flag
51
34
  * @throws {Error} If there was a failure while retrieving the version
52
35
  */
53
- export function getVersion(parse?: boolean, retries?: number, timeout?: number): Promise<XcodeVersion | string>;
36
+ export declare function getVersion(parse: false, retries?: number, timeout?: number): Promise<string>;
37
+ export declare function getVersion(parse: true, retries?: number, timeout?: number): Promise<XcodeVersion>;
54
38
  /**
55
- * Retrieves the maximum version of iOS SDK supported by the installed Xcode
39
+ * Check https://trac.macports.org/wiki/XcodeVersionInfo
40
+ * to see the actual mapping between clang and other components.
56
41
  *
57
- * @param {number} timeout Timeout of milliseconds to wait for terminal commands
58
- * @param {number} retries The maximum number of retries
59
- * @returns {string} The SDK version
60
- * @throws {Error} If the SDK version number cannot be determined
42
+ * @returns The actual Clang version in x.x.x.x or x.x.x format,
43
+ * which is supplied with Command Line Tools. `null` is returned
44
+ * if CLT are not installed.
61
45
  */
62
- export const getMaxIOSSDK: ((retries?: any, timeout?: any) => Promise<string | null>) & _.MemoizedFunction;
46
+ export declare function getClangVersion(): Promise<string | null>;
63
47
  /**
64
48
  * Retrieves the maximum version of iOS SDK supported by the installed Xcode
65
49
  *
66
- * @param {number} timeout [15000] Timeout of milliseconds to wait for terminal commands
67
- * @returns {Promise<string>} The SDK version
50
+ * @param timeout Timeout of milliseconds to wait for terminal commands
51
+ * @returns The SDK version
68
52
  * @throws {Error} If the SDK version number cannot be determined
69
53
  */
70
- export function getMaxIOSSDKWithoutRetry(timeout?: number): Promise<string>;
54
+ export declare function getMaxIOSSDKWithoutRetry(timeout?: number): Promise<string>;
71
55
  /**
72
- * Retrieves the maximum version of tvOS SDK supported by the installed Xcode
56
+ * Retrieves the maximum version of iOS SDK supported by the installed Xcode
73
57
  *
58
+ * @param retries The maximum number of retries
59
+ * @param timeout Timeout of milliseconds to wait for terminal commands
60
+ * @returns The SDK version
74
61
  * @throws {Error} If the SDK version number cannot be determined
75
62
  */
76
- export const getMaxTVOSSDK: ((retries?: number, timeout?: number) => Promise<string>) & _.MemoizedFunction;
63
+ export declare const getMaxIOSSDK: ((retries?: number, timeout?: number) => Promise<string | null>) & _.MemoizedFunction;
77
64
  /**
78
65
  * Retrieves the maximum version of tvOS SDK supported by the installed Xcode
79
66
  *
80
- * @param {number} timeout Timeout of milliseconds to wait for terminal commands
81
- * @returns {Promise<string>} The SDK version
67
+ * @param timeout Timeout of milliseconds to wait for terminal commands
68
+ * @returns The SDK version
82
69
  * @throws {Error} If the SDK version number cannot be determined
83
70
  */
84
- export function getMaxTVOSSDKWithoutRetry(timeout?: number): Promise<string>;
85
- /**
86
- * Check https://trac.macports.org/wiki/XcodeVersionInfo
87
- * to see the actual mapping between clang and other components.
88
- *
89
- * @returns {Promise<string|null>} The actual Clang version in x.x.x.x or x.x.x format,
90
- * which is supplied with Command Line Tools. `null` is returned
91
- * if CLT are not installed.
92
- */
93
- export function getClangVersion(): Promise<string | null>;
94
- /**
95
- * Retrieves the full path to Xcode Developer subfolder via `DEVELOPER_DIR` environment variable
96
- *
97
- * @returns {Promise<string>} Full path to Xcode Developer subfolder
98
- * @throws {Error} If it is not possible to retrieve a proper path
99
- * @privateRemarks This method assumes `DEVELOPER_DIR` is defined.
100
- */
101
- export function getPathFromDeveloperDir(): Promise<string>;
71
+ export declare function getMaxTVOSSDKWithoutRetry(timeout?: number): Promise<string>;
102
72
  /**
103
- * Retrieves the full path to Xcode Developer subfolder via xcode-select
73
+ * Retrieves the maximum version of tvOS SDK supported by the installed Xcode
104
74
  *
105
- * @param {number} timeout The maximum timeout for xcode-select execution
106
- * @returns {Promise<string>} Full path to Xcode Developer subfolder
107
- * @throws {Error} If it is not possible to retrieve a proper path
75
+ * @param timeout Timeout of milliseconds to wait for terminal commands
76
+ * @param retries The maximum number of retries
77
+ * @returns The SDK version
78
+ * @throws {Error} If the SDK version number cannot be determined
108
79
  */
109
- export function getPathFromXcodeSelect(timeout?: number): Promise<string>;
110
- import _ from 'lodash';
80
+ export declare const getMaxTVOSSDK: ((retries?: number, timeout?: number) => Promise<string>) & _.MemoizedFunction;
111
81
  //# sourceMappingURL=xcode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"xcode.d.ts","sourceRoot":"","sources":["../../lib/xcode.js"],"names":[],"mappings":";;;;mBA+Hc,MAAM;;;;kBACN,MAAM;;;;WACN,MAAM;;;;WACN,MAAM;;;;;;;;cAEN,MAAM,MAAM;;AAjD1B;;;;;;GAMG;AACH,kCAEa,MAAM,KACJ,OAAO,CAAC,MAAM,CAAC,uBAE0F;AA8BxH;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AACH,mCANW,OAAO,YACP,MAAM,YACN,MAAM,GACJ,OAAO,CAAC,YAAY,GAAG,MAAM,CAAC,CAsB1C;AA6CD;;;;;;;GAOG;AACH,2GAIE;AA9BF;;;;;;GAMG;AACH,mDAJW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAY3B;AAiCD;;;;GAIG;AACH,wCAGa,MAAM,YADN,MAAM,KAEJ,OAAO,CAAC,MAAM,CAAC,uBAK5B;AA/BF;;;;;;GAMG;AACH,oDAJW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAW3B;AAxED;;;;;;;GAOG;AACH,mCAJa,OAAO,CAAC,MAAM,GAAC,IAAI,CAAC,CAmBhC;AA9HD;;;;;;GAMG;AACH,2CAJa,OAAO,CAAC,MAAM,CAAC,CAgB3B;AAlED;;;;;;GAMG;AACH,iDAJW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAyC3B;cAzDa,QAAQ"}
1
+ {"version":3,"file":"xcode.d.ts","sourceRoot":"","sources":["../../lib/xcode.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAMvB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAO5C;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkC7F;AAED;;;;;;GAMG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC,CAgB/D;AAED;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,cACR,MAAM,KAAmB,OAAO,CAAC,MAAM,CAAC,sBAEnD,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AACpG,wBAAsB,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAsBzG;;;;;;;GAOG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAe9D;AAED;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAS/F;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,cACQ,MAAM,YAAuC,MAAM,iDAGnF,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,yBAAyB,CAAC,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAQhG;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,cACc,MAAM,YAAuC,MAAM,KAAmB,OAAO,CAAC,MAAM,CAAC,sBAG5H,CAAC"}
@@ -37,14 +37,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.getMaxTVOSSDK = exports.getMaxIOSSDK = exports.getPath = void 0;
40
+ exports.getPathFromXcodeSelect = getPathFromXcodeSelect;
41
+ exports.getPathFromDeveloperDir = getPathFromDeveloperDir;
40
42
  exports.getVersion = getVersion;
43
+ exports.getClangVersion = getClangVersion;
41
44
  exports.getMaxIOSSDKWithoutRetry = getMaxIOSSDKWithoutRetry;
42
45
  exports.getMaxTVOSSDKWithoutRetry = getMaxTVOSSDKWithoutRetry;
43
- exports.getClangVersion = getClangVersion;
44
- exports.getPathFromDeveloperDir = getPathFromDeveloperDir;
45
- exports.getPathFromXcodeSelect = getPathFromXcodeSelect;
46
46
  const support_1 = require("@appium/support");
47
- const path_1 = __importDefault(require("path"));
47
+ const node_path_1 = __importDefault(require("node:path"));
48
48
  const asyncbox_1 = require("asyncbox");
49
49
  const lodash_1 = __importDefault(require("lodash"));
50
50
  const teen_process_1 = require("teen_process");
@@ -56,21 +56,17 @@ const log = support_1.logger.getLogger('Xcode');
56
56
  /**
57
57
  * Retrieves the full path to Xcode Developer subfolder via xcode-select
58
58
  *
59
- * @param {number} timeout The maximum timeout for xcode-select execution
60
- * @returns {Promise<string>} Full path to Xcode Developer subfolder
59
+ * @param timeout The maximum timeout for xcode-select execution
60
+ * @returns Full path to Xcode Developer subfolder
61
61
  * @throws {Error} If it is not possible to retrieve a proper path
62
62
  */
63
63
  async function getPathFromXcodeSelect(timeout = helpers_1.XCRUN_TIMEOUT) {
64
- /**
65
- * @param {string} prefix
66
- * @returns {Promise<string>}
67
- */
68
64
  const generateErrorMessage = async (prefix) => {
69
65
  const xcodePaths = await (0, helpers_1.findAppPaths)(XCODE_BUNDLE_ID);
70
66
  if (lodash_1.default.isEmpty(xcodePaths)) {
71
67
  return `${prefix}. Consider installing Xcode to address this issue.`;
72
68
  }
73
- const proposals = xcodePaths.map((p) => ` sudo xcode-select -s "${path_1.default.join(p, 'Contents', 'Developer')}"`);
69
+ const proposals = xcodePaths.map((p) => ` sudo xcode-select -s "${node_path_1.default.join(p, 'Contents', 'Developer')}"`);
74
70
  return `${prefix}. ` +
75
71
  `Consider running${proposals.length > 1 ? ' any of' : ''}:\n${proposals.join('\n')}\nto address this issue.`;
76
72
  };
@@ -100,12 +96,15 @@ async function getPathFromXcodeSelect(timeout = helpers_1.XCRUN_TIMEOUT) {
100
96
  /**
101
97
  * Retrieves the full path to Xcode Developer subfolder via `DEVELOPER_DIR` environment variable
102
98
  *
103
- * @returns {Promise<string>} Full path to Xcode Developer subfolder
99
+ * @returns Full path to Xcode Developer subfolder
104
100
  * @throws {Error} If it is not possible to retrieve a proper path
105
101
  * @privateRemarks This method assumes `DEVELOPER_DIR` is defined.
106
102
  */
107
103
  async function getPathFromDeveloperDir() {
108
- const developerRoot = /** @type {string} */ (process.env.DEVELOPER_DIR);
104
+ const developerRoot = process.env.DEVELOPER_DIR;
105
+ if (!developerRoot) {
106
+ throw new Error('DEVELOPER_DIR environment variable is not set');
107
+ }
109
108
  const { CFBundleIdentifier } = await (0, helpers_1.readXcodePlist)(developerRoot);
110
109
  if (CFBundleIdentifier === XCODE_BUNDLE_ID) {
111
110
  return developerRoot;
@@ -117,61 +116,13 @@ async function getPathFromDeveloperDir() {
117
116
  /**
118
117
  * Retrieves the full path to Xcode Developer subfolder.
119
118
  * If `DEVELOPER_DIR` environment variable is provided then its value has a priority.
120
- * @param {number} timeout The maximum timeout for xcode-select execution
121
- * @returns {Promise<string>} Full path to Xcode Developer subfolder timeout
119
+ * @param timeout The maximum timeout for xcode-select execution
120
+ * @returns Full path to Xcode Developer subfolder timeout
122
121
  * @throws {Error} If there was an error while retrieving the path.
123
122
  */
124
- const getPath = lodash_1.default.memoize(
125
- /**
126
- * @param {number} timeout
127
- * @returns {Promise<string>}
128
- */
129
- (timeout = helpers_1.XCRUN_TIMEOUT) => process.env.DEVELOPER_DIR ? getPathFromDeveloperDir() : getPathFromXcodeSelect(timeout));
130
- exports.getPath = getPath;
131
- /**
132
- * Retrieves Xcode version
133
- *
134
- * @param {number} timeout [15000] Timeout of milliseconds to wait for terminal commands.
135
- * @returns {Promise<import("semver").SemVer | null>} Xcode version
136
- * @throws {Error} If there was a failure while retrieving the version
137
- */
138
- async function getVersionWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
139
- const developerPath = await getPath(timeout);
140
- // we want to read the CFBundleShortVersionString from Xcode's plist.
141
- const { CFBundleShortVersionString } = await (0, helpers_1.readXcodePlist)(developerPath);
142
- return semver.coerce(CFBundleShortVersionString);
143
- }
144
- /**
145
- * Retrieves Xcode version or the cached one if called more than once
146
- *
147
- * @param {number} retries How many retries to apply for version retrieval
148
- * @param {number} timeout Timeout of milliseconds to wait for terminal commands
149
- * @returns {Promise<import("semver").SemVer | null>} Xcode version
150
- * @throws {Error} If there was a failure while retrieving the version
151
- */
152
- const getVersionMemoized = lodash_1.default.memoize(function getVersionMemoized(retries = DEFAULT_NUMBER_OF_RETRIES, timeout = helpers_1.XCRUN_TIMEOUT) {
153
- return (0, asyncbox_1.retry)(retries, getVersionWithoutRetry, timeout);
154
- });
155
- /**
156
- * @typedef {Object} XcodeVersion
157
- * @property {string} versionString Xcode version as a string
158
- * @property {number} versionFloat Xcode version as a float number
159
- * @property {number} major Major number of Xcode version
160
- * @property {number} minor Minor number of Xcode version
161
- * @property {number} [patch] Patch number of Xcode version (if exists)
162
- * @property {() => string} toString Returns Xcode version as a string
163
- */
164
- /**
165
- * Retrieves Xcode version
166
- *
167
- * @param {boolean} parse [false] Whether to parse the version to a XcodeVersion version
168
- * @param {number} retries [2] How many retries to apply for getting the version number
169
- * @param {number} timeout [15000] Timeout of milliseconds to wait for terminal commands
170
- * @returns {Promise<XcodeVersion | string>} Xcode version depending on the value of `parse` flag
171
- * @throws {Error} If there was a failure while retrieving the version
172
- */
123
+ exports.getPath = lodash_1.default.memoize((timeout = helpers_1.XCRUN_TIMEOUT) => process.env.DEVELOPER_DIR ? getPathFromDeveloperDir() : getPathFromXcodeSelect(timeout));
173
124
  async function getVersion(parse = false, retries = DEFAULT_NUMBER_OF_RETRIES, timeout = helpers_1.XCRUN_TIMEOUT) {
174
- const version = /** @type {import('semver').SemVer} */ (await getVersionMemoized(retries, timeout));
125
+ const version = await getVersionMemoized(retries, timeout);
175
126
  // xcode version strings are not exactly semver string: patch versions of 0
176
127
  // are removed (e.g., '10.0.0' => '10.0')
177
128
  const versionString = version.patch > 0 ? version.version : `${version.major}.${version.minor}`;
@@ -193,7 +144,7 @@ async function getVersion(parse = false, retries = DEFAULT_NUMBER_OF_RETRIES, ti
193
144
  * Check https://trac.macports.org/wiki/XcodeVersionInfo
194
145
  * to see the actual mapping between clang and other components.
195
146
  *
196
- * @returns {Promise<string|null>} The actual Clang version in x.x.x.x or x.x.x format,
147
+ * @returns The actual Clang version in x.x.x.x or x.x.x format,
197
148
  * which is supplied with Command Line Tools. `null` is returned
198
149
  * if CLT are not installed.
199
150
  */
@@ -217,8 +168,8 @@ async function getClangVersion() {
217
168
  /**
218
169
  * Retrieves the maximum version of iOS SDK supported by the installed Xcode
219
170
  *
220
- * @param {number} timeout [15000] Timeout of milliseconds to wait for terminal commands
221
- * @returns {Promise<string>} The SDK version
171
+ * @param timeout Timeout of milliseconds to wait for terminal commands
172
+ * @returns The SDK version
222
173
  * @throws {Error} If the SDK version number cannot be determined
223
174
  */
224
175
  async function getMaxIOSSDKWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
@@ -234,20 +185,19 @@ async function getMaxIOSSDKWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
234
185
  /**
235
186
  * Retrieves the maximum version of iOS SDK supported by the installed Xcode
236
187
  *
237
- * @param {number} timeout Timeout of milliseconds to wait for terminal commands
238
- * @param {number} retries The maximum number of retries
239
- * @returns {string} The SDK version
188
+ * @param retries The maximum number of retries
189
+ * @param timeout Timeout of milliseconds to wait for terminal commands
190
+ * @returns The SDK version
240
191
  * @throws {Error} If the SDK version number cannot be determined
241
192
  */
242
- const getMaxIOSSDK = lodash_1.default.memoize(function getMaxIOSSDK(retries = DEFAULT_NUMBER_OF_RETRIES, timeout = helpers_1.XCRUN_TIMEOUT) {
193
+ exports.getMaxIOSSDK = lodash_1.default.memoize(function getMaxIOSSDK(retries = DEFAULT_NUMBER_OF_RETRIES, timeout = helpers_1.XCRUN_TIMEOUT) {
243
194
  return (0, asyncbox_1.retry)(retries, getMaxIOSSDKWithoutRetry, timeout);
244
195
  });
245
- exports.getMaxIOSSDK = getMaxIOSSDK;
246
196
  /**
247
197
  * Retrieves the maximum version of tvOS SDK supported by the installed Xcode
248
198
  *
249
- * @param {number} timeout Timeout of milliseconds to wait for terminal commands
250
- * @returns {Promise<string>} The SDK version
199
+ * @param timeout Timeout of milliseconds to wait for terminal commands
200
+ * @returns The SDK version
251
201
  * @throws {Error} If the SDK version number cannot be determined
252
202
  */
253
203
  async function getMaxTVOSSDKWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
@@ -262,16 +212,37 @@ async function getMaxTVOSSDKWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
262
212
  /**
263
213
  * Retrieves the maximum version of tvOS SDK supported by the installed Xcode
264
214
  *
215
+ * @param timeout Timeout of milliseconds to wait for terminal commands
216
+ * @param retries The maximum number of retries
217
+ * @returns The SDK version
265
218
  * @throws {Error} If the SDK version number cannot be determined
266
219
  */
267
- const getMaxTVOSSDK = lodash_1.default.memoize(
220
+ exports.getMaxTVOSSDK = lodash_1.default.memoize(async function getMaxTVOSSDK(retries = DEFAULT_NUMBER_OF_RETRIES, timeout = helpers_1.XCRUN_TIMEOUT) {
221
+ return await (0, asyncbox_1.retry)(retries, getMaxTVOSSDKWithoutRetry, timeout);
222
+ });
223
+ // Private helper functions
268
224
  /**
269
- * @param {number} timeout Timeout of milliseconds to wait for terminal commands
270
- * @param {number} retries The maximum number of retries
271
- * @returns {Promise<string>} The SDK version
225
+ * Retrieves Xcode version
226
+ *
227
+ * @param timeout Timeout of milliseconds to wait for terminal commands.
228
+ * @returns Xcode version
229
+ * @throws {Error} If there was a failure while retrieving the version
272
230
  */
273
- async function getMaxTVOSSDK(retries = DEFAULT_NUMBER_OF_RETRIES, timeout = helpers_1.XCRUN_TIMEOUT) {
274
- return /** @type {string} */ (await (0, asyncbox_1.retry)(retries, getMaxTVOSSDKWithoutRetry, timeout));
231
+ async function getVersionWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
232
+ const developerPath = await (0, exports.getPath)(timeout);
233
+ // we want to read the CFBundleShortVersionString from Xcode's plist.
234
+ const { CFBundleShortVersionString } = await (0, helpers_1.readXcodePlist)(developerPath);
235
+ return semver.coerce(CFBundleShortVersionString);
236
+ }
237
+ /**
238
+ * Retrieves Xcode version or the cached one if called more than once
239
+ *
240
+ * @param retries How many retries to apply for version retrieval
241
+ * @param timeout Timeout of milliseconds to wait for terminal commands
242
+ * @returns Xcode version
243
+ * @throws {Error} If there was a failure while retrieving the version
244
+ */
245
+ const getVersionMemoized = lodash_1.default.memoize(function getVersionMemoized(retries = DEFAULT_NUMBER_OF_RETRIES, timeout = helpers_1.XCRUN_TIMEOUT) {
246
+ return (0, asyncbox_1.retry)(retries, getVersionWithoutRetry, timeout);
275
247
  });
276
- exports.getMaxTVOSSDK = getMaxTVOSSDK;
277
248
  //# sourceMappingURL=xcode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"xcode.js","sourceRoot":"","sources":["../../lib/xcode.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgQW,gCAAU;AAAgB,4DAAwB;AAC5C,8DAAyB;AAAE,0CAAe;AACzD,0DAAuB;AAAE,wDAAsB;AAlQjD,6CAA6C;AAC7C,gDAAwB;AACxB,uCAAiC;AACjC,oDAAuB;AACvB,+CAAoC;AACpC,+CAAiC;AACjC,uCAEmB;AAEnB,MAAM,yBAAyB,GAAG,CAAC,CAAC;AACpC,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAE7C,MAAM,GAAG,GAAG,gBAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AAEtC;;;;;;GAMG;AACH,KAAK,UAAU,sBAAsB,CAAE,OAAO,GAAG,uBAAa;IAC5D;;;OAGG;IACH,MAAM,oBAAoB,GAAG,KAAK,EAAE,MAAM,EAAE,EAAE;QAC5C,MAAM,UAAU,GAAG,MAAM,IAAA,sBAAY,EAAC,eAAe,CAAC,CAAC;QACvD,IAAI,gBAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE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AAE,yBAAyB,EAAE,OAAO,CAAW,CAAC;AAC5E,CAAC,CACF,CAAC;AAEF,2BAA2B;AAE3B;;;;;;GAMG;AACH,KAAK,UAAU,sBAAsB,CAAC,UAAkB,uBAAa;IACnE,MAAM,aAAa,GAAG,MAAM,IAAA,eAAO,EAAC,OAAO,CAAC,CAAC;IAC7C,qEAAqE;IACrE,MAAM,EAAC,0BAA0B,EAAC,GAAG,MAAM,IAAA,wBAAc,EAAC,aAAa,CAAC,CAAC;IACzE,OAAO,MAAM,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC;AACnD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,kBAAkB,GAAG,gBAAC,CAAC,OAAO,CAClC,SAAS,kBAAkB,CAAC,UAAkB,yBAAyB,EAAE,UAAkB,uBAAa;IACtG,OAAO,IAAA,gBAAK,EAAC,OAAO,EAAE,sBAAsB,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC,CACF,CAAC"}
@@ -1,20 +1,21 @@
1
1
  import _ from 'lodash';
2
2
  import B from 'bluebird';
3
3
  import { exec } from 'teen_process';
4
+ import type { TeenProcessExecResult } from 'teen_process';
4
5
  import { fs, plist } from '@appium/support';
5
- import path from 'path';
6
+ import path from 'node:path';
6
7
 
7
8
  export const XCRUN_TIMEOUT = 15000;
8
9
 
9
10
  /**
10
11
  * Executes 'xcrun' command line utility
11
12
  *
12
- * @param {string[]} args xcrun arguments
13
- * @param {number} timeout [15000] The maximum number of milliseconds to wait until xcrun exists
14
- * @returns {Promise<import("teen_process").TeenProcessExecResult>} The result of xcrun execution
13
+ * @param args xcrun arguments
14
+ * @param timeout The maximum number of milliseconds to wait until xcrun exists
15
+ * @returns The result of xcrun execution
15
16
  * @throws {Error} If xcrun returned non-zero exit code or timed out
16
17
  */
17
- export async function runXcrunCommand (args, timeout = XCRUN_TIMEOUT) {
18
+ export async function runXcrunCommand(args: string[], timeout: number = XCRUN_TIMEOUT): Promise<TeenProcessExecResult<string>> {
18
19
  try {
19
20
  return await exec('xcrun', args, {timeout});
20
21
  } catch (err) {
@@ -30,11 +31,11 @@ export async function runXcrunCommand (args, timeout = XCRUN_TIMEOUT) {
30
31
  /**
31
32
  * Uses macOS Spotlight service to detect where the given app is installed
32
33
  *
33
- * @param {string} bundleId Bundle identifier of the target app
34
- * @returns {Promise<string[]>} Full paths to where the app with the given bundle id is present.
34
+ * @param bundleId Bundle identifier of the target app
35
+ * @returns Full paths to where the app with the given bundle id is present.
35
36
  */
36
- export async function findAppPaths (bundleId) {
37
- let stdout;
37
+ export async function findAppPaths(bundleId: string): Promise<string[]> {
38
+ let stdout: string;
38
39
  try {
39
40
  ({stdout} = await exec('/usr/bin/mdfind', [
40
41
  `kMDItemCFBundleIdentifier=${bundleId}`
@@ -55,16 +56,16 @@ export async function findAppPaths (bundleId) {
55
56
  return p;
56
57
  }
57
58
  })());
58
- return /** @type {string[]} */(await B.all(results)).filter(Boolean);
59
+ return (await B.all(results)).filter(Boolean) as string[];
59
60
  }
60
61
 
61
62
  /**
62
63
  * Finds and retrieves the content of the Xcode's Info.plist file
63
64
  *
64
- * @param {string} developerRoot Full path to the Contents/Developer folder under Xcode.app root
65
- * @returns {Promise<object>} All plist entries as an object or an empty object if no plist was found
65
+ * @param developerRoot Full path to the Contents/Developer folder under Xcode.app root
66
+ * @returns All plist entries as an object or an empty object if no plist was found
66
67
  */
67
- export async function readXcodePlist (developerRoot) {
68
+ export async function readXcodePlist(developerRoot: string): Promise<Record<string, any>> {
68
69
  const plistPath = path.resolve(developerRoot, '..', 'Info.plist');
69
70
  return await fs.exists(plistPath)
70
71
  ? await plist.parsePlistFile(plistPath)
@@ -24,6 +24,5 @@ export {
24
24
  };
25
25
  export default xcode;
26
26
 
27
- /**
28
- * @typedef {import('./xcode').XcodeVersion} XcodeVersion
29
- */
27
+ export type { XcodeVersion } from './types';
28
+
package/lib/types.ts ADDED
@@ -0,0 +1,9 @@
1
+ export interface XcodeVersion {
2
+ versionString: string;
3
+ versionFloat: number;
4
+ major: number;
5
+ minor: number;
6
+ patch?: number;
7
+ toString(): string;
8
+ }
9
+
@@ -1,5 +1,5 @@
1
1
  import { fs, logger } from '@appium/support';
2
- import path from 'path';
2
+ import path from 'node:path';
3
3
  import { retry } from 'asyncbox';
4
4
  import _ from 'lodash';
5
5
  import { exec } from 'teen_process';
@@ -7,6 +7,7 @@ import * as semver from 'semver';
7
7
  import {
8
8
  runXcrunCommand, findAppPaths, XCRUN_TIMEOUT, readXcodePlist
9
9
  } from './helpers';
10
+ import type { XcodeVersion } from './types';
10
11
 
11
12
  const DEFAULT_NUMBER_OF_RETRIES = 2;
12
13
  const XCODE_BUNDLE_ID = 'com.apple.dt.Xcode';
@@ -16,16 +17,12 @@ const log = logger.getLogger('Xcode');
16
17
  /**
17
18
  * Retrieves the full path to Xcode Developer subfolder via xcode-select
18
19
  *
19
- * @param {number} timeout The maximum timeout for xcode-select execution
20
- * @returns {Promise<string>} Full path to Xcode Developer subfolder
20
+ * @param timeout The maximum timeout for xcode-select execution
21
+ * @returns Full path to Xcode Developer subfolder
21
22
  * @throws {Error} If it is not possible to retrieve a proper path
22
23
  */
23
- async function getPathFromXcodeSelect (timeout = XCRUN_TIMEOUT) {
24
- /**
25
- * @param {string} prefix
26
- * @returns {Promise<string>}
27
- */
28
- const generateErrorMessage = async (prefix) => {
24
+ export async function getPathFromXcodeSelect(timeout: number = XCRUN_TIMEOUT): Promise<string> {
25
+ const generateErrorMessage = async (prefix: string): Promise<string> => {
29
26
  const xcodePaths = await findAppPaths(XCODE_BUNDLE_ID);
30
27
  if (_.isEmpty(xcodePaths)) {
31
28
  return `${prefix}. Consider installing Xcode to address this issue.`;
@@ -36,7 +33,7 @@ async function getPathFromXcodeSelect (timeout = XCRUN_TIMEOUT) {
36
33
  `Consider running${proposals.length > 1 ? ' any of' : ''}:\n${proposals.join('\n')}\nto address this issue.`;
37
34
  };
38
35
 
39
- let stdout;
36
+ let stdout: string;
40
37
  try {
41
38
  ({stdout} = await exec('xcode-select', ['--print-path'], {timeout}));
42
39
  } catch (e) {
@@ -63,12 +60,16 @@ async function getPathFromXcodeSelect (timeout = XCRUN_TIMEOUT) {
63
60
  /**
64
61
  * Retrieves the full path to Xcode Developer subfolder via `DEVELOPER_DIR` environment variable
65
62
  *
66
- * @returns {Promise<string>} Full path to Xcode Developer subfolder
63
+ * @returns Full path to Xcode Developer subfolder
67
64
  * @throws {Error} If it is not possible to retrieve a proper path
68
65
  * @privateRemarks This method assumes `DEVELOPER_DIR` is defined.
69
66
  */
70
- async function getPathFromDeveloperDir () {
71
- const developerRoot = /** @type {string} */(process.env.DEVELOPER_DIR);
67
+ export async function getPathFromDeveloperDir(): Promise<string> {
68
+ const developerRoot = process.env.DEVELOPER_DIR as string;
69
+ if (!developerRoot) {
70
+ throw new Error('DEVELOPER_DIR environment variable is not set');
71
+ }
72
+
72
73
  const {CFBundleIdentifier} = await readXcodePlist(developerRoot);
73
74
  if (CFBundleIdentifier === XCODE_BUNDLE_ID) {
74
75
  return developerRoot;
@@ -84,66 +85,28 @@ async function getPathFromDeveloperDir () {
84
85
  /**
85
86
  * Retrieves the full path to Xcode Developer subfolder.
86
87
  * If `DEVELOPER_DIR` environment variable is provided then its value has a priority.
87
- * @param {number} timeout The maximum timeout for xcode-select execution
88
- * @returns {Promise<string>} Full path to Xcode Developer subfolder timeout
88
+ * @param timeout The maximum timeout for xcode-select execution
89
+ * @returns Full path to Xcode Developer subfolder timeout
89
90
  * @throws {Error} If there was an error while retrieving the path.
90
91
  */
91
- const getPath = _.memoize(
92
- /**
93
- * @param {number} timeout
94
- * @returns {Promise<string>}
95
- */
96
- (timeout = XCRUN_TIMEOUT) => process.env.DEVELOPER_DIR ? getPathFromDeveloperDir() : getPathFromXcodeSelect(timeout));
97
-
98
- /**
99
- * Retrieves Xcode version
100
- *
101
- * @param {number} timeout [15000] Timeout of milliseconds to wait for terminal commands.
102
- * @returns {Promise<import("semver").SemVer | null>} Xcode version
103
- * @throws {Error} If there was a failure while retrieving the version
104
- */
105
- async function getVersionWithoutRetry (timeout = XCRUN_TIMEOUT) {
106
- const developerPath = await getPath(timeout);
107
- // we want to read the CFBundleShortVersionString from Xcode's plist.
108
- const {CFBundleShortVersionString} = await readXcodePlist(developerPath);
109
- return semver.coerce(CFBundleShortVersionString);
110
- }
111
-
112
- /**
113
- * Retrieves Xcode version or the cached one if called more than once
114
- *
115
- * @param {number} retries How many retries to apply for version retrieval
116
- * @param {number} timeout Timeout of milliseconds to wait for terminal commands
117
- * @returns {Promise<import("semver").SemVer | null>} Xcode version
118
- * @throws {Error} If there was a failure while retrieving the version
119
- */
120
- const getVersionMemoized = _.memoize(
121
- function getVersionMemoized (retries = DEFAULT_NUMBER_OF_RETRIES, timeout = XCRUN_TIMEOUT) {
122
- return retry(retries, getVersionWithoutRetry, timeout);
123
- }
92
+ export const getPath = _.memoize(
93
+ (timeout: number = XCRUN_TIMEOUT): Promise<string> =>
94
+ process.env.DEVELOPER_DIR ? getPathFromDeveloperDir() : getPathFromXcodeSelect(timeout)
124
95
  );
125
96
 
126
- /**
127
- * @typedef {Object} XcodeVersion
128
- * @property {string} versionString Xcode version as a string
129
- * @property {number} versionFloat Xcode version as a float number
130
- * @property {number} major Major number of Xcode version
131
- * @property {number} minor Minor number of Xcode version
132
- * @property {number} [patch] Patch number of Xcode version (if exists)
133
- * @property {() => string} toString Returns Xcode version as a string
134
- */
135
-
136
97
  /**
137
98
  * Retrieves Xcode version
138
99
  *
139
- * @param {boolean} parse [false] Whether to parse the version to a XcodeVersion version
140
- * @param {number} retries [2] How many retries to apply for getting the version number
141
- * @param {number} timeout [15000] Timeout of milliseconds to wait for terminal commands
142
- * @returns {Promise<XcodeVersion | string>} Xcode version depending on the value of `parse` flag
100
+ * @param parse Whether to parse the version to a XcodeVersion version
101
+ * @param retries How many retries to apply for getting the version number
102
+ * @param timeout Timeout of milliseconds to wait for terminal commands
103
+ * @returns Xcode version depending on the value of `parse` flag
143
104
  * @throws {Error} If there was a failure while retrieving the version
144
105
  */
145
- async function getVersion (parse = false, retries = DEFAULT_NUMBER_OF_RETRIES, timeout = XCRUN_TIMEOUT) {
146
- const version = /** @type {import('semver').SemVer} */(await getVersionMemoized(retries, timeout));
106
+ export async function getVersion(parse: false, retries?: number, timeout?: number): Promise<string>;
107
+ export async function getVersion(parse: true, retries?: number, timeout?: number): Promise<XcodeVersion>;
108
+ export async function getVersion(parse: boolean = false, retries: number = DEFAULT_NUMBER_OF_RETRIES, timeout: number = XCRUN_TIMEOUT): Promise<string | XcodeVersion> {
109
+ const version = await getVersionMemoized(retries, timeout) as semver.SemVer;
147
110
  // xcode version strings are not exactly semver string: patch versions of 0
148
111
  // are removed (e.g., '10.0.0' => '10.0')
149
112
  const versionString = version.patch > 0 ? version.version : `${version.major}.${version.minor}`;
@@ -157,7 +120,7 @@ async function getVersion (parse = false, retries = DEFAULT_NUMBER_OF_RETRIES, t
157
120
  major: version.major,
158
121
  minor: version.minor,
159
122
  patch: version.patch > 0 ? version.patch : undefined,
160
- toString () {
123
+ toString() {
161
124
  return versionString;
162
125
  },
163
126
  };
@@ -167,11 +130,11 @@ async function getVersion (parse = false, retries = DEFAULT_NUMBER_OF_RETRIES, t
167
130
  * Check https://trac.macports.org/wiki/XcodeVersionInfo
168
131
  * to see the actual mapping between clang and other components.
169
132
  *
170
- * @returns {Promise<string|null>} The actual Clang version in x.x.x.x or x.x.x format,
133
+ * @returns The actual Clang version in x.x.x.x or x.x.x format,
171
134
  * which is supplied with Command Line Tools. `null` is returned
172
135
  * if CLT are not installed.
173
136
  */
174
- async function getClangVersion () {
137
+ export async function getClangVersion(): Promise<string | null> {
175
138
  try {
176
139
  await fs.which('clang');
177
140
  } catch {
@@ -191,11 +154,11 @@ async function getClangVersion () {
191
154
  /**
192
155
  * Retrieves the maximum version of iOS SDK supported by the installed Xcode
193
156
  *
194
- * @param {number} timeout [15000] Timeout of milliseconds to wait for terminal commands
195
- * @returns {Promise<string>} The SDK version
157
+ * @param timeout Timeout of milliseconds to wait for terminal commands
158
+ * @returns The SDK version
196
159
  * @throws {Error} If the SDK version number cannot be determined
197
160
  */
198
- async function getMaxIOSSDKWithoutRetry (timeout = XCRUN_TIMEOUT) {
161
+ export async function getMaxIOSSDKWithoutRetry(timeout: number = XCRUN_TIMEOUT): Promise<string> {
199
162
  const args = ['--sdk', 'iphonesimulator', '--show-sdk-version'];
200
163
  const {stdout} = await runXcrunCommand(args, timeout);
201
164
  const sdkVersion = stdout.trim();
@@ -209,13 +172,13 @@ async function getMaxIOSSDKWithoutRetry (timeout = XCRUN_TIMEOUT) {
209
172
  /**
210
173
  * Retrieves the maximum version of iOS SDK supported by the installed Xcode
211
174
  *
212
- * @param {number} timeout Timeout of milliseconds to wait for terminal commands
213
- * @param {number} retries The maximum number of retries
214
- * @returns {string} The SDK version
175
+ * @param retries The maximum number of retries
176
+ * @param timeout Timeout of milliseconds to wait for terminal commands
177
+ * @returns The SDK version
215
178
  * @throws {Error} If the SDK version number cannot be determined
216
179
  */
217
- const getMaxIOSSDK = _.memoize(
218
- function getMaxIOSSDK (retries = DEFAULT_NUMBER_OF_RETRIES, timeout = XCRUN_TIMEOUT) {
180
+ export const getMaxIOSSDK = _.memoize(
181
+ function getMaxIOSSDK(retries: number = DEFAULT_NUMBER_OF_RETRIES, timeout: number = XCRUN_TIMEOUT) {
219
182
  return retry(retries, getMaxIOSSDKWithoutRetry, timeout);
220
183
  }
221
184
  );
@@ -223,11 +186,11 @@ const getMaxIOSSDK = _.memoize(
223
186
  /**
224
187
  * Retrieves the maximum version of tvOS SDK supported by the installed Xcode
225
188
  *
226
- * @param {number} timeout Timeout of milliseconds to wait for terminal commands
227
- * @returns {Promise<string>} The SDK version
189
+ * @param timeout Timeout of milliseconds to wait for terminal commands
190
+ * @returns The SDK version
228
191
  * @throws {Error} If the SDK version number cannot be determined
229
192
  */
230
- async function getMaxTVOSSDKWithoutRetry (timeout = XCRUN_TIMEOUT) {
193
+ export async function getMaxTVOSSDKWithoutRetry(timeout: number = XCRUN_TIMEOUT): Promise<string> {
231
194
  const args = ['--sdk', 'appletvsimulator', '--show-sdk-version'];
232
195
  const {stdout} = await runXcrunCommand(args, timeout);
233
196
  const sdkVersion = stdout.trim();
@@ -240,21 +203,43 @@ async function getMaxTVOSSDKWithoutRetry (timeout = XCRUN_TIMEOUT) {
240
203
  /**
241
204
  * Retrieves the maximum version of tvOS SDK supported by the installed Xcode
242
205
  *
206
+ * @param timeout Timeout of milliseconds to wait for terminal commands
207
+ * @param retries The maximum number of retries
208
+ * @returns The SDK version
243
209
  * @throws {Error} If the SDK version number cannot be determined
244
210
  */
245
- const getMaxTVOSSDK = _.memoize(
246
- /**
247
- * @param {number} timeout Timeout of milliseconds to wait for terminal commands
248
- * @param {number} retries The maximum number of retries
249
- * @returns {Promise<string>} The SDK version
250
- */
251
- async function getMaxTVOSSDK (retries = DEFAULT_NUMBER_OF_RETRIES, timeout = XCRUN_TIMEOUT) {
252
- return /** @type {string} */(await retry(retries, getMaxTVOSSDKWithoutRetry, timeout));
211
+ export const getMaxTVOSSDK = _.memoize(
212
+ async function getMaxTVOSSDK(retries: number = DEFAULT_NUMBER_OF_RETRIES, timeout: number = XCRUN_TIMEOUT): Promise<string> {
213
+ return await retry(retries, getMaxTVOSSDKWithoutRetry, timeout) as string;
253
214
  }
254
215
  );
255
216
 
256
- export {
257
- getPath, getVersion, getMaxIOSSDK, getMaxIOSSDKWithoutRetry,
258
- getMaxTVOSSDK, getMaxTVOSSDKWithoutRetry, getClangVersion,
259
- getPathFromDeveloperDir, getPathFromXcodeSelect,
260
- };
217
+ // Private helper functions
218
+
219
+ /**
220
+ * Retrieves Xcode version
221
+ *
222
+ * @param timeout Timeout of milliseconds to wait for terminal commands.
223
+ * @returns Xcode version
224
+ * @throws {Error} If there was a failure while retrieving the version
225
+ */
226
+ async function getVersionWithoutRetry(timeout: number = XCRUN_TIMEOUT): Promise<semver.SemVer | null> {
227
+ const developerPath = await getPath(timeout);
228
+ // we want to read the CFBundleShortVersionString from Xcode's plist.
229
+ const {CFBundleShortVersionString} = await readXcodePlist(developerPath);
230
+ return semver.coerce(CFBundleShortVersionString);
231
+ }
232
+
233
+ /**
234
+ * Retrieves Xcode version or the cached one if called more than once
235
+ *
236
+ * @param retries How many retries to apply for version retrieval
237
+ * @param timeout Timeout of milliseconds to wait for terminal commands
238
+ * @returns Xcode version
239
+ * @throws {Error} If there was a failure while retrieving the version
240
+ */
241
+ const getVersionMemoized = _.memoize(
242
+ function getVersionMemoized(retries: number = DEFAULT_NUMBER_OF_RETRIES, timeout: number = XCRUN_TIMEOUT): Promise<semver.SemVer | null> {
243
+ return retry(retries, getVersionWithoutRetry, timeout);
244
+ }
245
+ );
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "ios",
7
7
  "xcode"
8
8
  ],
9
- "version": "6.0.2",
9
+ "version": "6.1.0",
10
10
  "author": "Appium Contributors",
11
11
  "license": "Apache-2.0",
12
12
  "repository": {
@@ -21,6 +21,7 @@
21
21
  "npm": ">=10"
22
22
  },
23
23
  "main": "./build/lib/index.js",
24
+ "types": "./build/lib/index.d.ts",
24
25
  "files": [
25
26
  "lib",
26
27
  "build/lib",
@@ -71,6 +72,5 @@
71
72
  "semantic-release": "^24.0.0",
72
73
  "ts-node": "^10.9.1",
73
74
  "typescript": "^5.4.2"
74
- },
75
- "types": "./build/lib/index.d.ts"
75
+ }
76
76
  }