appium-xcode 6.0.1 → 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,15 @@
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
+
7
+ ## [6.0.2](https://github.com/appium/appium-xcode/compare/v6.0.1...v6.0.2) (2025-10-09)
8
+
9
+ ### Bug Fixes
10
+
11
+ * Throw a proper error instance if xcode path detection fails ([#155](https://github.com/appium/appium-xcode/issues/155)) ([7dcf54d](https://github.com/appium/appium-xcode/commit/7dcf54d598cdbb45ba5cbb5403bb01de9c605036))
12
+
1
13
  ## [6.0.1](https://github.com/appium/appium-xcode/compare/v6.0.0...v6.0.1) (2025-08-23)
2
14
 
3
15
  ### Miscellaneous Chores
@@ -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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AAC,EAAE,CAAC;YACvB,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC,CAAC,EAAE,CAAC,CAAC;IACN,OAAO,CAAC,MAAM,kBAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAa,CAAC;AAC5D,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,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":";;;;mBAiIc,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;AA7HD;;;;;;GAMG;AACH,2CAJa,OAAO,CAAC,MAAM,CAAC,CAe3B;AApED;;;;;;GAMG;AACH,iDAJW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CA4C3B;cA5Da,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
  };
@@ -81,14 +77,12 @@ async function getPathFromXcodeSelect(timeout = helpers_1.XCRUN_TIMEOUT) {
81
77
  catch (e) {
82
78
  const msg = `Cannot determine the path to Xcode by running 'xcode-select -p' command. ` +
83
79
  `Original error: ${e.stderr || e.message}`;
84
- log.error(msg);
85
80
  throw new Error(msg);
86
81
  }
87
82
  // trim and remove trailing slash
88
83
  const developerRoot = String(stdout).replace(/\/$/, '').trim();
89
84
  if (!developerRoot) {
90
85
  const msg = await generateErrorMessage(`'xcode-select -p' returned an empty string`);
91
- log.error(msg);
92
86
  throw new Error(msg);
93
87
  }
94
88
  // xcode-select might also return a path to command line tools
@@ -97,85 +91,38 @@ async function getPathFromXcodeSelect(timeout = helpers_1.XCRUN_TIMEOUT) {
97
91
  return developerRoot;
98
92
  }
99
93
  const msg = await generateErrorMessage(`'${developerRoot}' is not a valid Xcode path`);
100
- log.error(msg);
101
- throw msg;
94
+ throw new Error(msg);
102
95
  }
103
96
  /**
104
97
  * Retrieves the full path to Xcode Developer subfolder via `DEVELOPER_DIR` environment variable
105
98
  *
106
- * @returns {Promise<string>} Full path to Xcode Developer subfolder
99
+ * @returns Full path to Xcode Developer subfolder
107
100
  * @throws {Error} If it is not possible to retrieve a proper path
108
101
  * @privateRemarks This method assumes `DEVELOPER_DIR` is defined.
109
102
  */
110
103
  async function getPathFromDeveloperDir() {
111
- 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
+ }
112
108
  const { CFBundleIdentifier } = await (0, helpers_1.readXcodePlist)(developerRoot);
113
109
  if (CFBundleIdentifier === XCODE_BUNDLE_ID) {
114
110
  return developerRoot;
115
111
  }
116
- const msg = `The path to Xcode Developer dir '${developerRoot}' provided in DEVELOPER_DIR ` +
117
- `environment variable is not a valid path`;
118
- log.error(msg);
112
+ const msg = (`The path to Xcode Developer dir '${developerRoot}' provided in DEVELOPER_DIR ` +
113
+ `environment variable is not a valid path`);
119
114
  throw new Error(msg);
120
115
  }
121
116
  /**
122
117
  * Retrieves the full path to Xcode Developer subfolder.
123
118
  * If `DEVELOPER_DIR` environment variable is provided then its value has a priority.
124
- * @param {number} timeout The maximum timeout for xcode-select execution
125
- * @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
126
121
  * @throws {Error} If there was an error while retrieving the path.
127
122
  */
