appium-xcode 6.2.6 → 7.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 +16 -0
- package/build/lib/helpers.d.ts.map +1 -1
- package/build/lib/helpers.js +13 -24
- package/build/lib/helpers.js.map +1 -1
- package/build/lib/index.d.ts +2 -2
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +8 -16
- package/build/lib/index.js.map +1 -1
- package/build/lib/types.d.ts +6 -0
- package/build/lib/types.d.ts.map +1 -1
- package/build/lib/types.js +1 -2
- package/build/lib/xcode.d.ts +1 -1
- package/build/lib/xcode.d.ts.map +1 -1
- package/build/lib/xcode.js +34 -80
- package/build/lib/xcode.js.map +1 -1
- package/lib/helpers.ts +4 -6
- package/lib/index.ts +2 -3
- package/lib/types.ts +6 -0
- package/lib/xcode.ts +15 -24
- package/package.json +33 -35
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [7.1.0](https://github.com/appium/appium-xcode/compare/v7.0.0...v7.1.0) (2026-07-25)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* Integrate oxc and release configs ([#190](https://github.com/appium/appium-xcode/issues/190)) ([5328105](https://github.com/appium/appium-xcode/commit/5328105735a4a1ba05c8dcff2557de93dbb79344))
|
|
6
|
+
|
|
7
|
+
## [7.0.0](https://github.com/appium/appium-xcode/compare/v6.2.6...v7.0.0) (2026-07-24)
|
|
8
|
+
|
|
9
|
+
### ⚠ BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* Consumers using require('appium-xcode') must switch to import/dynamic import() — the package no longer ships a CommonJS entry point.
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* Migrate the package to ESM ([#188](https://github.com/appium/appium-xcode/issues/188)) ([ea51d54](https://github.com/appium/appium-xcode/commit/ea51d545a3d0f3074e5f2efcc7cab1aa4585419b))
|
|
16
|
+
|
|
1
17
|
## [6.2.6](https://github.com/appium/appium-xcode/compare/v6.2.5...v6.2.6) (2026-07-06)
|
|
2
18
|
|
|
3
19
|
### Miscellaneous Chores
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../lib/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../lib/helpers.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,cAAc,CAAC;AAExD,eAAO,MAAM,aAAa,QAAQ,CAAC;AAEnC;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,MAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAcxC;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAwBtE;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAGxF"}
|
package/build/lib/helpers.js
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.XCRUN_TIMEOUT = void 0;
|
|
7
|
-
exports.runXcrunCommand = runXcrunCommand;
|
|
8
|
-
exports.findAppPaths = findAppPaths;
|
|
9
|
-
exports.readXcodePlist = readXcodePlist;
|
|
10
|
-
const teen_process_1 = require("teen_process");
|
|
11
|
-
const support_1 = require("@appium/support");
|
|
12
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
13
|
-
exports.XCRUN_TIMEOUT = 15000;
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { fs, plist } from '@appium/support';
|
|
3
|
+
import { exec } from 'teen_process';
|
|
4
|
+
export const XCRUN_TIMEOUT = 15000;
|
|
14
5
|
/**
|
|
15
6
|
* Executes 'xcrun' command line utility
|
|
16
7
|
*
|
|
@@ -19,16 +10,14 @@ exports.XCRUN_TIMEOUT = 15000;
|
|
|
19
10
|
* @returns The result of xcrun execution
|
|
20
11
|
* @throws {Error} If xcrun returned non-zero exit code or timed out
|
|
21
12
|
*/
|
|
22
|
-
async function runXcrunCommand(args, timeout =
|
|
13
|
+
export async function runXcrunCommand(args, timeout = XCRUN_TIMEOUT) {
|
|
23
14
|
try {
|
|
24
|
-
return await
|
|
15
|
+
return await exec('xcrun', args, { timeout });
|
|
25
16
|
}
|
|
26
17
|
catch (err) {
|
|
27
18
|
if (err instanceof Error) {
|
|
28
19
|
// the true error can be hidden within the stderr
|
|
29
|
-
const stderr = err && typeof err === 'object' && 'stderr' in err
|
|
30
|
-
? String(err.stderr)
|
|
31
|
-
: '';
|
|
20
|
+
const stderr = err && typeof err === 'object' && 'stderr' in err ? String(err.stderr) : '';
|
|
32
21
|
if (stderr) {
|
|
33
22
|
err.message = `${err.message}: ${stderr}`;
|
|
34
23
|
}
|
|
@@ -43,10 +32,10 @@ async function runXcrunCommand(args, timeout = exports.XCRUN_TIMEOUT) {
|
|
|
43
32
|
* @param bundleId Bundle identifier of the target app
|
|
44
33
|
* @returns Full paths to where the app with the given bundle id is present.
|
|
45
34
|
*/
|
|
46
|
-
async function findAppPaths(bundleId) {
|
|
35
|
+
export async function findAppPaths(bundleId) {
|
|
47
36
|
let stdout;
|
|
48
37
|
try {
|
|
49
|
-
({ stdout } = await
|
|
38
|
+
({ stdout } = await exec('/usr/bin/mdfind', [`kMDItemCFBundleIdentifier=${bundleId}`]));
|
|
50
39
|
}
|
|
51
40
|
catch {
|
|
52
41
|
return [];
|
|
@@ -60,7 +49,7 @@ async function findAppPaths(bundleId) {
|
|
|
60
49
|
return [];
|
|
61
50
|
}
|
|
62
51
|
const results = matchedPaths.map((p) => (async () => {
|
|
63
|
-
if (await
|
|
52
|
+
if (await fs.exists(p)) {
|
|
64
53
|
return p;
|
|
65
54
|
}
|
|
66
55
|
})());
|
|
@@ -72,8 +61,8 @@ async function findAppPaths(bundleId) {
|
|
|
72
61
|
* @param developerRoot Full path to the Contents/Developer folder under Xcode.app root
|
|
73
62
|
* @returns All plist entries as an object or an empty object if no plist was found
|
|
74
63
|
*/
|
|
75
|
-
async function readXcodePlist(developerRoot) {
|
|
76
|
-
const plistPath =
|
|
77
|
-
return (await
|
|
64
|
+
export async function readXcodePlist(developerRoot) {
|
|
65
|
+
const plistPath = path.resolve(developerRoot, '..', 'Info.plist');
|
|
66
|
+
return (await fs.exists(plistPath)) ? await plist.parsePlistFile(plistPath) : {};
|
|
78
67
|
}
|
|
79
68
|
//# sourceMappingURL=helpers.js.map
|
package/build/lib/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../lib/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../lib/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAC,EAAE,EAAE,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;AAGlC,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC;AAEnC;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,IAAc,EACd,UAAkB,aAAa;IAE/B,IAAI,CAAC;QACH,OAAO,MAAM,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,EAAC,OAAO,EAAC,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;YACzB,iDAAiD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AC,EAAE,CACL,CAAC;IACF,OAAO,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAa,CAAC;AAClE,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,aAAqB;IACxD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;IAClE,OAAO,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACnF,CAAC"}
|
package/build/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getPath, getVersion, getMaxIOSSDK, getMaxTVOSSDK, getClangVersion } from './xcode';
|
|
1
|
+
import { getPath, getVersion, getMaxIOSSDK, getMaxTVOSSDK, getClangVersion } from './xcode.js';
|
|
2
2
|
declare const xcode: {
|
|
3
3
|
getPath: ((timeout?: number) => Promise<string>) & {
|
|
4
4
|
cache: Map<unknown, Promise<string>>;
|
|
@@ -14,5 +14,5 @@ declare const xcode: {
|
|
|
14
14
|
};
|
|
15
15
|
export { getPath, getVersion, getMaxIOSSDK, getMaxTVOSSDK, getClangVersion };
|
|
16
16
|
export default xcode;
|
|
17
|
-
export type { XcodeVersion } from './types';
|
|
17
|
+
export type { XcodeVersion } from './types.js';
|
|
18
18
|
//# sourceMappingURL=index.d.ts.map
|
package/build/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAC,MAAM,YAAY,CAAC;AAE7F,QAAA,MAAM,KAAK;;;;;;;;;;;;CAMV,CAAC;AAEF,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAC,CAAC;AAC3E,eAAe,KAAK,CAAC;AAErB,YAAY,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC"}
|
package/build/lib/index.js
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getClangVersion = exports.getMaxTVOSSDK = exports.getMaxIOSSDK = exports.getVersion = exports.getPath = void 0;
|
|
4
|
-
// transpile:main
|
|
5
|
-
const xcode_1 = require("./xcode");
|
|
6
|
-
Object.defineProperty(exports, "getPath", { enumerable: true, get: function () { return xcode_1.getPath; } });
|
|
7
|
-
Object.defineProperty(exports, "getVersion", { enumerable: true, get: function () { return xcode_1.getVersion; } });
|
|
8
|
-
Object.defineProperty(exports, "getMaxIOSSDK", { enumerable: true, get: function () { return xcode_1.getMaxIOSSDK; } });
|
|
9
|
-
Object.defineProperty(exports, "getMaxTVOSSDK", { enumerable: true, get: function () { return xcode_1.getMaxTVOSSDK; } });
|
|
10
|
-
Object.defineProperty(exports, "getClangVersion", { enumerable: true, get: function () { return xcode_1.getClangVersion; } });
|
|
1
|
+
import { getPath, getVersion, getMaxIOSSDK, getMaxTVOSSDK, getClangVersion } from './xcode.js';
|
|
11
2
|
const xcode = {
|
|
12
|
-
getPath
|
|
13
|
-
getVersion
|
|
14
|
-
getMaxIOSSDK
|
|
15
|
-
getMaxTVOSSDK
|
|
16
|
-
getClangVersion
|
|
3
|
+
getPath,
|
|
4
|
+
getVersion,
|
|
5
|
+
getMaxIOSSDK,
|
|
6
|
+
getMaxTVOSSDK,
|
|
7
|
+
getClangVersion,
|
|
17
8
|
};
|
|
18
|
-
|
|
9
|
+
export { getPath, getVersion, getMaxIOSSDK, getMaxTVOSSDK, getClangVersion };
|
|
10
|
+
export default xcode;
|
|
19
11
|
//# sourceMappingURL=index.js.map
|
package/build/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAC,MAAM,YAAY,CAAC;AAE7F,MAAM,KAAK,GAAG;IACZ,OAAO;IACP,UAAU;IACV,YAAY;IACZ,aAAa;IACb,eAAe;CAChB,CAAC;AAEF,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAC,CAAC;AAC3E,eAAe,KAAK,CAAC"}
|
package/build/lib/types.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
export interface XcodeVersion {
|
|
2
|
+
/** The Xcode version as a string, e.g. '10.0' or '10.0.1' */
|
|
2
3
|
versionString: string;
|
|
4
|
+
/** The Xcode version as a float, e.g. 10.0 or 10.1 */
|
|
3
5
|
versionFloat: number;
|
|
6
|
+
/** The major version number, e.g. 10 */
|
|
4
7
|
major: number;
|
|
8
|
+
/** The minor version number, e.g. 1 */
|
|
5
9
|
minor: number;
|
|
10
|
+
/** The patch version number, if present in the version string */
|
|
6
11
|
patch?: number;
|
|
12
|
+
/** Returns {@link versionString} */
|
|
7
13
|
toString(): string;
|
|
8
14
|
}
|
|
9
15
|
//# sourceMappingURL=types.d.ts.map
|
package/build/lib/types.d.ts.map
CHANGED
|
@@ -1 +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"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../lib/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,aAAa,EAAE,MAAM,CAAC;IACtB,sDAAsD;IACtD,YAAY,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,QAAQ,IAAI,MAAM,CAAC;CACpB"}
|
package/build/lib/types.js
CHANGED
package/build/lib/xcode.d.ts
CHANGED
package/build/lib/xcode.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xcode.d.ts","sourceRoot":"","sources":["../../lib/xcode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"xcode.d.ts","sourceRoot":"","sources":["../../lib/xcode.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAO7C;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAuC7F;AAED;;;;;;GAMG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC,CAe/D;AAED;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,cACR,MAAM,KAAmB,OAAO,CAAC,MAAM,CAAC;;CAEnD,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;AA0BzG;;;;;;;GAOG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAc9D;AAED;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAS/F;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,cACd,MAAM,YACN,MAAM;;CAGf,CAAC;AAEH;;;;;;GAMG;AACH,wBAAsB,yBAAyB,CAAC,OAAO,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAQhG;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,cACf,MAAM,YACN,MAAM,KACd,OAAO,CAAC,MAAM,CAAC;;CAEhB,CAAC"}
|
package/build/lib/xcode.js
CHANGED
|
@@ -1,57 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.getMaxTVOSSDK = exports.getMaxIOSSDK = exports.getPath = void 0;
|
|
40
|
-
exports.getPathFromXcodeSelect = getPathFromXcodeSelect;
|
|
41
|
-
exports.getPathFromDeveloperDir = getPathFromDeveloperDir;
|
|
42
|
-
exports.getVersion = getVersion;
|
|
43
|
-
exports.getClangVersion = getClangVersion;
|
|
44
|
-
exports.getMaxIOSSDKWithoutRetry = getMaxIOSSDKWithoutRetry;
|
|
45
|
-
exports.getMaxTVOSSDKWithoutRetry = getMaxTVOSSDKWithoutRetry;
|
|
46
|
-
const support_1 = require("@appium/support");
|
|
47
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
48
|
-
const asyncbox_1 = require("asyncbox");
|
|
49
|
-
const teen_process_1 = require("teen_process");
|
|
50
|
-
const semver = __importStar(require("semver"));
|
|
51
|
-
const helpers_1 = require("./helpers");
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { fs, logger, util } from '@appium/support';
|
|
3
|
+
import { retry } from 'asyncbox';
|
|
4
|
+
import * as semver from 'semver';
|
|
5
|
+
import { exec } from 'teen_process';
|
|
6
|
+
import { runXcrunCommand, findAppPaths, XCRUN_TIMEOUT, readXcodePlist } from './helpers.js';
|
|
52
7
|
const DEFAULT_NUMBER_OF_RETRIES = 2;
|
|
53
8
|
const XCODE_BUNDLE_ID = 'com.apple.dt.Xcode';
|
|
54
|
-
const log =
|
|
9
|
+
const log = logger.getLogger('Xcode');
|
|
55
10
|
/**
|
|
56
11
|
* Retrieves the full path to Xcode Developer subfolder via xcode-select
|
|
57
12
|
*
|
|
@@ -59,26 +14,26 @@ const log = support_1.logger.getLogger('Xcode');
|
|
|
59
14
|
* @returns Full path to Xcode Developer subfolder
|
|
60
15
|
* @throws {Error} If it is not possible to retrieve a proper path
|
|
61
16
|
*/
|
|
62
|
-
async function getPathFromXcodeSelect(timeout =
|
|
17
|
+
export async function getPathFromXcodeSelect(timeout = XCRUN_TIMEOUT) {
|
|
63
18
|
const generateErrorMessage = async (prefix) => {
|
|
64
|
-
const xcodePaths = await
|
|
19
|
+
const xcodePaths = await findAppPaths(XCODE_BUNDLE_ID);
|
|
65
20
|
if (!xcodePaths.length) {
|
|
66
21
|
return `${prefix}. Consider installing Xcode to address this issue.`;
|
|
67
22
|
}
|
|
68
|
-
const proposals = xcodePaths.map((p) => ` sudo xcode-select -s "${
|
|
23
|
+
const proposals = xcodePaths.map((p) => ` sudo xcode-select -s "${path.join(p, 'Contents', 'Developer')}"`);
|
|
69
24
|
return (`${prefix}. ` +
|
|
70
25
|
`Consider running${proposals.length > 1 ? ' any of' : ''}:\n${proposals.join('\n')}\nto address this issue.`);
|
|
71
26
|
};
|
|
72
27
|
let stdout;
|
|
73
28
|
try {
|
|
74
|
-
({ stdout } = await
|
|
29
|
+
({ stdout } = await exec('xcode-select', ['--print-path'], { timeout }));
|
|
75
30
|
}
|
|
76
31
|
catch (e) {
|
|
77
32
|
const stderr = e && typeof e === 'object' && 'stderr' in e ? String(e.stderr) : '';
|
|
78
33
|
const message = e instanceof Error ? e.message : String(e);
|
|
79
34
|
const msg = `Cannot determine the path to Xcode by running 'xcode-select -p' command. ` +
|
|
80
35
|
`Original error: ${stderr || message}`;
|
|
81
|
-
throw new Error(msg);
|
|
36
|
+
throw new Error(msg, { cause: e });
|
|
82
37
|
}
|
|
83
38
|
// trim and remove trailing slash
|
|
84
39
|
const developerRoot = String(stdout).replace(/\/$/, '').trim();
|
|
@@ -87,7 +42,7 @@ async function getPathFromXcodeSelect(timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
|
87
42
|
throw new Error(msg);
|
|
88
43
|
}
|
|
89
44
|
// xcode-select might also return a path to command line tools
|
|
90
|
-
const { CFBundleIdentifier } = await
|
|
45
|
+
const { CFBundleIdentifier } = await readXcodePlist(developerRoot);
|
|
91
46
|
if (CFBundleIdentifier === XCODE_BUNDLE_ID) {
|
|
92
47
|
return developerRoot;
|
|
93
48
|
}
|
|
@@ -101,12 +56,12 @@ async function getPathFromXcodeSelect(timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
|
101
56
|
* @throws {Error} If it is not possible to retrieve a proper path
|
|
102
57
|
* @privateRemarks This method assumes `DEVELOPER_DIR` is defined.
|
|
103
58
|
*/
|
|
104
|
-
async function getPathFromDeveloperDir() {
|
|
59
|
+
export async function getPathFromDeveloperDir() {
|
|
105
60
|
const developerRoot = process.env.DEVELOPER_DIR;
|
|
106
61
|
if (!developerRoot) {
|
|
107
62
|
throw new Error('DEVELOPER_DIR environment variable is not set');
|
|
108
63
|
}
|
|
109
|
-
const { CFBundleIdentifier } = await
|
|
64
|
+
const { CFBundleIdentifier } = await readXcodePlist(developerRoot);
|
|
110
65
|
if (CFBundleIdentifier === XCODE_BUNDLE_ID) {
|
|
111
66
|
return developerRoot;
|
|
112
67
|
}
|
|
@@ -121,8 +76,8 @@ async function getPathFromDeveloperDir() {
|
|
|
121
76
|
* @returns Full path to Xcode Developer subfolder timeout
|
|
122
77
|
* @throws {Error} If there was an error while retrieving the path.
|
|
123
78
|
*/
|
|
124
|
-
|
|
125
|
-
async function getVersion(parse = false, retries = DEFAULT_NUMBER_OF_RETRIES, timeout =
|
|
79
|
+
export const getPath = util.memoize((timeout = XCRUN_TIMEOUT) => process.env.DEVELOPER_DIR ? getPathFromDeveloperDir() : getPathFromXcodeSelect(timeout));
|
|
80
|
+
export async function getVersion(parse = false, retries = DEFAULT_NUMBER_OF_RETRIES, timeout = XCRUN_TIMEOUT) {
|
|
126
81
|
const version = (await getVersionMemoized(retries, timeout));
|
|
127
82
|
// xcode version strings are not exactly semver string: patch versions of 0
|
|
128
83
|
// are removed (e.g., '10.0.0' => '10.0')
|
|
@@ -149,16 +104,15 @@ async function getVersion(parse = false, retries = DEFAULT_NUMBER_OF_RETRIES, ti
|
|
|
149
104
|
* which is supplied with Command Line Tools. `null` is returned
|
|
150
105
|
* if CLT are not installed.
|
|
151
106
|
*/
|
|
152
|
-
async function getClangVersion() {
|
|
107
|
+
export async function getClangVersion() {
|
|
153
108
|
try {
|
|
154
|
-
await
|
|
109
|
+
await fs.which('clang');
|
|
155
110
|
}
|
|
156
111
|
catch {
|
|
157
|
-
log.info('Cannot find clang executable on the local system. '
|
|
158
|
-
'Are Xcode Command Line Tools installed?');
|
|
112
|
+
log.info('Cannot find clang executable on the local system. Are Xcode Command Line Tools installed?');
|
|
159
113
|
return null;
|
|
160
114
|
}
|
|
161
|
-
const { stdout } = await
|
|
115
|
+
const { stdout } = await exec('clang', ['--version']);
|
|
162
116
|
const match = /clang-([0-9.]+)/.exec(stdout);
|
|
163
117
|
if (!match) {
|
|
164
118
|
log.info(`Cannot parse clang version from ${stdout}`);
|
|
@@ -173,9 +127,9 @@ async function getClangVersion() {
|
|
|
173
127
|
* @returns The SDK version
|
|
174
128
|
* @throws {Error} If the SDK version number cannot be determined
|
|
175
129
|
*/
|
|
176
|
-
async function getMaxIOSSDKWithoutRetry(timeout =
|
|
130
|
+
export async function getMaxIOSSDKWithoutRetry(timeout = XCRUN_TIMEOUT) {
|
|
177
131
|
const args = ['--sdk', 'iphonesimulator', '--show-sdk-version'];
|
|
178
|
-
const { stdout } = await
|
|
132
|
+
const { stdout } = await runXcrunCommand(args, timeout);
|
|
179
133
|
const sdkVersion = stdout.trim();
|
|
180
134
|
const match = /\d.\d/.exec(stdout);
|
|
181
135
|
if (!match) {
|
|
@@ -191,8 +145,8 @@ async function getMaxIOSSDKWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
|
191
145
|
* @returns The SDK version
|
|
192
146
|
* @throws {Error} If the SDK version number cannot be determined
|
|
193
147
|
*/
|
|
194
|
-
|
|
195
|
-
return
|
|
148
|
+
export const getMaxIOSSDK = util.memoize(function getMaxIOSSDK(retries = DEFAULT_NUMBER_OF_RETRIES, timeout = XCRUN_TIMEOUT) {
|
|
149
|
+
return retry(retries, getMaxIOSSDKWithoutRetry, timeout);
|
|
196
150
|
});
|
|
197
151
|
/**
|
|
198
152
|
* Retrieves the maximum version of tvOS SDK supported by the installed Xcode
|
|
@@ -201,9 +155,9 @@ exports.getMaxIOSSDK = support_1.util.memoize(function getMaxIOSSDK(retries = DE
|
|
|
201
155
|
* @returns The SDK version
|
|
202
156
|
* @throws {Error} If the SDK version number cannot be determined
|
|
203
157
|
*/
|
|
204
|
-
async function getMaxTVOSSDKWithoutRetry(timeout =
|
|
158
|
+
export async function getMaxTVOSSDKWithoutRetry(timeout = XCRUN_TIMEOUT) {
|
|
205
159
|
const args = ['--sdk', 'appletvsimulator', '--show-sdk-version'];
|
|
206
|
-
const { stdout } = await
|
|
160
|
+
const { stdout } = await runXcrunCommand(args, timeout);
|
|
207
161
|
const sdkVersion = stdout.trim();
|
|
208
162
|
if (isNaN(parseFloat(sdkVersion))) {
|
|
209
163
|
throw new Error(`xcrun returned a non-numeric tvOS SDK version: '${sdkVersion}'`);
|
|
@@ -218,8 +172,8 @@ async function getMaxTVOSSDKWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
|
218
172
|
* @returns The SDK version
|
|
219
173
|
* @throws {Error} If the SDK version number cannot be determined
|
|
220
174
|
*/
|
|
221
|
-
|
|
222
|
-
return (await
|
|
175
|
+
export const getMaxTVOSSDK = util.memoize(async function getMaxTVOSSDK(retries = DEFAULT_NUMBER_OF_RETRIES, timeout = XCRUN_TIMEOUT) {
|
|
176
|
+
return (await retry(retries, getMaxTVOSSDKWithoutRetry, timeout));
|
|
223
177
|
});
|
|
224
178
|
// Private helper functions
|
|
225
179
|
/**
|
|
@@ -229,10 +183,10 @@ exports.getMaxTVOSSDK = support_1.util.memoize(async function getMaxTVOSSDK(retr
|
|
|
229
183
|
* @returns Xcode version
|
|
230
184
|
* @throws {Error} If there was a failure while retrieving the version
|
|
231
185
|
*/
|
|
232
|
-
async function getVersionWithoutRetry(timeout =
|
|
233
|
-
const developerPath = await
|
|
186
|
+
async function getVersionWithoutRetry(timeout = XCRUN_TIMEOUT) {
|
|
187
|
+
const developerPath = await getPath(timeout);
|
|
234
188
|
// we want to read the CFBundleShortVersionString from Xcode's plist.
|
|
235
|
-
const { CFBundleShortVersionString } = await
|
|
189
|
+
const { CFBundleShortVersionString } = await readXcodePlist(developerPath);
|
|
236
190
|
return semver.coerce(CFBundleShortVersionString);
|
|
237
191
|
}
|
|
238
192
|
/**
|
|
@@ -243,7 +197,7 @@ async function getVersionWithoutRetry(timeout = helpers_1.XCRUN_TIMEOUT) {
|
|
|
243
197
|
* @returns Xcode version
|
|
244
198
|
* @throws {Error} If there was a failure while retrieving the version
|
|
245
199
|
*/
|
|
246
|
-
const getVersionMemoized =
|
|
247
|
-
return
|
|
200
|
+
const getVersionMemoized = util.memoize(function getVersionMemoized(retries = DEFAULT_NUMBER_OF_RETRIES, timeout = XCRUN_TIMEOUT) {
|
|
201
|
+
return retry(retries, getVersionWithoutRetry, timeout);
|
|
248
202
|
});
|
|
249
203
|
//# sourceMappingURL=xcode.js.map
|
package/build/lib/xcode.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xcode.js","sourceRoot":"","sources":["../../lib/xcode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file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;IAC7C,qEAAqE;IACrE,MAAM,EAAC,0BAA0B,EAAC,GAAG,MAAM,cAAc,CAAC,aAAa,CAAC,CAAC;IACzE,OAAO,MAAM,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC;AACnD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,kBAAkB,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,kBAAkB,CACjE,UAAkB,yBAAyB,EAC3C,UAAkB,aAAa;IAE/B,OAAO,KAAK,CAAC,OAAO,EAAE,sBAAsB,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC,CAAC,CAAC"}
|
package/lib/helpers.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
|
|
3
|
+
import {fs, plist} from '@appium/support';
|
|
1
4
|
import {exec} from 'teen_process';
|
|
2
5
|
import type {TeenProcessExecResult} from 'teen_process';
|
|
3
|
-
import {fs, plist} from '@appium/support';
|
|
4
|
-
import path from 'node:path';
|
|
5
6
|
|
|
6
7
|
export const XCRUN_TIMEOUT = 15000;
|
|
7
8
|
|
|
@@ -22,10 +23,7 @@ export async function runXcrunCommand(
|
|
|
22
23
|
} catch (err) {
|
|
23
24
|
if (err instanceof Error) {
|
|
24
25
|
// the true error can be hidden within the stderr
|
|
25
|
-
const stderr =
|
|
26
|
-
err && typeof err === 'object' && 'stderr' in err
|
|
27
|
-
? String((err as {stderr: unknown}).stderr)
|
|
28
|
-
: '';
|
|
26
|
+
const stderr = err && typeof err === 'object' && 'stderr' in err ? String((err as {stderr: unknown}).stderr) : '';
|
|
29
27
|
if (stderr) {
|
|
30
28
|
err.message = `${err.message}: ${stderr}`;
|
|
31
29
|
}
|
package/lib/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import {getPath, getVersion, getMaxIOSSDK, getMaxTVOSSDK, getClangVersion} from './xcode';
|
|
1
|
+
import {getPath, getVersion, getMaxIOSSDK, getMaxTVOSSDK, getClangVersion} from './xcode.js';
|
|
3
2
|
|
|
4
3
|
const xcode = {
|
|
5
4
|
getPath,
|
|
@@ -12,4 +11,4 @@ const xcode = {
|
|
|
12
11
|
export {getPath, getVersion, getMaxIOSSDK, getMaxTVOSSDK, getClangVersion};
|
|
13
12
|
export default xcode;
|
|
14
13
|
|
|
15
|
-
export type {XcodeVersion} from './types';
|
|
14
|
+
export type {XcodeVersion} from './types.js';
|
package/lib/types.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
export interface XcodeVersion {
|
|
2
|
+
/** The Xcode version as a string, e.g. '10.0' or '10.0.1' */
|
|
2
3
|
versionString: string;
|
|
4
|
+
/** The Xcode version as a float, e.g. 10.0 or 10.1 */
|
|
3
5
|
versionFloat: number;
|
|
6
|
+
/** The major version number, e.g. 10 */
|
|
4
7
|
major: number;
|
|
8
|
+
/** The minor version number, e.g. 1 */
|
|
5
9
|
minor: number;
|
|
10
|
+
/** The patch version number, if present in the version string */
|
|
6
11
|
patch?: number;
|
|
12
|
+
/** Returns {@link versionString} */
|
|
7
13
|
toString(): string;
|
|
8
14
|
}
|
package/lib/xcode.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {fs, logger, util} from '@appium/support';
|
|
2
1
|
import path from 'node:path';
|
|
2
|
+
|
|
3
|
+
import {fs, logger, util} from '@appium/support';
|
|
3
4
|
import {retry} from 'asyncbox';
|
|
4
|
-
import {exec} from 'teen_process';
|
|
5
5
|
import * as semver from 'semver';
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import {exec} from 'teen_process';
|
|
7
|
+
|
|
8
|
+
import {runXcrunCommand, findAppPaths, XCRUN_TIMEOUT, readXcodePlist} from './helpers.js';
|
|
9
|
+
import type {XcodeVersion} from './types.js';
|
|
8
10
|
|
|
9
11
|
const DEFAULT_NUMBER_OF_RETRIES = 2;
|
|
10
12
|
const XCODE_BUNDLE_ID = 'com.apple.dt.Xcode';
|
|
@@ -25,9 +27,7 @@ export async function getPathFromXcodeSelect(timeout: number = XCRUN_TIMEOUT): P
|
|
|
25
27
|
return `${prefix}. Consider installing Xcode to address this issue.`;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
const proposals = xcodePaths.map(
|
|
29
|
-
(p) => ` sudo xcode-select -s "${path.join(p, 'Contents', 'Developer')}"`,
|
|
30
|
-
);
|
|
30
|
+
const proposals = xcodePaths.map((p) => ` sudo xcode-select -s "${path.join(p, 'Contents', 'Developer')}"`);
|
|
31
31
|
return (
|
|
32
32
|
`${prefix}. ` +
|
|
33
33
|
`Consider running${proposals.length > 1 ? ' any of' : ''}:\n${proposals.join('\n')}\nto address this issue.`
|
|
@@ -38,13 +38,12 @@ export async function getPathFromXcodeSelect(timeout: number = XCRUN_TIMEOUT): P
|
|
|
38
38
|
try {
|
|
39
39
|
({stdout} = await exec('xcode-select', ['--print-path'], {timeout}));
|
|
40
40
|
} catch (e) {
|
|
41
|
-
const stderr =
|
|
42
|
-
e && typeof e === 'object' && 'stderr' in e ? String((e as {stderr: unknown}).stderr) : '';
|
|
41
|
+
const stderr = e && typeof e === 'object' && 'stderr' in e ? String((e as {stderr: unknown}).stderr) : '';
|
|
43
42
|
const message = e instanceof Error ? e.message : String(e);
|
|
44
43
|
const msg =
|
|
45
44
|
`Cannot determine the path to Xcode by running 'xcode-select -p' command. ` +
|
|
46
45
|
`Original error: ${stderr || message}`;
|
|
47
|
-
throw new Error(msg);
|
|
46
|
+
throw new Error(msg, {cause: e});
|
|
48
47
|
}
|
|
49
48
|
// trim and remove trailing slash
|
|
50
49
|
const developerRoot = String(stdout).replace(/\/$/, '').trim();
|
|
@@ -93,8 +92,9 @@ export async function getPathFromDeveloperDir(): Promise<string> {
|
|
|
93
92
|
* @returns Full path to Xcode Developer subfolder timeout
|
|
94
93
|
* @throws {Error} If there was an error while retrieving the path.
|
|
95
94
|
*/
|
|
96
|
-
export const getPath = util.memoize(
|
|
97
|
-
|
|
95
|
+
export const getPath = util.memoize(
|
|
96
|
+
(timeout: number = XCRUN_TIMEOUT): Promise<string> =>
|
|
97
|
+
process.env.DEVELOPER_DIR ? getPathFromDeveloperDir() : getPathFromXcodeSelect(timeout),
|
|
98
98
|
);
|
|
99
99
|
|
|
100
100
|
/**
|
|
@@ -107,11 +107,7 @@ export const getPath = util.memoize((timeout: number = XCRUN_TIMEOUT): Promise<s
|
|
|
107
107
|
* @throws {Error} If there was a failure while retrieving the version
|
|
108
108
|
*/
|
|
109
109
|
export async function getVersion(parse: false, retries?: number, timeout?: number): Promise<string>;
|
|
110
|
-
export async function getVersion(
|
|
111
|
-
parse: true,
|
|
112
|
-
retries?: number,
|
|
113
|
-
timeout?: number,
|
|
114
|
-
): Promise<XcodeVersion>;
|
|
110
|
+
export async function getVersion(parse: true, retries?: number, timeout?: number): Promise<XcodeVersion>;
|
|
115
111
|
export async function getVersion(
|
|
116
112
|
parse: boolean = false,
|
|
117
113
|
retries: number = DEFAULT_NUMBER_OF_RETRIES,
|
|
@@ -149,10 +145,7 @@ export async function getClangVersion(): Promise<string | null> {
|
|
|
149
145
|
try {
|
|
150
146
|
await fs.which('clang');
|
|
151
147
|
} catch {
|
|
152
|
-
log.info(
|
|
153
|
-
'Cannot find clang executable on the local system. ' +
|
|
154
|
-
'Are Xcode Command Line Tools installed?',
|
|
155
|
-
);
|
|
148
|
+
log.info('Cannot find clang executable on the local system. Are Xcode Command Line Tools installed?');
|
|
156
149
|
return null;
|
|
157
150
|
}
|
|
158
151
|
const {stdout} = await exec('clang', ['--version']);
|
|
@@ -238,9 +231,7 @@ export const getMaxTVOSSDK = util.memoize(async function getMaxTVOSSDK(
|
|
|
238
231
|
* @returns Xcode version
|
|
239
232
|
* @throws {Error} If there was a failure while retrieving the version
|
|
240
233
|
*/
|
|
241
|
-
async function getVersionWithoutRetry(
|
|
242
|
-
timeout: number = XCRUN_TIMEOUT,
|
|
243
|
-
): Promise<semver.SemVer | null> {
|
|
234
|
+
async function getVersionWithoutRetry(timeout: number = XCRUN_TIMEOUT): Promise<semver.SemVer | null> {
|
|
244
235
|
const developerPath = await getPath(timeout);
|
|
245
236
|
// we want to read the CFBundleShortVersionString from Xcode's plist.
|
|
246
237
|
const {CFBundleShortVersionString} = await readXcodePlist(developerPath);
|
package/package.json
CHANGED
|
@@ -1,67 +1,65 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-xcode",
|
|
3
|
+
"version": "7.1.0",
|
|
3
4
|
"description": "Interact with Xcode",
|
|
4
5
|
"keywords": [
|
|
5
6
|
"appium",
|
|
6
7
|
"ios",
|
|
7
8
|
"xcode"
|
|
8
9
|
],
|
|
9
|
-
"
|
|
10
|
-
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/appium/appium-xcode/issues"
|
|
12
|
+
},
|
|
11
13
|
"license": "Apache-2.0",
|
|
14
|
+
"author": "Appium Contributors",
|
|
12
15
|
"repository": {
|
|
13
16
|
"type": "git",
|
|
14
17
|
"url": "https://github.com/appium/appium-xcode.git"
|
|
15
18
|
},
|
|
16
|
-
"bugs": {
|
|
17
|
-
"url": "https://github.com/appium/appium-xcode/issues"
|
|
18
|
-
},
|
|
19
|
-
"engines": {
|
|
20
|
-
"node": "^20.19.0 || ^22.12.0 || >=24.0.0",
|
|
21
|
-
"npm": ">=10"
|
|
22
|
-
},
|
|
23
|
-
"main": "./build/lib/index.js",
|
|
24
|
-
"types": "./build/lib/index.d.ts",
|
|
25
19
|
"files": [
|
|
26
20
|
"lib",
|
|
27
21
|
"build/lib",
|
|
28
22
|
"CHANGELOG.md"
|
|
29
23
|
],
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
24
|
+
"type": "module",
|
|
25
|
+
"main": "./build/lib/index.js",
|
|
26
|
+
"types": "./build/lib/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./build/lib/index.d.ts",
|
|
30
|
+
"import": "./build/lib/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./package.json": "./package.json"
|
|
35
33
|
},
|
|
36
34
|
"scripts": {
|
|
37
35
|
"build": "tsc -b",
|
|
38
36
|
"clean": "npm run build -- --clean",
|
|
39
37
|
"rebuild": "npm run clean; npm run build",
|
|
40
38
|
"dev": "npm run build -- --watch",
|
|
41
|
-
"lint": "
|
|
42
|
-
"lint:fix": "
|
|
43
|
-
"format": "
|
|
44
|
-
"format:check": "
|
|
39
|
+
"lint": "oxlint -c oxlint.config.mjs .",
|
|
40
|
+
"lint:fix": "oxlint -c oxlint.config.mjs --fix .",
|
|
41
|
+
"format": "oxfmt -c oxfmt.config.mjs .",
|
|
42
|
+
"format:check": "oxfmt -c oxfmt.config.mjs --check .",
|
|
45
43
|
"prepare": "npm run build",
|
|
46
|
-
"test": "node --test --test-timeout=60000 \"./build/test/unit/**/*.spec.js\"",
|
|
47
|
-
"e2e-test": "node --test --test-force-exit --test-concurrency=1 --test-timeout=300000 \"./build/test/e2e/**/*.spec.js\""
|
|
44
|
+
"test": "node --enable-source-maps --test --test-timeout=60000 \"./build/test/unit/**/*.spec.js\"",
|
|
45
|
+
"e2e-test": "node --enable-source-maps --test --test-force-exit --test-concurrency=1 --test-timeout=300000 \"./build/test/e2e/**/*.spec.js\""
|
|
48
46
|
},
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@appium/support": "^7.2.2",
|
|
49
|
+
"asyncbox": "^6.0.1",
|
|
50
|
+
"semver": "^7.0.0",
|
|
51
|
+
"teen_process": "^4.0.4"
|
|
53
52
|
},
|
|
54
53
|
"devDependencies": {
|
|
55
|
-
"@appium/
|
|
56
|
-
"@appium/
|
|
54
|
+
"@appium/oxc-config": "^1.1.0",
|
|
55
|
+
"@appium/semantic-release-config": "^1.1.0",
|
|
56
|
+
"@appium/tsconfig": "^1.2.0",
|
|
57
57
|
"@appium/types": "^1.0.0-rc.1",
|
|
58
|
-
"@semantic-release/changelog": "^6.0.1",
|
|
59
|
-
"@semantic-release/git": "^10.0.1",
|
|
60
58
|
"@types/node": "^26.0.0",
|
|
61
|
-
"@types/semver": "^7.7.1"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
"
|
|
59
|
+
"@types/semver": "^7.7.1"
|
|
60
|
+
},
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": "^20.19.0 || ^22.12.0 || >=24.0.0",
|
|
63
|
+
"npm": ">=10"
|
|
66
64
|
}
|
|
67
65
|
}
|