node-simctl 8.0.9 → 8.1.1
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 +12 -0
- package/build/index.d.ts +2 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js.map +1 -1
- package/build/lib/helpers.d.ts +17 -9
- package/build/lib/helpers.d.ts.map +1 -1
- package/build/lib/helpers.js +50 -4
- package/build/lib/helpers.js.map +1 -1
- package/build/lib/logger.d.ts +2 -3
- package/build/lib/logger.d.ts.map +1 -1
- package/build/lib/logger.js +3 -5
- package/build/lib/logger.js.map +1 -1
- package/build/lib/simctl.d.ts +82 -188
- package/build/lib/simctl.d.ts.map +1 -1
- package/build/lib/simctl.js +98 -150
- package/build/lib/simctl.js.map +1 -1
- package/build/lib/subcommands/addmedia.d.ts +14 -16
- package/build/lib/subcommands/addmedia.d.ts.map +1 -1
- package/build/lib/subcommands/addmedia.js +5 -7
- package/build/lib/subcommands/addmedia.js.map +1 -1
- package/build/lib/subcommands/appinfo.d.ts +13 -45
- package/build/lib/subcommands/appinfo.d.ts.map +1 -1
- package/build/lib/subcommands/appinfo.js +31 -42
- package/build/lib/subcommands/appinfo.js.map +1 -1
- package/build/lib/subcommands/boot.d.ts +9 -12
- package/build/lib/subcommands/boot.d.ts.map +1 -1
- package/build/lib/subcommands/boot.js +5 -40
- package/build/lib/subcommands/boot.js.map +1 -1
- package/build/lib/subcommands/bootstatus.d.ts +16 -56
- package/build/lib/subcommands/bootstatus.d.ts.map +1 -1
- package/build/lib/subcommands/bootstatus.js +8 -22
- package/build/lib/subcommands/bootstatus.js.map +1 -1
- package/build/lib/subcommands/create.d.ts +15 -34
- package/build/lib/subcommands/create.d.ts.map +1 -1
- package/build/lib/subcommands/create.js +23 -66
- package/build/lib/subcommands/create.js.map +1 -1
- package/build/lib/subcommands/delete.d.ts +9 -12
- package/build/lib/subcommands/delete.d.ts.map +1 -1
- package/build/lib/subcommands/delete.js +3 -5
- package/build/lib/subcommands/delete.js.map +1 -1
- package/build/lib/subcommands/erase.d.ts +12 -15
- package/build/lib/subcommands/erase.d.ts.map +1 -1
- package/build/lib/subcommands/erase.js +4 -6
- package/build/lib/subcommands/erase.js.map +1 -1
- package/build/lib/subcommands/get_app_container.d.ts +19 -22
- package/build/lib/subcommands/get_app_container.d.ts.map +1 -1
- package/build/lib/subcommands/get_app_container.js +6 -8
- package/build/lib/subcommands/get_app_container.js.map +1 -1
- package/build/lib/subcommands/getenv.d.ts +11 -14
- package/build/lib/subcommands/getenv.d.ts.map +1 -1
- package/build/lib/subcommands/getenv.js +5 -7
- package/build/lib/subcommands/getenv.js.map +1 -1
- package/build/lib/subcommands/install.d.ts +12 -15
- package/build/lib/subcommands/install.d.ts.map +1 -1
- package/build/lib/subcommands/install.js +4 -6
- package/build/lib/subcommands/install.js.map +1 -1
- package/build/lib/subcommands/io.d.ts +12 -15
- package/build/lib/subcommands/io.d.ts.map +1 -1
- package/build/lib/subcommands/io.js +4 -6
- package/build/lib/subcommands/io.js.map +1 -1
- package/build/lib/subcommands/keychain.d.ts +37 -55
- package/build/lib/subcommands/keychain.d.ts.map +1 -1
- package/build/lib/subcommands/keychain.js +16 -25
- package/build/lib/subcommands/keychain.js.map +1 -1
- package/build/lib/subcommands/launch.d.ts +16 -19
- package/build/lib/subcommands/launch.d.ts.map +1 -1
- package/build/lib/subcommands/launch.js +9 -11
- package/build/lib/subcommands/launch.js.map +1 -1
- package/build/lib/subcommands/list.d.ts +94 -125
- package/build/lib/subcommands/list.d.ts.map +1 -1
- package/build/lib/subcommands/list.js +34 -92
- package/build/lib/subcommands/list.js.map +1 -1
- package/build/lib/subcommands/location.d.ts +18 -22
- package/build/lib/subcommands/location.d.ts.map +1 -1
- package/build/lib/subcommands/location.js +11 -13
- package/build/lib/subcommands/location.js.map +1 -1
- package/build/lib/subcommands/openurl.d.ts +15 -17
- package/build/lib/subcommands/openurl.d.ts.map +1 -1
- package/build/lib/subcommands/openurl.js +5 -7
- package/build/lib/subcommands/openurl.js.map +1 -1
- package/build/lib/subcommands/pbcopy.d.ts +14 -17
- package/build/lib/subcommands/pbcopy.d.ts.map +1 -1
- package/build/lib/subcommands/pbcopy.js +5 -7
- package/build/lib/subcommands/pbcopy.js.map +1 -1
- package/build/lib/subcommands/pbpaste.d.ts +14 -17
- package/build/lib/subcommands/pbpaste.d.ts.map +1 -1
- package/build/lib/subcommands/pbpaste.js +5 -7
- package/build/lib/subcommands/pbpaste.js.map +1 -1
- package/build/lib/subcommands/privacy.d.ts +52 -57
- package/build/lib/subcommands/privacy.d.ts.map +1 -1
- package/build/lib/subcommands/privacy.js +15 -17
- package/build/lib/subcommands/privacy.js.map +1 -1
- package/build/lib/subcommands/push.d.ts +22 -25
- package/build/lib/subcommands/push.d.ts.map +1 -1
- package/build/lib/subcommands/push.js +5 -7
- package/build/lib/subcommands/push.js.map +1 -1
- package/build/lib/subcommands/shutdown.d.ts +9 -12
- package/build/lib/subcommands/shutdown.d.ts.map +1 -1
- package/build/lib/subcommands/shutdown.js +5 -40
- package/build/lib/subcommands/shutdown.js.map +1 -1
- package/build/lib/subcommands/spawn.d.ts +24 -27
- package/build/lib/subcommands/spawn.d.ts.map +1 -1
- package/build/lib/subcommands/spawn.js +12 -14
- package/build/lib/subcommands/spawn.js.map +1 -1
- package/build/lib/subcommands/terminate.d.ts +12 -15
- package/build/lib/subcommands/terminate.d.ts.map +1 -1
- package/build/lib/subcommands/terminate.js +4 -6
- package/build/lib/subcommands/terminate.js.map +1 -1
- package/build/lib/subcommands/ui.d.ts +97 -105
- package/build/lib/subcommands/ui.d.ts.map +1 -1
- package/build/lib/subcommands/ui.js +24 -26
- package/build/lib/subcommands/ui.js.map +1 -1
- package/build/lib/subcommands/uninstall.d.ts +13 -16
- package/build/lib/subcommands/uninstall.d.ts.map +1 -1
- package/build/lib/subcommands/uninstall.js +4 -6
- package/build/lib/subcommands/uninstall.js.map +1 -1
- package/build/lib/types.d.ts +231 -0
- package/build/lib/types.d.ts.map +1 -0
- package/build/lib/types.js +3 -0
- package/build/lib/types.js.map +1 -0
- package/index.ts +13 -0
- package/lib/helpers.ts +81 -0
- package/lib/{logger.js → logger.ts} +2 -5
- package/lib/simctl.ts +221 -0
- package/lib/subcommands/{addmedia.js → addmedia.ts} +6 -8
- package/lib/subcommands/appinfo.ts +39 -0
- package/lib/subcommands/{boot.js → boot.ts} +5 -10
- package/lib/subcommands/bootstatus.ts +108 -0
- package/lib/subcommands/{create.js → create.ts} +29 -35
- package/lib/subcommands/{delete.js → delete.ts} +3 -5
- package/lib/subcommands/{erase.js → erase.ts} +4 -7
- package/lib/subcommands/{get_app_container.js → get_app_container.ts} +10 -8
- package/lib/subcommands/{getenv.js → getenv.ts} +5 -7
- package/lib/subcommands/{install.js → install.ts} +4 -6
- package/lib/subcommands/{io.js → io.ts} +4 -7
- package/lib/subcommands/{keychain.js → keychain.ts} +30 -32
- package/lib/subcommands/{launch.js → launch.ts} +9 -12
- package/lib/subcommands/{list.js → list.ts} +67 -60
- package/lib/subcommands/{location.js → location.ts} +15 -14
- package/lib/subcommands/{openurl.js → openurl.ts} +6 -7
- package/lib/subcommands/{pbcopy.js → pbcopy.ts} +11 -8
- package/lib/subcommands/{pbpaste.js → pbpaste.ts} +5 -7
- package/lib/subcommands/{privacy.js → privacy.ts} +13 -17
- package/lib/subcommands/{push.js → push.ts} +5 -8
- package/lib/subcommands/{shutdown.js → shutdown.ts} +5 -8
- package/lib/subcommands/{spawn.js → spawn.ts} +21 -17
- package/lib/subcommands/{terminate.js → terminate.ts} +4 -6
- package/lib/subcommands/{ui.js → ui.ts} +19 -28
- package/lib/subcommands/{uninstall.js → uninstall.ts} +4 -6
- package/lib/types.ts +243 -0
- package/package.json +2 -3
- package/index.js +0 -4
- package/lib/helpers.js +0 -37
- package/lib/simctl.js +0 -299
- package/lib/subcommands/appinfo.js +0 -51
- package/lib/subcommands/bootstatus.js +0 -119
|
@@ -3,39 +3,42 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getAppearance = getAppearance;
|
|
7
|
+
exports.setAppearance = setAppearance;
|
|
8
|
+
exports.getIncreaseContrast = getIncreaseContrast;
|
|
9
|
+
exports.setIncreaseContrast = setIncreaseContrast;
|
|
10
|
+
exports.getContentSize = getContentSize;
|
|
11
|
+
exports.setContentSize = setContentSize;
|
|
6
12
|
const lodash_1 = __importDefault(require("lodash"));
|
|
7
|
-
const commands = {};
|
|
8
13
|
/**
|
|
9
14
|
* Retrieves the current UI appearance value from the given simulator
|
|
10
15
|
*
|
|
11
16
|
* @since Xcode 11.4 SDK
|
|
12
|
-
* @
|
|
13
|
-
* @return {Promise<string>} the appearance value, for example 'light' or 'dark'
|
|
17
|
+
* @return the appearance value, for example 'light' or 'dark'
|
|
14
18
|
* @throws {Error} if the current SDK version does not support the command
|
|
15
19
|
* or there was an error while getting the value
|
|
16
20
|
* @throws {Error} If the `udid` instance property is unset
|
|
17
21
|
*/
|
|
18
|
-
|
|
22
|
+
async function getAppearance() {
|
|
19
23
|
const { stdout } = await this.exec('ui', {
|
|
20
24
|
args: [this.requireUdid('ui'), 'appearance'],
|
|
21
25
|
});
|
|
22
26
|
return lodash_1.default.trim(stdout);
|
|
23
|
-
}
|
|
27
|
+
}
|
|
24
28
|
/**
|
|
25
29
|
* Sets the UI appearance to the given style
|
|
26
30
|
*
|
|
27
31
|
* @since Xcode 11.4 SDK
|
|
28
|
-
* @
|
|
29
|
-
* @param {string} appearance valid appearance value, for example 'light' or 'dark'
|
|
32
|
+
* @param appearance valid appearance value, for example 'light' or 'dark'
|
|
30
33
|
* @throws {Error} if the current SDK version does not support the command
|
|
31
34
|
* or there was an error while getting the value
|
|
32
35
|
* @throws {Error} If the `udid` instance property is unset
|
|
33
36
|
*/
|
|
34
|
-
|
|
37
|
+
async function setAppearance(appearance) {
|
|
35
38
|
await this.exec('ui', {
|
|
36
39
|
args: [this.requireUdid('ui'), 'appearance', appearance],
|
|
37
40
|
});
|
|
38
|
-
}
|
|
41
|
+
}
|
|
39
42
|
/**
|
|
40
43
|
* Retrieves the current increase contrast configuration value from the given simulator.
|
|
41
44
|
* The value could be:
|
|
@@ -45,20 +48,19 @@ commands.setAppearance = async function setAppearance(appearance) {
|
|
|
45
48
|
* - unknown: The current setting is unknown or there was an error detecting it.
|
|
46
49
|
*
|
|
47
50
|
* @since Xcode 15 (but lower xcode could have this command)
|
|
48
|
-
* @
|
|
49
|
-
* @return {Promise<string>} the contrast configuration value.
|
|
51
|
+
* @return the contrast configuration value.
|
|
50
52
|
* Possible return value is 'enabled', 'disabled',
|
|
51
53
|
* 'unsupported' or 'unknown' with Xcode 16.2.
|
|
52
54
|
* @throws {Error} if the current SDK version does not support the command
|
|
53
55
|
* or there was an error while getting the value.
|
|
54
56
|
* @throws {Error} If the `udid` instance property is unset
|
|
55
57
|
*/
|
|
56
|
-
|
|
58
|
+
async function getIncreaseContrast() {
|
|
57
59
|
const { stdout } = await this.exec('ui', {
|
|
58
60
|
args: [this.requireUdid('ui'), 'increase_contrast'],
|
|
59
61
|
});
|
|
60
62
|
return lodash_1.default.trim(stdout);
|
|
61
|
-
}
|
|
63
|
+
}
|
|
62
64
|
/**
|
|
63
65
|
* Sets the increase constrast configuration for the given simulator.
|
|
64
66
|
* Acceptable values (with Xcode 16.2, iOS 18.1) are 'enabled' or 'disabled'
|
|
@@ -66,18 +68,17 @@ commands.getIncreaseContrast = async function getIncreaseContrast() {
|
|
|
66
68
|
* in the caller side.
|
|
67
69
|
*
|
|
68
70
|
* @since Xcode 15 (but lower xcode could have this command)
|
|
69
|
-
* @
|
|
70
|
-
* @param {string} increaseContrast valid increase constrast configuration value.
|
|
71
|
+
* @param increaseContrast valid increase constrast configuration value.
|
|
71
72
|
* Acceptable value is 'enabled' or 'disabled' with Xcode 16.2.
|
|
72
73
|
* @throws {Error} if the current SDK version does not support the command
|
|
73
74
|
* or the given value was invalid for the command.
|
|
74
75
|
* @throws {Error} If the `udid` instance property is unset
|
|
75
76
|
*/
|
|
76
|
-
|
|
77
|
+
async function setIncreaseContrast(increaseContrast) {
|
|
77
78
|
await this.exec('ui', {
|
|
78
79
|
args: [this.requireUdid('ui'), 'increase_contrast', increaseContrast],
|
|
79
80
|
});
|
|
80
|
-
}
|
|
81
|
+
}
|
|
81
82
|
/**
|
|
82
83
|
* Retrieves the current content size value from the given simulator.
|
|
83
84
|
* The value could be:
|
|
@@ -89,8 +90,7 @@ commands.setIncreaseContrast = async function setIncreaseContrast(increaseContra
|
|
|
89
90
|
* Other values: unknown, unsupported.
|
|
90
91
|
*
|
|
91
92
|
* @since Xcode 15 (but lower xcode could have this command)
|
|
92
|
-
* @
|
|
93
|
-
* @return {Promise<string>} the content size value. Possible return value is
|
|
93
|
+
* @return the content size value. Possible return value is
|
|
94
94
|
* extra-small, small, medium, large, extra-large, extra-extra-large,
|
|
95
95
|
* extra-extra-extra-large, accessibility-medium, accessibility-large,
|
|
96
96
|
* accessibility-extra-large, accessibility-extra-extra-large,
|
|
@@ -100,12 +100,12 @@ commands.setIncreaseContrast = async function setIncreaseContrast(increaseContra
|
|
|
100
100
|
* or there was an error while getting the value.
|
|
101
101
|
* @throws {Error} If the `udid` instance property is unset
|
|
102
102
|
*/
|
|
103
|
-
|
|
103
|
+
async function getContentSize() {
|
|
104
104
|
const { stdout } = await this.exec('ui', {
|
|
105
105
|
args: [this.requireUdid('ui'), 'content_size'],
|
|
106
106
|
});
|
|
107
107
|
return lodash_1.default.trim(stdout);
|
|
108
|
-
}
|
|
108
|
+
}
|
|
109
109
|
/**
|
|
110
110
|
* Sets content size for the given simulator.
|
|
111
111
|
* Acceptable values (with Xcode 16.2, iOS 18.1) are below:
|
|
@@ -119,8 +119,7 @@ commands.getContentSize = async function getContentSize() {
|
|
|
119
119
|
* in the caller side.
|
|
120
120
|
*
|
|
121
121
|
* @since Xcode 15 (but lower xcode could have this command)
|
|
122
|
-
* @
|
|
123
|
-
* @param {string} contentSizeAction valid content size or action value. Acceptable value is
|
|
122
|
+
* @param contentSizeAction valid content size or action value. Acceptable value is
|
|
124
123
|
* extra-small, small, medium, large, extra-large, extra-extra-large,
|
|
125
124
|
* extra-extra-extra-large, accessibility-medium, accessibility-large,
|
|
126
125
|
* accessibility-extra-large, accessibility-extra-extra-large,
|
|
@@ -129,10 +128,9 @@ commands.getContentSize = async function getContentSize() {
|
|
|
129
128
|
* or the given value was invalid for the command.
|
|
130
129
|
* @throws {Error} If the `udid` instance property is unset
|
|
131
130
|
*/
|
|
132
|
-
|
|
131
|
+
async function setContentSize(contentSizeAction) {
|
|
133
132
|
await this.exec('ui', {
|
|
134
133
|
args: [this.requireUdid('ui'), 'content_size', contentSizeAction],
|
|
135
134
|
});
|
|
136
|
-
}
|
|
137
|
-
exports.default = commands;
|
|
135
|
+
}
|
|
138
136
|
//# sourceMappingURL=ui.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../lib/subcommands/ui.
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../lib/subcommands/ui.ts"],"names":[],"mappings":";;;;;AAYA,sCAKC;AAWD,sCAIC;AAkBD,kDAKC;AAeD,kDAIC;AAuBD,wCAKC;AAwBD,wCAIC;AAlID,oDAAuB;AAGvB;;;;;;;;GAQG;AACI,KAAK,UAAU,aAAa;IACjC,MAAM,EAAC,MAAM,EAAC,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;QACrC,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC;KAC7C,CAAC,CAAC;IACH,OAAO,gBAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,aAAa,CAAgB,UAAkB;IACnE,MAAM,I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"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*/
|
|
15
|
-
function removeApp(this: import("../simctl").default, bundleId: string): Promise<void>;
|
|
16
|
-
}
|
|
1
|
+
import type { Simctl } from '../simctl';
|
|
2
|
+
/**
|
|
3
|
+
* Remove the particular application package from Simulator.
|
|
4
|
+
* It is required that Simulator is in _booted_ state and
|
|
5
|
+
* the application with given bundle identifier is already installed.
|
|
6
|
+
*
|
|
7
|
+
* @param bundleId - Bundle identifier of the application,
|
|
8
|
+
* which is going to be removed.
|
|
9
|
+
* @throws {Error} If the corresponding simctl subcommand command
|
|
10
|
+
* returns non-zero return code.
|
|
11
|
+
* @throws {Error} If the `udid` instance property is unset
|
|
12
|
+
*/
|
|
13
|
+
export declare function removeApp(this: Simctl, bundleId: string): Promise<void>;
|
|
17
14
|
//# sourceMappingURL=uninstall.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../../lib/subcommands/uninstall.
|
|
1
|
+
{"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../../lib/subcommands/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC;;;;;;;;;;GAUG;AACH,wBAAsB,SAAS,CAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI9E"}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.removeApp = removeApp;
|
|
4
4
|
/**
|
|
5
5
|
* Remove the particular application package from Simulator.
|
|
6
6
|
* It is required that Simulator is in _booted_ state and
|
|
7
7
|
* the application with given bundle identifier is already installed.
|
|
8
8
|
*
|
|
9
|
-
* @
|
|
10
|
-
* @param {string} bundleId - Bundle identifier of the application,
|
|
9
|
+
* @param bundleId - Bundle identifier of the application,
|
|
11
10
|
* which is going to be removed.
|
|
12
11
|
* @throws {Error} If the corresponding simctl subcommand command
|
|
13
12
|
* returns non-zero return code.
|
|
14
13
|
* @throws {Error} If the `udid` instance property is unset
|
|
15
14
|
*/
|
|
16
|
-
|
|
15
|
+
async function removeApp(bundleId) {
|
|
17
16
|
await this.exec('uninstall', {
|
|
18
17
|
args: [this.requireUdid('uninstall'), bundleId],
|
|
19
18
|
});
|
|
20
|
-
}
|
|
21
|
-
exports.default = commands;
|
|
19
|
+
}
|
|
22
20
|
//# sourceMappingURL=uninstall.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../lib/subcommands/uninstall.
|
|
1
|
+
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../lib/subcommands/uninstall.ts"],"names":[],"mappings":";;AAaA,8BAIC;AAfD;;;;;;;;;;GAUG;AACI,KAAK,UAAU,SAAS,CAAgB,QAAgB;IAC7D,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;QAC3B,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC;KAChD,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import type { SubProcess, TeenProcessExecResult } from 'teen_process';
|
|
2
|
+
/**
|
|
3
|
+
* XCRun configuration
|
|
4
|
+
*/
|
|
5
|
+
export interface XCRun {
|
|
6
|
+
/**
|
|
7
|
+
* Full path to the xcrun script
|
|
8
|
+
*/
|
|
9
|
+
path: string | null;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Options for asynchronous execution
|
|
13
|
+
*/
|
|
14
|
+
export interface AsyncExecOpts {
|
|
15
|
+
asynchronous: true;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Execution options for simctl commands
|
|
19
|
+
*/
|
|
20
|
+
export interface ExecOpts {
|
|
21
|
+
/**
|
|
22
|
+
* The list of additional subcommand arguments.
|
|
23
|
+
* It's empty by default.
|
|
24
|
+
*/
|
|
25
|
+
args?: string[];
|
|
26
|
+
/**
|
|
27
|
+
* Environment variables mapping. All these variables
|
|
28
|
+
* will be passed Simulator and used in the executing function.
|
|
29
|
+
*/
|
|
30
|
+
env?: Record<string, any>;
|
|
31
|
+
/**
|
|
32
|
+
* Set it to _false_ to throw execution errors
|
|
33
|
+
* immediately without logging any additional information.
|
|
34
|
+
*/
|
|
35
|
+
logErrors?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to execute the given command
|
|
38
|
+
* 'synchronously' or 'asynchronously'. Affects the returned result of the function.
|
|
39
|
+
*/
|
|
40
|
+
asynchronous?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Explicitly sets streams encoding for the executed
|
|
43
|
+
* command input and outputs.
|
|
44
|
+
*/
|
|
45
|
+
encoding?: string;
|
|
46
|
+
/**
|
|
47
|
+
* One or more architecture names to be enforced while
|
|
48
|
+
* executing xcrun. See https://github.com/appium/appium/issues/18966 for more details.
|
|
49
|
+
*/
|
|
50
|
+
architectures?: string | string[];
|
|
51
|
+
/**
|
|
52
|
+
* The maximum number of milliseconds
|
|
53
|
+
* to wait for single synchronous xcrun command. If not provided explicitly, then
|
|
54
|
+
* the value of execTimeout property is used by default.
|
|
55
|
+
*/
|
|
56
|
+
timeout?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Simctl instance options
|
|
60
|
+
*/
|
|
61
|
+
export interface SimctlOpts {
|
|
62
|
+
/**
|
|
63
|
+
* The xcrun properties. Currently only one property
|
|
64
|
+
* is supported, which is `path` and it by default contains `null`, which enforces
|
|
65
|
+
* the instance to automatically detect the full path to `xcrun` tool and to throw
|
|
66
|
+
* an exception if it cannot be detected. If the path is set upon instance creation
|
|
67
|
+
* then it is going to be used by `exec` and no autodetection will happen.
|
|
68
|
+
*/
|
|
69
|
+
xcrun?: XCRun;
|
|
70
|
+
/**
|
|
71
|
+
* The default maximum number of milliseconds
|
|
72
|
+
* to wait for single synchronous xcrun command.
|
|
73
|
+
*/
|
|
74
|
+
execTimeout?: number;
|
|
75
|
+
/**
|
|
76
|
+
* Whether to wire xcrun error messages
|
|
77
|
+
* into debug log before throwing them.
|
|
78
|
+
*/
|
|
79
|
+
logErrors?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* The unique identifier of the current device, which is
|
|
82
|
+
* going to be implicitly passed to all methods, which require it. It can either be set
|
|
83
|
+
* upon instance creation if it is already known in advance or later when/if needed via the
|
|
84
|
+
* corresponding instance setter.
|
|
85
|
+
*/
|
|
86
|
+
udid?: string | null;
|
|
87
|
+
/**
|
|
88
|
+
* Full path to the set of devices that you want to manage.
|
|
89
|
+
* By default this path usually equals to ~/Library/Developer/CoreSimulator/Devices
|
|
90
|
+
*/
|
|
91
|
+
devicesSetPath?: string | null;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Device information
|
|
95
|
+
*/
|
|
96
|
+
export interface DeviceInfo {
|
|
97
|
+
/**
|
|
98
|
+
* The device name.
|
|
99
|
+
*/
|
|
100
|
+
name: string;
|
|
101
|
+
/**
|
|
102
|
+
* The device UDID.
|
|
103
|
+
*/
|
|
104
|
+
udid: string;
|
|
105
|
+
/**
|
|
106
|
+
* The current Simulator state, for example 'booted' or 'shutdown'.
|
|
107
|
+
*/
|
|
108
|
+
state: string;
|
|
109
|
+
/**
|
|
110
|
+
* The SDK version, for example '10.3'.
|
|
111
|
+
*/
|
|
112
|
+
sdk: string;
|
|
113
|
+
/**
|
|
114
|
+
* The platform name, for example 'iOS'.
|
|
115
|
+
*/
|
|
116
|
+
platform: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Simulator creation options
|
|
120
|
+
*/
|
|
121
|
+
export interface SimCreationOpts {
|
|
122
|
+
/**
|
|
123
|
+
* Platform name in order to specify runtime such as 'iOS', 'tvOS', 'watchOS'
|
|
124
|
+
*/
|
|
125
|
+
platform?: string;
|
|
126
|
+
/**
|
|
127
|
+
* The maximum number of milliseconds to wait
|
|
128
|
+
* unit device creation is completed.
|
|
129
|
+
*/
|
|
130
|
+
timeout?: number;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Result type for exec method - either SubProcess for async or TeenProcessExecResult for sync
|
|
134
|
+
*/
|
|
135
|
+
export type ExecResult<T extends ExecOpts> = T extends AsyncExecOpts ? SubProcess : TeenProcessExecResult<string>;
|
|
136
|
+
/**
|
|
137
|
+
* Boot monitor options
|
|
138
|
+
*/
|
|
139
|
+
export interface BootMonitorOptions {
|
|
140
|
+
/**
|
|
141
|
+
* Simulator booting timeout in ms.
|
|
142
|
+
*/
|
|
143
|
+
timeout?: number;
|
|
144
|
+
/**
|
|
145
|
+
* This event is fired when data migration stage starts.
|
|
146
|
+
*/
|
|
147
|
+
onWaitingDataMigration?: () => void;
|
|
148
|
+
/**
|
|
149
|
+
* This event is fired when system app wait stage starts.
|
|
150
|
+
*/
|
|
151
|
+
onWaitingSystemApp?: () => void;
|
|
152
|
+
/**
|
|
153
|
+
* This event is fired when Simulator is fully booted.
|
|
154
|
+
*/
|
|
155
|
+
onFinished?: () => void;
|
|
156
|
+
/**
|
|
157
|
+
* This event is fired when there was an error while monitoring the booting process
|
|
158
|
+
* or when the timeout has expired.
|
|
159
|
+
*/
|
|
160
|
+
onError?: (error: Error) => void;
|
|
161
|
+
/**
|
|
162
|
+
* Whether to preboot the Simulator
|
|
163
|
+
* if this command is called and it is not already in booted or booting state.
|
|
164
|
+
*/
|
|
165
|
+
shouldPreboot?: boolean;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Certificate options
|
|
169
|
+
*/
|
|
170
|
+
export interface CertOptions {
|
|
171
|
+
/**
|
|
172
|
+
* whether the `cert` argument
|
|
173
|
+
* is the path to the certificate on the local file system or
|
|
174
|
+
* a raw certificate content
|
|
175
|
+
*/
|
|
176
|
+
raw?: boolean;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* App information returned by simctl appinfo when the app is found
|
|
180
|
+
*/
|
|
181
|
+
export interface AppInfo {
|
|
182
|
+
/**
|
|
183
|
+
* Application type (e.g., "Hidden")
|
|
184
|
+
*/
|
|
185
|
+
ApplicationType: string;
|
|
186
|
+
/**
|
|
187
|
+
* Bundle URL (file:// URL)
|
|
188
|
+
*/
|
|
189
|
+
Bundle?: string;
|
|
190
|
+
/**
|
|
191
|
+
* Bundle container URL (file:// URL)
|
|
192
|
+
*/
|
|
193
|
+
BundleContainer?: string;
|
|
194
|
+
/**
|
|
195
|
+
* Display name of the application
|
|
196
|
+
*/
|
|
197
|
+
CFBundleDisplayName: string;
|
|
198
|
+
/**
|
|
199
|
+
* Executable name
|
|
200
|
+
*/
|
|
201
|
+
CFBundleExecutable: string;
|
|
202
|
+
/**
|
|
203
|
+
* Bundle identifier
|
|
204
|
+
*/
|
|
205
|
+
CFBundleIdentifier: string;
|
|
206
|
+
/**
|
|
207
|
+
* Bundle name
|
|
208
|
+
*/
|
|
209
|
+
CFBundleName: string;
|
|
210
|
+
/**
|
|
211
|
+
* Bundle version
|
|
212
|
+
*/
|
|
213
|
+
CFBundleVersion: string | number;
|
|
214
|
+
/**
|
|
215
|
+
* Data container URL (file:// URL)
|
|
216
|
+
*/
|
|
217
|
+
DataContainer?: string;
|
|
218
|
+
/**
|
|
219
|
+
* Group containers dictionary
|
|
220
|
+
*/
|
|
221
|
+
GroupContainers?: Record<string, any>;
|
|
222
|
+
/**
|
|
223
|
+
* Path to the app bundle
|
|
224
|
+
*/
|
|
225
|
+
Path: string;
|
|
226
|
+
/**
|
|
227
|
+
* SpringBoard app tags
|
|
228
|
+
*/
|
|
229
|
+
SBAppTags?: string[];
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,IAAI,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAClC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,IAAI,EAAE,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AE,MAAM,CAAC;IAC3B;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,eAAe,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACtC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../lib/types.ts"],"names":[],"mappings":""}
|
package/index.ts
ADDED
package/lib/helpers.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as semver from 'semver';
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { Readable } from 'node:stream';
|
|
4
|
+
|
|
5
|
+
export const DEFAULT_EXEC_TIMEOUT = 10 * 60 * 1000; // ms
|
|
6
|
+
export const SIM_RUNTIME_NAME = 'com.apple.CoreSimulator.SimRuntime.';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* "Normalize" the version, since iOS uses 'major.minor' but the runtimes can
|
|
10
|
+
* be 'major.minor.patch'
|
|
11
|
+
*
|
|
12
|
+
* @param version - the string version
|
|
13
|
+
* @return The version in 'major.minor' form
|
|
14
|
+
* @throws {Error} If the version not parseable by the `semver` package
|
|
15
|
+
*/
|
|
16
|
+
export function normalizeVersion (version: string): string {
|
|
17
|
+
const semverVersion = semver.coerce(version);
|
|
18
|
+
if (!semverVersion) {
|
|
19
|
+
throw new Error(`Unable to parse version '${version}'`);
|
|
20
|
+
}
|
|
21
|
+
return `${semverVersion.major}.${semverVersion.minor}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @returns The xcrun binary name
|
|
26
|
+
*/
|
|
27
|
+
export function getXcrunBinary (): string {
|
|
28
|
+
return process.env.XCRUN_BINARY || 'xcrun';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Generate a UUID v4
|
|
33
|
+
*
|
|
34
|
+
* @returns Promise resolving to UUID string
|
|
35
|
+
*/
|
|
36
|
+
export async function uuidV4 (): Promise<string> {
|
|
37
|
+
const uuidLib = await import('uuid');
|
|
38
|
+
return uuidLib.v4();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Convert plist-style output to JSON using plutil
|
|
43
|
+
*
|
|
44
|
+
* @param plistInput - The plist-style string to convert
|
|
45
|
+
* @return Promise resolving to parsed JSON object
|
|
46
|
+
* @throws {Error} If plutil fails to convert the input
|
|
47
|
+
*/
|
|
48
|
+
export async function convertPlistToJson (plistInput: string): Promise<any> {
|
|
49
|
+
const plutilProcess = spawn('plutil', ['-convert', 'json', '-o', '-', '-']);
|
|
50
|
+
let jsonOutput = '';
|
|
51
|
+
plutilProcess.stdout.on('data', (chunk) => {
|
|
52
|
+
jsonOutput += chunk.toString();
|
|
53
|
+
});
|
|
54
|
+
const inputStream = Readable.from([plistInput]);
|
|
55
|
+
inputStream.pipe(plutilProcess.stdin);
|
|
56
|
+
try {
|
|
57
|
+
await new Promise<void>((resolve, reject) => {
|
|
58
|
+
inputStream.once('error', reject);
|
|
59
|
+
plutilProcess.once('exit', (code, signal) => {
|
|
60
|
+
inputStream.unpipe(plutilProcess.stdin);
|
|
61
|
+
if (code === 0) {
|
|
62
|
+
resolve();
|
|
63
|
+
} else {
|
|
64
|
+
reject(new Error(`plutil exited with code ${code}, signal ${signal}`));
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
plutilProcess.once('error', (e) => {
|
|
68
|
+
inputStream.unpipe(plutilProcess.stdin);
|
|
69
|
+
reject(e);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
} catch (err) {
|
|
73
|
+
plutilProcess.kill(9);
|
|
74
|
+
throw new Error(`Failed to convert plist to JSON: ${err instanceof Error ? err.message : String(err)}`);
|
|
75
|
+
} finally {
|
|
76
|
+
plutilProcess.removeAllListeners();
|
|
77
|
+
inputStream.removeAllListeners();
|
|
78
|
+
}
|
|
79
|
+
return JSON.parse(jsonOutput);
|
|
80
|
+
}
|
|
81
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import appiumLogger from '@appium/logger';
|
|
2
2
|
|
|
3
|
-
const LOG_PREFIX = 'simctl';
|
|
3
|
+
export const LOG_PREFIX = 'simctl';
|
|
4
4
|
|
|
5
5
|
function getLogger () {
|
|
6
6
|
const logger = global._global_npmlog || appiumLogger;
|
|
@@ -10,7 +10,4 @@ function getLogger () {
|
|
|
10
10
|
return logger;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const log = getLogger();
|
|
14
|
-
|
|
15
|
-
export { LOG_PREFIX };
|
|
16
|
-
export default log;
|
|
13
|
+
export const log = getLogger();
|