128
- const getPath = lodash_1.default.memoize(
129
- /**
130
- * @param {number} timeout
131
- * @returns {Promise<string>}
132
- */
133
- (timeout = helpers_1.XCRUN_TIMEOUT) => process.env.DEVELOPER_DIR ? getPathFromDeveloperDir() : getPathFromXcodeSelect(timeout));
134
- exports.getPath = getPath;
135
- /**
136
- * Retrieves Xcode version
137
- *
138
- * @param {number} timeout [15000] Timeout of milliseconds to wait for terminal commands.
139
- * @returns {Promise<import("semver").SemVer | null>} Xcode version
140
- * @throws {Error} If there was a failure while retrieving the version
141
- */
142
- async function getVersionWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
143
- const developerPath = await getPath(timeout);
144
- // we want to read the CFBundleShortVersionString from Xcode's plist.
145
- const { CFBundleShortVersionString } = await (0, helpers_1.readXcodePlist)(developerPath);
146
- return semver.coerce(CFBundleShortVersionString);
147
- }
148
- /**
149
- * Retrieves Xcode version or the cached one if called more than once
150
- *
151
- * @param {number} retries How many retries to apply for version retrieval
152
- * @param {number} timeout Timeout of milliseconds to wait for terminal commands
153
- * @returns {Promise<import("semver").SemVer | null>} Xcode version
154
- * @throws {Error} If there was a failure while retrieving the version
155
- */
156
- const getVersionMemoized = lodash_1.default.memoize(function getVersionMemoized(retries = DEFAULT_NUMBER_OF_RETRIES, timeout = helpers_1.XCRUN_TIMEOUT) {
157
- return (0, asyncbox_1.retry)(retries, getVersionWithoutRetry, timeout);
158
- });
159
- /**
160
- * @typedef {Object} XcodeVersion
161
- * @property {string} versionString Xcode version as a string
162
- * @property {number} versionFloat Xcode version as a float number
163
- * @property {number} major Major number of Xcode version
164
- * @property {number} minor Minor number of Xcode version
165
- * @property {number} [patch] Patch number of Xcode version (if exists)
166
- * @property {() => string} toString Returns Xcode version as a string
167
- */
168
- /**
169
- * Retrieves Xcode version
170
- *
171
- * @param {boolean} parse [false] Whether to parse the version to a XcodeVersion version
172
- * @param {number} retries [2] How many retries to apply for getting the version number
173
- * @param {number} timeout [15000] Timeout of milliseconds to wait for terminal commands
174
- * @returns {Promise<XcodeVersion | string>} Xcode version depending on the value of `parse` flag
175
- * @throws {Error} If there was a failure while retrieving the version
176
- */
123
+ exports.getPath = lodash_1.default.memoize((timeout = helpers_1.XCRUN_TIMEOUT) => process.env.DEVELOPER_DIR ? getPathFromDeveloperDir() : getPathFromXcodeSelect(timeout));
177
124
  async function getVersion(parse = false, retries = DEFAULT_NUMBER_OF_RETRIES, timeout = helpers_1.XCRUN_TIMEOUT) {
178
- const version = /** @type {import('semver').SemVer} */ (await getVersionMemoized(retries, timeout));
125
+ const version = await getVersionMemoized(retries, timeout);
179
126
  // xcode version strings are not exactly semver string: patch versions of 0
180
127
  // are removed (e.g., '10.0.0' => '10.0')
181
128
  const versionString = version.patch > 0 ? version.version : `${version.major}.${version.minor}`;
@@ -197,7 +144,7 @@ async function getVersion(parse = false, retries = DEFAULT_NUMBER_OF_RETRIES, ti
197
144
  * Check https://trac.macports.org/wiki/XcodeVersionInfo
198
145
  * to see the actual mapping between clang and other components.
199
146
  *
200
- * @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,
201
148
  * which is supplied with Command Line Tools. `null` is returned
202
149
  * if CLT are not installed.
203
150
  */
@@ -221,8 +168,8 @@ async function getClangVersion() {
221
168
  /**
222
169
  * Retrieves the maximum version of iOS SDK supported by the installed Xcode
223
170
  *
224
- * @param {number} timeout [15000] Timeout of milliseconds to wait for terminal commands
225
- * @returns {Promise<string>} The SDK version
171
+ * @param timeout Timeout of milliseconds to wait for terminal commands
172
+ * @returns The SDK version
226
173
  * @throws {Error} If the SDK version number cannot be determined
227
174
  */
228
175
  async function getMaxIOSSDKWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
@@ -238,20 +185,19 @@ async function getMaxIOSSDKWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
238
185
  /**
239
186
  * Retrieves the maximum version of iOS SDK supported by the installed Xcode
240
187
  *
241
- * @param {number} timeout Timeout of milliseconds to wait for terminal commands
242
- * @param {number} retries The maximum number of retries
243
- * @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
244
191
  * @throws {Error} If the SDK version number cannot be determined
245
192
  */
246
- 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) {
247
194
  return (0, asyncbox_1.retry)(retries, getMaxIOSSDKWithoutRetry, timeout);
248
195
  });
249
- exports.getMaxIOSSDK = getMaxIOSSDK;
250
196
  /**
251
197
  * Retrieves the maximum version of tvOS SDK supported by the installed Xcode
252
198
  *
253
- * @param {number} timeout Timeout of milliseconds to wait for terminal commands
254
- * @returns {Promise<string>} The SDK version
199
+ * @param timeout Timeout of milliseconds to wait for terminal commands
200
+ * @returns The SDK version
255
201
  * @throws {Error} If the SDK version number cannot be determined
256
202
  */
257
203
  async function getMaxTVOSSDKWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
@@ -266,16 +212,37 @@ async function getMaxTVOSSDKWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
266
212
  /**
267
213
  * Retrieves the maximum version of tvOS SDK supported by the installed Xcode
268
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
269
218
  * @throws {Error} If the SDK version number cannot be determined
270
219
  */
271
- 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
224
+ /**
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
230
+ */
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
+ }
272
237
  /**
273
- * @param {number} timeout Timeout of milliseconds to wait for terminal commands
274
- * @param {number} retries The maximum number of retries
275
- * @returns {Promise<string>} The SDK version
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
276
244
  */
