node-simctl 8.1.6 → 8.2.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/lib/index.d.ts +5 -0
  3. package/build/lib/index.d.ts.map +1 -0
  4. package/build/{index.js → lib/index.js} +1 -1
  5. package/build/lib/index.js.map +1 -0
  6. package/build/lib/simctl.d.ts +31 -31
  7. package/build/lib/simctl.d.ts.map +1 -1
  8. package/build/lib/simctl.js +55 -55
  9. package/build/lib/simctl.js.map +1 -1
  10. package/build/lib/subcommands/appinfo.d.ts.map +1 -1
  11. package/build/lib/subcommands/appinfo.js +4 -5
  12. package/build/lib/subcommands/appinfo.js.map +1 -1
  13. package/build/lib/subcommands/boot.d.ts.map +1 -1
  14. package/build/lib/subcommands/boot.js +1 -5
  15. package/build/lib/subcommands/boot.js.map +1 -1
  16. package/build/lib/subcommands/bootstatus.d.ts.map +1 -1
  17. package/build/lib/subcommands/bootstatus.js +1 -5
  18. package/build/lib/subcommands/bootstatus.js.map +1 -1
  19. package/build/lib/subcommands/create.d.ts.map +1 -1
  20. package/build/lib/subcommands/create.js +2 -6
  21. package/build/lib/subcommands/create.js.map +1 -1
  22. package/build/lib/subcommands/keychain.d.ts.map +1 -1
  23. package/build/lib/subcommands/keychain.js +20 -21
  24. package/build/lib/subcommands/keychain.js.map +1 -1
  25. package/build/lib/subcommands/launch.d.ts.map +1 -1
  26. package/build/lib/subcommands/launch.js +1 -5
  27. package/build/lib/subcommands/launch.js.map +1 -1
  28. package/build/lib/subcommands/list.d.ts.map +1 -1
  29. package/build/lib/subcommands/list.js +12 -13
  30. package/build/lib/subcommands/list.js.map +1 -1
  31. package/build/lib/subcommands/location.d.ts.map +1 -1
  32. package/build/lib/subcommands/location.js +14 -14
  33. package/build/lib/subcommands/location.js.map +1 -1
  34. package/build/lib/subcommands/shutdown.d.ts.map +1 -1
  35. package/build/lib/subcommands/shutdown.js +1 -5
  36. package/build/lib/subcommands/shutdown.js.map +1 -1
  37. package/build/lib/subcommands/spawn.d.ts.map +1 -1
  38. package/build/lib/subcommands/spawn.js +4 -8
  39. package/build/lib/subcommands/spawn.js.map +1 -1
  40. package/build/lib/subcommands/ui.d.ts.map +1 -1
  41. package/build/lib/subcommands/ui.js +3 -7
  42. package/build/lib/subcommands/ui.js.map +1 -1
  43. package/{index.ts → lib/index.ts} +3 -3
  44. package/lib/simctl.ts +60 -63
  45. package/lib/subcommands/appinfo.ts +6 -2
  46. package/lib/subcommands/boot.ts +1 -2
  47. package/lib/subcommands/bootstatus.ts +4 -4
  48. package/lib/subcommands/create.ts +2 -3
  49. package/lib/subcommands/keychain.ts +22 -23
  50. package/lib/subcommands/launch.ts +1 -2
  51. package/lib/subcommands/list.ts +15 -17
  52. package/lib/subcommands/location.ts +15 -15
  53. package/lib/subcommands/shutdown.ts +1 -2
  54. package/lib/subcommands/spawn.ts +4 -5
  55. package/lib/subcommands/ui.ts +3 -4
  56. package/package.json +4 -11
  57. package/build/index.d.ts +0 -5
  58. package/build/index.d.ts.map +0 -1
  59. package/build/index.js.map +0 -1
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.getDevicesByParsing = getDevicesByParsing;
7
4
  exports.getDevices = getDevices;
@@ -9,7 +6,6 @@ exports.getRuntimeForPlatformVersionViaJson = getRuntimeForPlatformVersionViaJso
9
6
  exports.getRuntimeForPlatformVersion = getRuntimeForPlatformVersion;
10
7
  exports.getDeviceTypes = getDeviceTypes;
11
8
  exports.list = list;
12
- const lodash_1 = __importDefault(require("lodash"));
13
9
  const helpers_1 = require("../helpers");
14
10
  const logger_1 = require("../logger");