277
- async function getMaxTVOSSDK(retries = DEFAULT_NUMBER_OF_RETRIES, timeout = helpers_1.XCRUN_TIMEOUT) {
278
- return /** @type {string} */ (await (0, asyncbox_1.retry)(retries, getMaxTVOSSDKWithoutRetry, timeout));
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);
279
247
  });
280
- exports.getMaxTVOSSDK = getMaxTVOSSDK;
281
248
  //# sourceMappingURL=xcode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"xcode.js","sourceRoot":"","sources":["../../lib/xcode.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkQW,gCAAU;AAAgB,4DAAwB;AAC5C,8DAAyB;AAAE,0CAAe;AACzD,0DAAuB;AAAE,wDAAsB;AApQjD,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,CAAC;YAC1B,OAAO,GAAG,MAAM,oDAAoD,CAAC;QACvE,CAAC;QAED,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,6BAA6B,cAAI,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC;QAC/G,OAAO,GAAG,MAAM,IAAI;YAClB,mBAAmB,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,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M,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,20 +33,18 @@ 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) {
43
40
  const msg = `Cannot determine the path to Xcode by running 'xcode-select -p' command. ` +
44
41
  `Original error: ${e.stderr || e.message}`;
45
- log.error(msg);
46
42
  throw new Error(msg);
47
43
  }
48
44
  // trim and remove trailing slash
49
45
  const developerRoot = String(stdout).replace(/\/$/, '').trim();
50
46
  if (!developerRoot) {
51
47
  const msg = await generateErrorMessage(`'xcode-select -p' returned an empty string`);
52
- log.error(msg);
53
48
  throw new Error(msg);
54
49
  }
55
50
  // xcode-select might also return a path to command line tools
@@ -59,93 +54,59 @@ async function getPathFromXcodeSelect (timeout = XCRUN_TIMEOUT) {
59
54
  }
60
55
 
61
56
  const msg = await generateErrorMessage(`'${developerRoot}' is not a valid Xcode path`);
62
- log.error(msg);
63
- throw msg;
57
+ throw new Error(msg);
64
58
  }
65
59
 
66
60
  /**
67
61
  * Retrieves the full path to Xcode Developer subfolder via `DEVELOPER_DIR` environment variable
68
62
  *
69
- * @returns {Promise<string>} Full path to Xcode Developer subfolder
63
+ * @returns Full path to Xcode Developer subfolder
70
64
  * @throws {Error} If it is not possible to retrieve a proper path
71
65
  * @privateRemarks This method assumes `DEVELOPER_DIR` is defined.
72
66
  */
73
- async function getPathFromDeveloperDir () {
74
- 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
+
75
73
  const {CFBundleIdentifier} = await readXcodePlist(developerRoot);
76
74
  if (CFBundleIdentifier === XCODE_BUNDLE_ID) {
77
75
  return developerRoot;
78
76
  }
79
77
 
80
- const msg = `The path to Xcode Developer dir '${developerRoot}' provided in DEVELOPER_DIR ` +
81
- `environment variable is not a valid path`;
82
- log.error(msg);
78
+ const msg = (
79
+ `The path to Xcode Developer dir '${developerRoot}' provided in DEVELOPER_DIR ` +
80
+ `environment variable is not a valid path`
81
+ );
83
82
  throw new Error(msg);
84
83
  }
85
84
 
86
85
  /**
87
86
  * Retrieves the full path to Xcode Developer subfolder.
88
87
  * If `DEVELOPER_DIR` environment variable is provided then its value has a priority.
89
- * @param {number} timeout The maximum timeout for xcode-select execution
90
- * @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
91
90
  * @throws {Error} If there was an error while retrieving the path.
92
91
  */
93
- const getPath = _.memoize(
94
- /**
95
- * @param {number} timeout
96
- * @returns {Promise<string>}
97
- */
98
- (timeout = XCRUN_TIMEOUT) => process.env.DEVELOPER_DIR ? getPathFromDeveloperDir() : getPathFromXcodeSelect(timeout));
99
-
100
- /**
101
- * Retrieves Xcode version
102
- *
103
- * @param {number} timeout [15000] Timeout of milliseconds to wait for terminal commands.
104
- * @returns {Promise<import("semver").SemVer | null>} Xcode version
105
- * @throws {Error} If there was a failure while retrieving the version
106
- */
107
- async function getVersionWithoutRetry (timeout = XCRUN_TIMEOUT) {
108
- const developerPath = await getPath(timeout);
109
- // we want to read the CFBundleShortVersionString from Xcode's plist.
110
- const {CFBundleShortVersionString} = await readXcodePlist(developerPath);
111
- return semver.coerce(CFBundleShortVersionString);
112
- }
113
-
114
- /**
115
- * Retrieves Xcode version or the cached one if called more than once
116
- *
117
- * @param {number} retries How many retries to apply for version retrieval
118
- * @param {number} timeout Timeout of milliseconds to wait for terminal commands
119
- * @returns {Promise<import("semver").SemVer | null>} Xcode version
120
- * @throws {Error} If there was a failure while retrieving the version
121
- */
122
- const getVersionMemoized = _.memoize(
123
- function getVersionMemoized (retries = DEFAULT_NUMBER_OF_RETRIES, timeout = XCRUN_TIMEOUT) {
124
- return retry(retries, getVersionWithoutRetry, timeout);
125
- }
92
+ export const getPath = _.memoize(
93
+ (timeout: number = XCRUN_TIMEOUT): Promise<string> =>
94
+ process.env.DEVELOPER_DIR ? getPathFromDeveloperDir() : getPathFromXcodeSelect(timeout)
126
95
  );
127
96
 
128
- /**
129
- * @typedef {Object} XcodeVersion
130
- * @property {string} versionString Xcode version as a string
131
- * @property {number} versionFloat Xcode version as a float number
132
- * @property {number} major Major number of Xcode version
133
- * @property {number} minor Minor number of Xcode version
134
- * @property {number} [patch] Patch number of Xcode version (if exists)
135
- * @property {() => string} toString Returns Xcode version as a string
136
- */
137
-
138
97
  /**
139
98
  * Retrieves Xcode version
140
99
  *
141
- * @param {boolean} parse [false] Whether to parse the version to a XcodeVersion version
142
- * @param {number} retries [2] How many retries to apply for getting the version number
143
- * @param {number} timeout [15000] Timeout of milliseconds to wait for terminal commands
144
- * @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
145
104
  * @throws {Error} If there was a failure while retrieving the version
146
105
  */
147
- async function getVersion (parse = false, retries = DEFAULT_NUMBER_OF_RETRIES, timeout = XCRUN_TIMEOUT) {
148
- 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;
149
110
  // xcode version strings are not exactly semver string: patch versions of 0
150
111
  // are removed (e.g., '10.0.0' => '10.0')
151
112
  const versionString = version.patch > 0 ? version.version : `${version.major}.${version.minor}`;
@@ -159,7 +120,7 @@ async function getVersion (parse = false, retries = DEFAULT_NUMBER_OF_RETRIES, t
159
120
  major: version.major,
160
121
  minor: version.minor,
161
122
  patch: version.patch > 0 ? version.patch : undefined,
162
- toString () {
123
+ toString() {
163
124
  return versionString;
164
125
  },
165
126
  };
@@ -169,11 +130,11 @@ async function getVersion (parse = false, retries = DEFAULT_NUMBER_OF_RETRIES, t
169
130
  * Check https://trac.macports.org/wiki/XcodeVersionInfo
170
131
  * to see the actual mapping between clang and other components.
171
132
  *
172
- * @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,
173
134
  * which is supplied with Command Line Tools. `null` is returned
174
135
  * if CLT are not installed.
175
136
  */
176
- async function getClangVersion () {
137
+ export async function getClangVersion(): Promise<string | null> {
177
138
  try {
178
139
  await fs.which('clang');
179
140
  } catch {
@@ -193,11 +154,11 @@ async function getClangVersion () {
193
154
  /**
194
155
  * Retrieves the maximum version of iOS SDK supported by the installed Xcode
195
156
  *
196
- * @param {number} timeout [15000] Timeout of milliseconds to wait for terminal commands
197
- * @returns {Promise<string>} The SDK version
157
+ * @param timeout Timeout of milliseconds to wait for terminal commands
158
+ * @returns The SDK version
198
159
  * @throws {Error} If the SDK version number cannot be determined
199
160
  */
200
- async function getMaxIOSSDKWithoutRetry (timeout = XCRUN_TIMEOUT) {
161
+ export async function getMaxIOSSDKWithoutRetry(timeout: number = XCRUN_TIMEOUT): Promise<string> {
201
162
  const args = ['--sdk', 'iphonesimulator', '--show-sdk-version'];
202
163
  const {stdout} = await runXcrunCommand(args, timeout);
203
164
  const sdkVersion = stdout.trim();
@@ -211,13 +172,13 @@ async function getMaxIOSSDKWithoutRetry (timeout = XCRUN_TIMEOUT) {
211
172
  /**
212
173
  * Retrieves the maximum version of iOS SDK supported by the installed Xcode
213
174
  *
214
- * @param {number} timeout Timeout of milliseconds to wait for terminal commands
215
- * @param {number} retries The maximum number of retries
216
- * @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
217
178
  * @throws {Error} If the SDK version number cannot be determined
218
179
  */
219
- const getMaxIOSSDK = _.memoize(
220
- 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) {
221
182
  return retry(retries, getMaxIOSSDKWithoutRetry, timeout);
222
183
  }
223
184
  );
@@ -225,11 +186,11 @@ const getMaxIOSSDK = _.memoize(
225
186
  /**
226
187
  * Retrieves the maximum version of tvOS SDK supported by the installed Xcode
227
188
  *
228
- * @param {number} timeout Timeout of milliseconds to wait for terminal commands
229
- * @returns {Promise<string>} The SDK version
189
+ * @param timeout Timeout of milliseconds to wait for terminal commands
190
+ * @returns The SDK version
230
191
  * @throws {Error} If the SDK version number cannot be determined
231
192
  */
232
- async function getMaxTVOSSDKWithoutRetry (timeout = XCRUN_TIMEOUT) {
193
+ export async function getMaxTVOSSDKWithoutRetry(timeout: number = XCRUN_TIMEOUT): Promise<string> {
233
194
  const args = ['--sdk', 'appletvsimulator', '--show-sdk-version'];
234
195
  const {stdout} = await runXcrunCommand(args, timeout);
235
196
  const sdkVersion = stdout.trim();
@@ -242,21 +203,43 @@ async function getMaxTVOSSDKWithoutRetry (timeout = XCRUN_TIMEOUT) {
242
203
  /**
243
204
  * Retrieves the maximum version of tvOS SDK supported by the installed Xcode
244
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
245
209
  * @throws {Error} If the SDK version number cannot be determined
246
210
  */
247
- const getMaxTVOSSDK = _.memoize(
248
- /**
249
- * @param {number} timeout Timeout of milliseconds to wait for terminal commands
250
- * @param {number} retries The maximum number of retries
251
- * @returns {Promise<string>} The SDK version
252
- */
253
- async function getMaxTVOSSDK (retries = DEFAULT_NUMBER_OF_RETRIES, timeout = XCRUN_TIMEOUT) {
254
- 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;
255
214
  }
256
215
  );
257
216
 
258
- export {
259
- getPath, getVersion, getMaxIOSSDK, getMaxIOSSDKWithoutRetry,
260
- getMaxTVOSSDK, getMaxTVOSSDKWithoutRetry, getClangVersion,
261
- getPathFromDeveloperDir, getPathFromXcodeSelect,
262
- };
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.1",
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
  }