15
11
  /**
@@ -36,16 +32,16 @@ async function getDevicesByParsing(platform) {
36
32
  // ...
37
33
  // so, get the `-- iOS X.X --` line to find the sdk (X.X)
38
34
  // and the rest of the listing in order to later find the devices
39
- const deviceSectionRe = lodash_1.default.isEmpty(platform) || !platform
35
+ const deviceSectionRe = !platform
40
36
  ? new RegExp(`\\-\\-\\s+(\\S+)\\s+(\\S+)\\s+\\-\\-(\\n\\s{4}.+)*`, 'mgi')
41
- : new RegExp(`\\-\\-\\s+${lodash_1.default.escapeRegExp(platform)}\\s+(\\S+)\\s+\\-\\-(\\n\\s{4}.+)*`, 'mgi');
37
+ : new RegExp(`\\-\\-\\s+${escapeRegExp(platform)}\\s+(\\S+)\\s+\\-\\-(\\n\\s{4}.+)*`, 'mgi');
42
38
  const matches = [];
43
39
  let match;
44
40
  // make an entry for each sdk version
45
41
  while ((match = deviceSectionRe.exec(stdout))) {
46
42
  matches.push(match);
47
43
  }
48
- if (lodash_1.default.isEmpty(matches)) {
44
+ if (matches.length === 0) {
49
45
  throw new Error('Could not find device section');
50
46
  }
51
47
  const lineRe = /([^\s].+) \((\w+-.+\w+)\) \((\w+\s?\w+)\)/; // https://regex101.com/r/lG7mK6/3
@@ -103,10 +99,10 @@ async function getDevices(forSdk, platform) {
103
99
  * }
104
100
  * }
105
101
  */
106
- const versionMatchRe = lodash_1.default.isEmpty(platform) || !platform
102
+ const versionMatchRe = !platform
107
103
  ? new RegExp(`^([^\\s-]+)[\\s-](\\S+)`, 'i')
108
- : new RegExp(`^${lodash_1.default.escapeRegExp(platform)}[\\s-](\\S+)`, 'i');
109
- for (const [sdkNameRaw, entries] of lodash_1.default.toPairs(JSON.parse(stdout).devices)) {
104
+ : new RegExp(`^${escapeRegExp(platform)}[\\s-](\\S+)`, 'i');
105
+ for (const [sdkNameRaw, entries] of Object.entries(JSON.parse(stdout).devices)) {
110
106
  // there could be a longer name, so remove it
111
107
  const sdkName = sdkNameRaw.replace(helpers_1.SIM_RUNTIME_NAME, '');
112
108
  const versionMatch = versionMatchRe.exec(sdkName);
@@ -117,7 +113,7 @@ async function getDevices(forSdk, platform) {
117
113
  const sdk = (platform ? versionMatch[1] : versionMatch[2]).replace('-', '.');
118
114
  devices[sdk] = devices[sdk] || [];
119
115
  devices[sdk].push(...entries
120
- .filter((el) => lodash_1.default.isUndefined(el.isAvailable) || el.isAvailable)
116
+ .filter((el) => el.isAvailable === undefined || el.isAvailable)
121
117
  .map((el) => {
122
118
  delete el.availability;
123
119
  return {
@@ -141,7 +137,7 @@ async function getDevices(forSdk, platform) {
141
137
  return devices[forSdk];
142
138
  }
143
139
  let errMsg = `'${forSdk}' does not exist in the list of simctl SDKs.`;
144
- const availableSDKs = lodash_1.default.keys(devices);
140
+ const availableSDKs = Object.keys(devices);
145
141
  errMsg += availableSDKs.length
146
142
  ? ` Only the following Simulator SDK versions are available on your system: ${availableSDKs.join(', ')}`
147
143
  : ` No Simulator SDK versions are available on your system. Please install some via Xcode preferences.`;
@@ -184,7 +180,7 @@ async function getRuntimeForPlatformVersion(platformVersion, platform = 'iOS') {
184
180
  args: ['runtimes'],
185
181
  });
186
182
  // https://regex101.com/r/UykjQZ/1
187
- const runtimeRe = new RegExp(`${lodash_1.default.escapeRegExp(platform)}\\s+(\\d+\\.\\d+)\\s+\\((\\d+\\.\\d+\\.*\\d*)`, 'i');
183
+ const runtimeRe = new RegExp(`${escapeRegExp(platform)}\\s+(\\d+\\.\\d+)\\s+\\((\\d+\\.\\d+\\.*\\d*)`, 'i');
188
184
  for (const line of stdout.split('\n')) {
189
185
  const match = runtimeRe.exec(line);
190
186
  if (match && match[1] === platformVersion) {
@@ -270,4 +266,7 @@ async function list() {
270
266
  throw new Error(`Unable to parse simctl list: ${e.message}`);
271
267
  }
272
268
  }
269
+ function escapeRegExp(value) {
270
+ return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
271
+ }
273
272
  //# sourceMappingURL=list.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../lib/subcommands/list.ts"],"names":[],"mappings":";;;;;AAiBA,kDAkEC;AA4BD,gCA0EC;AAWD,k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,CAAC,IAAI,CAAC;KACb,CAAC,CAAC;IACH,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IACnC,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../../lib/subcommands/location.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAiBtC;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,MAAM,EACzB,SAAS,EAAE,MAAM,GAAG,MAAM,GACzB,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI/D"}
1
+ {"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../../lib/subcommands/location.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEtC;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,MAAM,EACzB,SAAS,EAAE,MAAM,GAAG,MAAM,GACzB,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI/D"}
@@ -2,20 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setLocation = setLocation;
4
4
  exports.clearLocation = clearLocation;
5
- /**
6
- * Formats the given location argument for simctl usage
7
- *
8
- * @param name Argument name
9
- * @param value Location argument value
10
- * @returns Formatted value, for example -73.768254
11
- */
12
- function formatArg(name, value) {
13
- const flt = parseFloat(`${value}`);
14
- if (isNaN(flt)) {
15
- throw new TypeError(`${name} must be a valid number, got '${value}' instead`);
16
- }
17
- return flt.toFixed(7);
18
- }
19
5
  /**
20
6
  * Set the Simulator location to a specific latitude and longitude.
21
7
  * This functionality is only available since Xcode 14.
@@ -43,4 +29,18 @@ async function clearLocation() {
43
29
  args: [this.requireUdid('location'), 'clear'],
44
30
  });
45
31
  }
32
+ /**
33
+ * Formats the given location argument for simctl usage
34
+ *
35
+ * @param name Argument name
36
+ * @param value Location argument value
37
+ * @returns Formatted value, for example -73.768254
38
+ */
39
+ function formatArg(name, value) {
40
+ const flt = parseFloat(`${value}`);
41
+ if (isNaN(flt)) {
42
+ throw new TypeError(`${name} must be a valid number, got '${value}' instead`);
43
+ }
44
+ return flt.toFixed(7);
45
+ }
46
46
  //# sourceMappingURL=location.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"location.js","sourceRoot":"","sources":["../../../lib/subcommands/location.ts"],"names":[],"mappings":";;AA2BA,kCAUC;AAOD,sCAIC;AA9CD;;;;;;GAMG;AACH,SAAS,SAAS,CAAC,IAAY,EAAE,KAAsB;IACrD,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC;IACnC,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,iCAAiC,KAAK,WAAW,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC;AAED;;;;;;;;;GASG;AACI,KAAK,UAAU,WAAW,CAE/B,QAAyB,EACzB,SAA0B;IAE1B,MA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AACH,SAAS,SAAS,CAAC,IAAY,EAAE,KAAsB;IACrD,MAAM,GAAG,GAAG,UAAU,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC;IACnC,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,iCAAiC,KAAK,WAAW,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"shutdown.d.ts","sourceRoot":"","sources":["../../../lib/subcommands/shutdown.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEtC;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAWhE"}
1
+ {"version":3,"file":"shutdown.d.ts","sourceRoot":"","sources":["../../../lib/subcommands/shutdown.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEtC;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAWhE"}
@@ -1,10 +1,6 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.shutdownDevice = shutdownDevice;
7
- const lodash_1 = __importDefault(require("lodash"));
8
4
  const logger_1 = require("../logger");
9
5
  /**
10
6
  * Shutdown the given Simulator if it is running.
@@ -20,7 +16,7 @@ async function shutdownDevice() {
20
16
  });
21
17
  }
22
18
  catch (e) {
23
- if (!lodash_1.default.includes(e.message, 'current state: Shutdown')) {
19
+ if (!e.message?.includes('current state: Shutdown')) {
24
20
  throw e;
25
21
  }
26
22
  logger_1.log.debug(logger_1.LOG_PREFIX, `Simulator already in 'Shutdown' state. Continuing`);
@@ -1 +1 @@
1
- {"version":3,"file":"shutdown.js","sourceRoot":"","sources":["../../../lib/subcommands/shutdown.ts"],"names":[],"mappings":";;;;;AAWA,wCAWC;AAtBD,oDAAuB;AACvB,sCAA0C;AAG1C;;;;;;GAMG;AACI,KAAK,UAAU,cAAc;IAClC,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;SACrC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,IAAI,CAAC,gBAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,yBAAyB,CAAC,EAAE,CAAC;YACtD,MAAM,CAAC,CAAC;QACV,CAAC;QACD,YAAG,CAAC,KAAK,CAAC,mBAAU,EAAE,mDAAmD,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"shutdown.js","sourceRoot":"","sources":["../../../lib/subcommands/shutdown.ts"],"names":[],"mappings":";;AAUA,wCAWC;AArBD,sCAA0C;AAG1C;;;;;;GAMG;AACI,KAAK,UAAU,cAAc;IAClC,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;SACrC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,yBAAyB,CAAC,EAAE,CAAC;YACpD,MAAM,CAAC,CAAC;QACV,CAAC;QACD,YAAG,CAAC,KAAK,CAAC,mBAAU,EAAE,mDAAmD,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../lib/subcommands/spawn.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAC,qBAAqB,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAEpE;;;;;;;;;;GAUG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAC5B,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CASxC;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAC5B,OAAO,CAAC,UAAU,CAAC,CAUrB"}
1
+ {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../lib/subcommands/spawn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAC,qBAAqB,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAEpE;;;;;;;;;;GAUG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAC5B,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CASxC;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAC5B,OAAO,CAAC,UAAU,CAAC,CAUrB"}
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.spawnProcess = spawnProcess;
7
4
  exports.spawnSubProcess = spawnSubProcess;
8
- const lodash_1 = __importDefault(require("lodash"));
9
5
  /**
10
6
  * Spawn the particular process on Simulator.
11
7
  * It is required that Simulator is in _booted_ state.
@@ -18,11 +14,11 @@ const lodash_1 = __importDefault(require("lodash"));
18
14
  * @throws {Error} If the `udid` instance property is unset
19
15
  */
20
16
  async function spawnProcess(args, env = {}) {
21
- if (lodash_1.default.isEmpty(args)) {
17
+ if ((Array.isArray(args) && args.length === 0) || args === '') {
22
18
  throw new Error('Spawn arguments are required');
23
19
  }
24
20
  return await this.exec('spawn', {
25
- args: [this.requireUdid('spawn'), ...(lodash_1.default.isArray(args) ? args : [args])],
21
+ args: [this.requireUdid('spawn'), ...(Array.isArray(args) ? args : [args])],
26
22
  env,
27
23
  });
28
24
  }
@@ -36,11 +32,11 @@ async function spawnProcess(args, env = {}) {
36
32
  * @throws {Error} If the `udid` instance property is unset
37
33
  */
38
34
  async function spawnSubProcess(args, env = {}) {
39
- if (lodash_1.default.isEmpty(args)) {
35
+ if ((Array.isArray(args) && args.length === 0) || args === '') {
40
36
  throw new Error('Spawn arguments are required');
41
37
  }
42
38
  return (await this.exec('spawn', {
43
- args: [this.requireUdid('spawn'), ...(lodash_1.default.isArray(args) ? args : [args])],
39
+ args: [this.requireUdid('spawn'), ...(Array.isArray(args) ? args : [args])],
44
40
  env,
45
41
  asynchronous: true,
46
42
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.js","sourceRoot":"","sources":["../../../lib/subcommands/spawn.ts"],"names":[],"mappings":";;;;;AAeA,oCAaC;AAWD,0CAcC;AArDD,oDAAuB;AAIvB;;;;;;;;;;GAUG;AACI,KAAK,UAAU,YAAY,CAEhC,IAAuB,EACvB,MAA2B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;GAoBG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAKlE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI3F"}
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.getAppearance = getAppearance;
7
4
  exports.setAppearance = setAppearance;
@@ -9,7 +6,6 @@ exports.getIncreaseContrast = getIncreaseContrast;
9
6
  exports.setIncreaseContrast = setIncreaseContrast;
10
7
  exports.getContentSize = getContentSize;
11
8
  exports.setContentSize = setContentSize;
12
- const lodash_1 = __importDefault(require("lodash"));
13
9
  /**
14
10
  * Retrieves the current UI appearance value from the given simulator
15
11
  *
@@ -23,7 +19,7 @@ async function getAppearance() {
23
19
  const { stdout } = await this.exec('ui', {
24
20
  args: [this.requireUdid('ui'), 'appearance'],
25
21
  });
26
- return lodash_1.default.trim(stdout);
22
+ return stdout.trim();
27
23
  }
28
24
  /**
29
25
  * Sets the UI appearance to the given style
@@ -59,7 +55,7 @@ async function getIncreaseContrast() {
59
55
  const { stdout } = await this.exec('ui', {
60
56
  args: [this.requireUdid('ui'), 'increase_contrast'],
61
57
  });
62
- return lodash_1.default.trim(stdout);
58
+ return stdout.trim();
63
59
  }
64
60
  /**
65
61
  * Sets the increase constrast configuration for the given simulator.
@@ -104,7 +100,7 @@ async function getContentSize() {
104
100
  const { stdout } = await this.exec('ui', {
105
101
  args: [this.requireUdid('ui'), 'content_size'],
106
102
  });
107
- return lodash_1.default.trim(stdout);
103
+ return stdout.trim();
108
104
  }
109
105
  /**
110
106
  * Sets content size for the given simulator.
@@ -1 +1 @@
1
- {"version":3,"file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AM,EAAC,MAAM,EAAC,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;QACrC,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC;KACpD,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAED;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,mBAAmB,CAAe,gBAAwB;IAC9E,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;QACpB,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,mBAAmB,EAAE,gBAAgB,CAAC;KACtE,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,KAAK,UAAU,cAAc;IAClC,MAAM,EAAC,MAAM,EAAC,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;QACrC,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC;KAC/C,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACI,KAAK,UAAU,cAAc,CAAe,iBAAyB;IAC1E,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;QACpB,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,iBAAiB,CAAC;KAClE,CAAC,CAAC;AACL,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Simctl } from './lib/simctl';
1
+ import {Simctl} from './simctl';
2
2
  export type {
3
3
  SimctlOpts,
4
4
  DeviceInfo,
@@ -7,7 +7,7 @@ export type {
7
7
  CertOptions,
8
8
  XCRun,
9
9
  AppInfo,
10
- } from './lib/types';
10
+ } from './types';
11
11
 
12
- export { Simctl };
12
+ export {Simctl};
13
13
  export default Simctl;
package/lib/simctl.ts CHANGED
@@ -1,4 +1,3 @@
1
- import _ from 'lodash';
2
1
  import which from 'which';
3
2
  import {log, LOG_PREFIX} from './logger';
4
3
  import {DEFAULT_EXEC_TIMEOUT, getXcrunBinary} from './helpers';
@@ -33,6 +32,49 @@ import type {XCRun, ExecOpts, SimctlOpts, ExecResult} from './types';
33
32
  const SIMCTL_ENV_PREFIX = 'SIMCTL_CHILD_';
34
33
 
35
34
  export class Simctl {
35
+ // Extension methods
36
+ addMedia = addmediaCommands.addMedia;
37
+ appInfo = appinfoCommands.appInfo;
38
+ bootDevice = bootCommands.bootDevice;
39
+ startBootMonitor = bootstatusCommands.startBootMonitor;
40
+ createDevice = createCommands.createDevice;
41
+ deleteDevice = deleteCommands.deleteDevice;
42
+ eraseDevice = eraseCommands.eraseDevice;
43
+ getAppContainer = getappcontainerCommands.getAppContainer;
44
+ getEnv = envCommands.getEnv;
45
+ installApp = installCommands.installApp;
46
+ getScreenshot = ioCommands.getScreenshot;
47
+ addRootCertificate = keychainCommands.addRootCertificate;
48
+ addCertificate = keychainCommands.addCertificate;
49
+ resetKeychain = keychainCommands.resetKeychain;
50
+ launchApp = launchCommands.launchApp;
51
+ getDevicesByParsing = listCommands.getDevicesByParsing;
52
+ getDevices = listCommands.getDevices;
53
+ getRuntimeForPlatformVersionViaJson = listCommands.getRuntimeForPlatformVersionViaJson;
54
+ getRuntimeForPlatformVersion = listCommands.getRuntimeForPlatformVersion;
55
+ getDeviceTypes = listCommands.getDeviceTypes;
56
+ list = listCommands.list;
57
+ setLocation = locationCommands.setLocation;
58
+ clearLocation = locationCommands.clearLocation;
59
+ openUrl = openurlCommands.openUrl;
60
+ setPasteboard = pbcopyCommands.setPasteboard;
61
+ getPasteboard = pbpasteCommands.getPasteboard;
62
+ grantPermission = privacyCommands.grantPermission;
63
+ revokePermission = privacyCommands.revokePermission;
64
+ resetPermission = privacyCommands.resetPermission;
65
+ pushNotification = pushCommands.pushNotification;
66
+ shutdownDevice = shutdownCommands.shutdownDevice;
67
+ spawnProcess = spawnCommands.spawnProcess;
68
+ spawnSubProcess = spawnCommands.spawnSubProcess;
69
+ terminateApp = terminateCommands.terminateApp;
70
+ getAppearance = uiCommands.getAppearance;
71
+ setAppearance = uiCommands.setAppearance;
72
+ getIncreaseContrast = uiCommands.getIncreaseContrast;
73
+ setIncreaseContrast = uiCommands.setIncreaseContrast;
74
+ getContentSize = uiCommands.getContentSize;
75
+ setContentSize = uiCommands.setContentSize;
76
+ removeApp = uninstallCommands.removeApp;
77
+
36
78
  private xcrun: XCRun;
37
79
  private execTimeout: number;
38
80
  private logErrors: boolean;
@@ -40,29 +82,29 @@ export class Simctl {
40
82
  private _devicesSetPath: string | null;
41
83
 
42
84
  constructor(opts: SimctlOpts = {}) {
43
- this.xcrun = _.cloneDeep(opts.xcrun ?? {path: null});
85
+ this.xcrun = {...(opts.xcrun ?? {path: null})};
44
86
  this.execTimeout = opts.execTimeout ?? DEFAULT_EXEC_TIMEOUT;
45
87
  this.logErrors = opts.logErrors ?? true;
46
88
  this._udid = opts.udid ?? null;
47
89
  this._devicesSetPath = opts.devicesSetPath ?? null;
48
90
  }
49
91
 
50
- set udid(value: string | null) {
51
- this._udid = value;
52
- }
53
-
54
92
  get udid(): string | null {
55
93
  return this._udid;
56
94
  }
57
95
 
58
- set devicesSetPath(value: string | null) {
59
- this._devicesSetPath = value;
60
- }
61
-
62
96
  get devicesSetPath(): string | null {
63
97
  return this._devicesSetPath;
64
98
  }
65
99
 
100
+ set udid(value: string | null) {
101
+ this._udid = value;
102
+ }
103
+
104
+ set devicesSetPath(value: string | null) {
105
+ this._devicesSetPath = value;
106
+ }
107
+
66
108
  /**
67
109
  * @param commandName - Optional command name for error message
68
110
  * @returns The UDID string
@@ -129,12 +171,13 @@ export class Simctl {
129
171
  ];
130
172
  // Prefix all passed in environment variables with 'SIMCTL_CHILD_', simctl
131
173
  // will then pass these to the child (spawned) process.
132
- const env = _.defaults(
133
- _.mapKeys(initialEnv, (value, key) =>
134
- _.startsWith(key, SIMCTL_ENV_PREFIX) ? key : `${SIMCTL_ENV_PREFIX}${key}`,
135
- ),
136
- process.env,
174
+ const envWithPrefixedKeys = Object.fromEntries(
175
+ Object.entries(initialEnv).map(([key, value]) => [
176
+ key.startsWith(SIMCTL_ENV_PREFIX) ? key : `${SIMCTL_ENV_PREFIX}${key}`,
177
+ value,
178
+ ]),
137
179
  );
180
+ const env = {...process.env, ...envWithPrefixedKeys};
138
181
 
139
182
  const execOpts: any = {
140
183
  env,
@@ -147,11 +190,8 @@ export class Simctl {
147
190
  try {
148
191
  let execArgs: [string, string[], any];
149
192
  if (architectures?.length) {
150
- const archArgs = _.flatMap(
151
- (_.isArray(architectures) ? architectures : [architectures]).map((arch) => [
152
- '-arch',
153
- arch,
154
- ]),
193
+ const archArgs = (Array.isArray(architectures) ? architectures : [architectures]).flatMap(
194
+ (arch) => ['-arch', arch],
155
195
  );
156
196
  execArgs = ['arch', [...archArgs, xcrun, ...args], execOpts];
157
197
  } else {
@@ -175,49 +215,6 @@ export class Simctl {
175
215
  throw e;
176
216
  }
177
217
  }
178
-
179
- // Extension methods
180
- addMedia = addmediaCommands.addMedia;
181
- appInfo = appinfoCommands.appInfo;
182
- bootDevice = bootCommands.bootDevice;
183
- startBootMonitor = bootstatusCommands.startBootMonitor;
184
- createDevice = createCommands.createDevice;
185
- deleteDevice = deleteCommands.deleteDevice;
186
- eraseDevice = eraseCommands.eraseDevice;
187
- getAppContainer = getappcontainerCommands.getAppContainer;
188
- getEnv = envCommands.getEnv;
189
- installApp = installCommands.installApp;
190
- getScreenshot = ioCommands.getScreenshot;
191
- addRootCertificate = keychainCommands.addRootCertificate;
192
- addCertificate = keychainCommands.addCertificate;
193
- resetKeychain = keychainCommands.resetKeychain;
194
- launchApp = launchCommands.launchApp;
195
- getDevicesByParsing = listCommands.getDevicesByParsing;
196
- getDevices = listCommands.getDevices;
197
- getRuntimeForPlatformVersionViaJson = listCommands.getRuntimeForPlatformVersionViaJson;
198
- getRuntimeForPlatformVersion = listCommands.getRuntimeForPlatformVersion;
199
- getDeviceTypes = listCommands.getDeviceTypes;
200
- list = listCommands.list;
201
- setLocation = locationCommands.setLocation;
202
- clearLocation = locationCommands.clearLocation;
203
- openUrl = openurlCommands.openUrl;
204
- setPasteboard = pbcopyCommands.setPasteboard;
205
- getPasteboard = pbpasteCommands.getPasteboard;
206
- grantPermission = privacyCommands.grantPermission;
207
- revokePermission = privacyCommands.revokePermission;
208
- resetPermission = privacyCommands.resetPermission;
209
- pushNotification = pushCommands.pushNotification;
210
- shutdownDevice = shutdownCommands.shutdownDevice;
211
- spawnProcess = spawnCommands.spawnProcess;
212
- spawnSubProcess = spawnCommands.spawnSubProcess;
213
- terminateApp = terminateCommands.terminateApp;
214
- getAppearance = uiCommands.getAppearance;
215
- setAppearance = uiCommands.setAppearance;
216
- getIncreaseContrast = uiCommands.getIncreaseContrast;
217
- setIncreaseContrast = uiCommands.setIncreaseContrast;
218
- getContentSize = uiCommands.getContentSize;
219
- setContentSize = uiCommands.setContentSize;
220
- removeApp = uninstallCommands.removeApp;
221
218
  }
222
219
 
223
220
  export default Simctl;
@@ -1,7 +1,6 @@
1
1
  import type {Simctl} from '../simctl';
2
2
  import type {AppInfo} from '../types';
3
3
  import {convertPlistToJson} from '../helpers';
4
- import _ from 'lodash';
5
4
 
6
5
  /**
7
6
  * Get information about an app installed on the simulator
@@ -31,7 +30,12 @@ export async function appInfo(this: Simctl, bundleId: string): Promise<AppInfo>
31
30
  }
32
31
  }
33
32
 
34
- if (!_.isPlainObject(result) || !('ApplicationType' in result)) {
33
+ if (
34
+ !result ||
35
+ typeof result !== 'object' ||
36
+ Array.isArray(result) ||
37
+ !('ApplicationType' in result)
38
+ ) {
35
39
  throw new Error(`App with bundle identifier "${bundleId}" not found. Is it installed?`);
36
40
  }
37
41
 
@@ -1,4 +1,3 @@
1
- import _ from 'lodash';
2
1
  import {log, LOG_PREFIX} from '../logger';
3
2
  import type {Simctl} from '../simctl';
4
3
 
@@ -15,7 +14,7 @@ export async function bootDevice(this: Simctl): Promise<void> {
15
14
  args: [this.requireUdid('boot')],
16
15
  });
17
16
  } catch (e: any) {
18
- if (_.includes(e.message, 'Unable to boot device in current state: Booted')) {
17
+ if (e.message?.includes('Unable to boot device in current state: Booted')) {
19
18
  throw e;
20
19
  }
21
20
  log.debug(LOG_PREFIX, `Simulator already in 'Booted' state. Continuing`);
@@ -1,6 +1,5 @@
1
1
  import {log} from '../logger';
2
2
  import {waitForCondition} from 'asyncbox';
3
- import _ from 'lodash';
4
3
  import type {Simctl} from '../simctl';
5
4
  import type {BootMonitorOptions} from '../types';
6
5
  import type {SubProcess} from 'teen_process';
@@ -64,9 +63,10 @@ export async function startBootMonitor(
64
63
  }
65
64
  isBootingFinished = true;
66
65
  } else {
67
- const errMessage = _.isEmpty(status)
68
- ? `The simulator booting process has exited with code ${code} by signal ${signal}`
69
- : status.join('\n');
66
+ const errMessage =
67
+ status.length === 0
68
+ ? `The simulator booting process has exited with code ${code} by signal ${signal}`
69
+ : status.join('\n');
70
70
  error = new Error(errMessage);
71
71
  if (onError) {
72
72
  onError(error);
@@ -1,4 +1,3 @@
1
- import _ from 'lodash';
2
1
  import {log, LOG_PREFIX} from '../logger';
3
2
  import {retryInterval} from 'asyncbox';
4
3
  import {SIM_RUNTIME_NAME, normalizeVersion} from '../helpers';
@@ -36,7 +35,7 @@ export async function createDevice(
36
35
  runtimeIds.push(await this.getRuntimeForPlatformVersionViaJson(platformVersion, platform));
37
36
  } catch {}
38
37
 
39
- if (_.isEmpty(runtimeIds)) {
38
+ if (runtimeIds.length === 0) {
40
39
  // at first make sure that the runtime id is the right one
41
40
  // in some versions of Xcode it will be a patch version
42
41
  let runtimeId: string;
@@ -95,7 +94,7 @@ export async function createDevice(
95
94
  // make sure that it gets out of the "Creating" state
96
95
  const retries = parseInt(`${timeout / 1000}`, 10);
97
96
  await retryInterval(retries, 1000, async () => {
98
- const devices = _.flatMap(_.values(await this.getDevices()));
97
+ const devices = Object.values(await this.getDevices()).flatMap((entries) => entries);
99
98
  for (const device of devices) {
100
99
  if (device.udid === udid) {
101
100
  if (device.state === 'Creating') {
@@ -1,33 +1,11 @@
1
1
  import os from 'node:os';
2
2
  import fs from 'node:fs/promises';
3
- import {uuidV4} from '../helpers';
3
+ import {randomUUID} from 'node:crypto';
4
4
  import path from 'node:path';
5
- import _ from 'lodash';
6
5
  import {rimraf} from 'rimraf';
7
6
  import type {Simctl} from '../simctl';
8
7
  import type {CertOptions} from '../types';
9
8
 
10
- /**
11
- * @param payload - Certificate payload (string or Buffer)
12
- * @param onPayloadStored - Callback function to execute with the file path
13
- */
14
- async function handleRawPayload(
15
- payload: string | Buffer,
16
- onPayloadStored: (filePath: string) => Promise<any>,
17
- ): Promise<void> {
18
- const filePath = path.resolve(os.tmpdir(), `${await uuidV4()}.pem`);
19
- try {
20
- if (_.isBuffer(payload)) {
21
- await fs.writeFile(filePath, payload);
22
- } else {
23
- await fs.writeFile(filePath, payload, 'utf8');
24
- }
25
- await onPayloadStored(filePath);
26
- } finally {
27
- await rimraf(filePath);
28
- }
29
- }
30
-
31
9
  /**
32
10
  * Adds the given certificate to the Trusted Root Store on the simulator
33
11
  *
@@ -99,3 +77,24 @@ export async function resetKeychain(this: Simctl): Promise<void> {
99
77
  args: [this.requireUdid('keychain reset'), 'reset'],
100
78
  });
101
79
  }
80
+
81
+ /**
82
+ * @param payload - Certificate payload (string or Buffer)
83
+ * @param onPayloadStored - Callback function to execute with the file path
84
+ */
85
+ async function handleRawPayload(
86
+ payload: string | Buffer,
87
+ onPayloadStored: (filePath: string) => Promise<any>,
88
+ ): Promise<void> {
89
+ const filePath = path.resolve(os.tmpdir(), `${randomUUID()}.pem`);
90
+ try {
91
+ if (Buffer.isBuffer(payload)) {
92
+ await fs.writeFile(filePath, payload);
93
+ } else {
94
+ await fs.writeFile(filePath, payload, 'utf8');
95
+ }
96
+ await onPayloadStored(filePath);
97
+ } finally {
98
+ await rimraf(filePath);
99
+ }
100
+ }