node-simctl 7.2.2 → 7.3.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 (130) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/build/index.js +9 -17
  3. package/build/lib/helpers.d.ts +13 -0
  4. package/build/lib/helpers.d.ts.map +1 -0
  5. package/build/lib/helpers.js +22 -16
  6. package/build/lib/helpers.js.map +1 -1
  7. package/build/lib/logger.d.ts +4 -0
  8. package/build/lib/logger.d.ts.map +1 -0
  9. package/build/lib/logger.js +13 -19
  10. package/build/lib/logger.js.map +1 -1
  11. package/build/lib/simctl.d.ts +131 -0
  12. package/build/lib/simctl.d.ts.map +1 -0
  13. package/build/lib/simctl.js +170 -94
  14. package/build/lib/simctl.js.map +1 -1
  15. package/build/lib/subcommands/addmedia.d.ts +16 -0
  16. package/build/lib/subcommands/addmedia.d.ts.map +1 -0
  17. package/build/lib/subcommands/addmedia.js +17 -12
  18. package/build/lib/subcommands/addmedia.js.map +1 -1
  19. package/build/lib/subcommands/appinfo.d.ts +45 -0
  20. package/build/lib/subcommands/appinfo.d.ts.map +1 -0
  21. package/build/lib/subcommands/appinfo.js +47 -15
  22. package/build/lib/subcommands/appinfo.js.map +1 -1
  23. package/build/lib/subcommands/boot.d.ts +12 -0
  24. package/build/lib/subcommands/boot.d.ts.map +1 -0
  25. package/build/lib/subcommands/boot.js +47 -22
  26. package/build/lib/subcommands/boot.js.map +1 -1
  27. package/build/lib/subcommands/bootstatus.d.ts +56 -0
  28. package/build/lib/subcommands/bootstatus.d.ts.map +1 -0
  29. package/build/lib/subcommands/bootstatus.js +102 -87
  30. package/build/lib/subcommands/bootstatus.js.map +1 -1
  31. package/build/lib/subcommands/create.d.ts +34 -0
  32. package/build/lib/subcommands/create.d.ts.map +1 -0
  33. package/build/lib/subcommands/create.js +115 -65
  34. package/build/lib/subcommands/create.js.map +1 -1
  35. package/build/lib/subcommands/delete.d.ts +12 -0
  36. package/build/lib/subcommands/delete.d.ts.map +1 -0
  37. package/build/lib/subcommands/delete.js +13 -12
  38. package/build/lib/subcommands/delete.js.map +1 -1
  39. package/build/lib/subcommands/erase.d.ts +15 -0
  40. package/build/lib/subcommands/erase.d.ts.map +1 -0
  41. package/build/lib/subcommands/erase.js +19 -14
  42. package/build/lib/subcommands/erase.js.map +1 -1
  43. package/build/lib/subcommands/get_app_container.d.ts +22 -0
  44. package/build/lib/subcommands/get_app_container.d.ts.map +1 -0
  45. package/build/lib/subcommands/get_app_container.js +26 -19
  46. package/build/lib/subcommands/get_app_container.js.map +1 -1
  47. package/build/lib/subcommands/getenv.d.ts +14 -0
  48. package/build/lib/subcommands/getenv.d.ts.map +1 -0
  49. package/build/lib/subcommands/getenv.js +17 -17
  50. package/build/lib/subcommands/getenv.js.map +1 -1
  51. package/build/lib/subcommands/index.d.ts +3 -0
  52. package/build/lib/subcommands/index.d.ts.map +1 -0
  53. package/build/lib/subcommands/index.js +33 -36
  54. package/build/lib/subcommands/index.js.map +1 -1
  55. package/build/lib/subcommands/install.d.ts +15 -0
  56. package/build/lib/subcommands/install.d.ts.map +1 -0
  57. package/build/lib/subcommands/install.js +16 -12
  58. package/build/lib/subcommands/install.js.map +1 -1
  59. package/build/lib/subcommands/io.d.ts +15 -0
  60. package/build/lib/subcommands/io.d.ts.map +1 -0
  61. package/build/lib/subcommands/io.js +32 -25
  62. package/build/lib/subcommands/io.js.map +1 -1
  63. package/build/lib/subcommands/keychain.d.ts +53 -0
  64. package/build/lib/subcommands/keychain.d.ts.map +1 -0
  65. package/build/lib/subcommands/keychain.js +85 -51
  66. package/build/lib/subcommands/keychain.js.map +1 -1
  67. package/build/lib/subcommands/launch.d.ts +19 -0
  68. package/build/lib/subcommands/launch.d.ts.map +1 -0
  69. package/build/lib/subcommands/launch.js +28 -19
  70. package/build/lib/subcommands/launch.js.map +1 -1
  71. package/build/lib/subcommands/list.d.ts +120 -0
  72. package/build/lib/subcommands/list.d.ts.map +1 -0
  73. package/build/lib/subcommands/list.js +296 -138
  74. package/build/lib/subcommands/list.js.map +1 -1
  75. package/build/lib/subcommands/location.d.ts +20 -0
  76. package/build/lib/subcommands/location.d.ts.map +1 -0
  77. package/build/lib/subcommands/location.js +37 -22
  78. package/build/lib/subcommands/location.js.map +1 -1
  79. package/build/lib/subcommands/openurl.d.ts +17 -0
  80. package/build/lib/subcommands/openurl.d.ts.map +1 -0
  81. package/build/lib/subcommands/openurl.js +18 -12
  82. package/build/lib/subcommands/openurl.js.map +1 -1
  83. package/build/lib/subcommands/pbcopy.d.ts +17 -0
  84. package/build/lib/subcommands/pbcopy.d.ts.map +1 -0
  85. package/build/lib/subcommands/pbcopy.js +26 -20
  86. package/build/lib/subcommands/pbcopy.js.map +1 -1
  87. package/build/lib/subcommands/pbpaste.d.ts +17 -0
  88. package/build/lib/subcommands/pbpaste.d.ts.map +1 -0
  89. package/build/lib/subcommands/pbpaste.js +20 -16
  90. package/build/lib/subcommands/pbpaste.js.map +1 -1
  91. package/build/lib/subcommands/privacy.d.ts +55 -0
  92. package/build/lib/subcommands/privacy.d.ts.map +1 -0
  93. package/build/lib/subcommands/privacy.js +60 -18
  94. package/build/lib/subcommands/privacy.js.map +1 -1
  95. package/build/lib/subcommands/push.d.ts +25 -0
  96. package/build/lib/subcommands/push.d.ts.map +1 -0
  97. package/build/lib/subcommands/push.js +41 -24
  98. package/build/lib/subcommands/push.js.map +1 -1
  99. package/build/lib/subcommands/shutdown.d.ts +12 -0
  100. package/build/lib/subcommands/shutdown.d.ts.map +1 -0
  101. package/build/lib/subcommands/shutdown.js +47 -22
  102. package/build/lib/subcommands/shutdown.js.map +1 -1
  103. package/build/lib/subcommands/spawn.d.ts +26 -0
  104. package/build/lib/subcommands/spawn.d.ts.map +1 -0
  105. package/build/lib/subcommands/spawn.js +42 -26
  106. package/build/lib/subcommands/spawn.js.map +1 -1
  107. package/build/lib/subcommands/terminate.d.ts +15 -0
  108. package/build/lib/subcommands/terminate.d.ts.map +1 -0
  109. package/build/lib/subcommands/terminate.js +16 -12
  110. package/build/lib/subcommands/terminate.js.map +1 -1
  111. package/build/lib/subcommands/ui.d.ts +24 -0
  112. package/build/lib/subcommands/ui.d.ts.map +1 -0
  113. package/build/lib/subcommands/ui.js +32 -20
  114. package/build/lib/subcommands/ui.js.map +1 -1
  115. package/build/lib/subcommands/uninstall.d.ts +16 -0
  116. package/build/lib/subcommands/uninstall.d.ts.map +1 -0
  117. package/build/lib/subcommands/uninstall.js +17 -12
  118. package/build/lib/subcommands/uninstall.js.map +1 -1
  119. package/lib/simctl.js +13 -3
  120. package/lib/subcommands/addmedia.js +1 -1
  121. package/lib/subcommands/bootstatus.js +2 -2
  122. package/lib/subcommands/create.js +2 -2
  123. package/lib/subcommands/erase.js +1 -1
  124. package/lib/subcommands/keychain.js +2 -2
  125. package/lib/subcommands/launch.js +1 -0
  126. package/lib/subcommands/list.js +6 -6
  127. package/lib/subcommands/location.js +1 -1
  128. package/lib/subcommands/openurl.js +1 -1
  129. package/lib/subcommands/spawn.js +2 -2
  130. package/package.json +28 -17
@@ -17,8 +17,8 @@ const commands = {};
17
17
  * Parse the list of existing Simulator devices to represent
18
18
  * it as convenient mapping.
19
19
  *
20
- * @param {?string} platform - The platform name, for example 'watchOS'.
21
- * @return {Object} The resulting mapping. Each key is platform version,
20
+ * @param {string?} platform - The platform name, for example 'watchOS'.
21
+ * @return {Promise<Record<string, any>>} The resulting mapping. Each key is platform version,
22
22
  * for example '10.3' and the corresponding value is an
23
23
  * array of the matching {@link DeviceInfo} instances.
24
24
  * @throws {Error} If the corresponding simctl subcommand command
@@ -39,7 +39,7 @@ commands.getDevicesByParsing = async function getDevicesByParsing (platform) {
39
39
  // ...
40
40
  // so, get the `-- iOS X.X --` line to find the sdk (X.X)
41
41
  // and the rest of the listing in order to later find the devices
42
- const deviceSectionRe = _.isEmpty(platform)
42
+ const deviceSectionRe = _.isEmpty(platform) || !platform
43
43
  ? new RegExp(`\\-\\-\\s+(\\S+)\\s+(\\S+)\\s+\\-\\-(\\n\\s{4}.+)*`, 'mgi')
44
44
  : new RegExp(`\\-\\-\\s+${_.escapeRegExp(platform)}\\s+(\\S+)\\s+\\-\\-(\\n\\s{4}.+)*`, 'mgi');
45
45
  const matches = [];
@@ -124,7 +124,7 @@ commands.getDevices = async function getDevices (forSdk, platform) {
124
124
  * }
125
125
  * }
126
126
  */
127
- const versionMatchRe = _.isEmpty(platform)
127
+ const versionMatchRe = _.isEmpty(platform) || !platform
128
128
  ? new RegExp(`^([^\\s-]+)[\\s-](\\S+)`, 'i')
129
129
  : new RegExp(`^${_.escapeRegExp(platform)}[\\s-](\\S+)`, 'i');
130
130
  for (let [sdkName, entries] of _.toPairs(JSON.parse(stdout).devices)) {
@@ -176,7 +176,7 @@ commands.getDevices = async function getDevices (forSdk, platform) {
176
176
  *
177
177
  * @param {string} platformVersion - The platform version name,
178
178
  * for example '10.3'.
179
- * @param {string?} platform - The platform name, for example 'watchOS'.
179
+ * @param {string} platform - The platform name, for example 'watchOS'.
180
180
  * @return {Promise<string>} The corresponding runtime name for the given
181
181
  * platform version.
182
182
  */
@@ -199,7 +199,7 @@ commands.getRuntimeForPlatformVersionViaJson = async function getRuntimeForPlatf
199
199
  *
200
200
  * @param {string} platformVersion - The platform version name,
201
201
  * for example '10.3'.
202
- * @param {string?} platform - The platform name, for example 'watchOS'.
202
+ * @param {string} platform - The platform name, for example 'watchOS'.
203
203
  * @return {Promise<string>} The corresponding runtime name for the given
204
204
  * platform version.
205
205
  */
@@ -8,7 +8,7 @@ const commands = {};
8
8
  * @returns {string} Formatted value, for example -73.768254
9
9
  */
10
10
  function formatArg (name, value) {
11
- const flt = parseFloat(value);
11
+ const flt = parseFloat(`${value}`);
12
12
  if (isNaN(flt)) {
13
13
  throw new TypeError(`${name} must be a valid number, got '${value}' instead`);
14
14
  }
@@ -7,7 +7,7 @@ const commands = {};
7
7
  *
8
8
  * @param {string} url - The URL scheme to open, for example http://appiom.io
9
9
  * will be opened by the built-in mobile browser.
10
- * @return {Promise<ExecResult>} Command execution result.
10
+ * @return {Promise<import('teen_process').TeenProcessExecResult>} Command execution result.
11
11
  * @throws {Error} If the corresponding simctl subcommand command
12
12
  * returns non-zero return code.
13
13
  * @throws {Error} If the `udid` instance property is unset
@@ -9,7 +9,7 @@ const commands = {};
9
9
  *
10
10
  * @param {string|string[]} args - Spawn arguments
11
11
  * @param {object} env [{}] - Additional environment variables mapping.
12
- * @return {Promise<ExecResult>} Command execution result.
12
+ * @return {Promise<import('teen_process').TeenProcessExecResult>} Command execution result.
13
13
  * @throws {Error} If the corresponding simctl subcommand command
14
14
  * returns non-zero return code.
15
15
  * @throws {Error} If the `udid` instance property is unset
@@ -31,7 +31,7 @@ commands.spawnProcess = async function spawnProcess (args, env = {}) {
31
31
  *
32
32
  * @param {string|string[]} args - Spawn arguments
33
33
  * @param {object} env [{}] - Additional environment variables mapping.
34
- * @return {Promise<SubProcess>} The instance of the process to be spawned.
34
+ * @return {Promise<import('teen_process').SubProcess>} The instance of the process to be spawned.
35
35
  * @throws {Error} If the `udid` instance property is unset
36
36
  */
37
37
  commands.spawnSubProcess = async function spawnSubProcess (args, env = {}) {
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "ios",
7
7
  "simctl"
8
8
  ],
9
- "version": "7.2.2",
9
+ "version": "7.3.0",
10
10
  "author": "Appium Contributors",
11
11
  "license": "Apache-2.0",
12
12
  "repository": {
@@ -33,7 +33,6 @@
33
33
  "CHANGELOG.md"
34
34
  ],
35
35
  "dependencies": {
36
- "@babel/runtime": "^7.0.0",
37
36
  "asyncbox": "^2.3.1",
38
37
  "bluebird": "^3.5.1",
39
38
  "lodash": "^4.2.1",
@@ -46,7 +45,9 @@
46
45
  "which": "^3.0.1"
47
46
  },
48
47
  "scripts": {
49
- "build": "rm -rf build && babel --out-dir=build/lib lib && babel --out-dir=build index.js",
48
+ "build": "tsc -b",
49
+ "clean": "npm run build -- --clean",
50
+ "rebuild": "npm run clean; npm run build",
50
51
  "dev": "npm run build -- --watch",
51
52
  "lint": "eslint .",
52
53
  "lint:fix": "npm run lint -- --fix",
@@ -71,31 +72,41 @@
71
72
  "singleQuote": true
72
73
  },
73
74
  "devDependencies": {
74
- "@appium/eslint-config-appium": "^6.0.0",
75
- "@babel/cli": "^7.18.10",
76
- "@babel/core": "^7.18.10",
77
- "@babel/eslint-parser": "^7.18.9",
78
- "@babel/plugin-transform-runtime": "^7.18.10",
79
- "@babel/preset-env": "^7.18.10",
80
- "@babel/register": "^7.18.9",
75
+ "@appium/eslint-config-appium": "^8.0.4",
76
+ "@appium/eslint-config-appium-ts": "^0.3.1",
77
+ "@appium/tsconfig": "^0.3.0",
78
+ "@appium/types": "^0.13.2",
81
79
  "@semantic-release/changelog": "^6.0.1",
82
80
  "@semantic-release/git": "^10.0.1",
81
+ "@types/bluebird": "^3.5.38",
82
+ "@types/chai": "^4.3.5",
83
+ "@types/chai-as-promised": "^7.1.5",
84
+ "@types/lodash": "^4.14.196",
85
+ "@types/mocha": "^10.0.1",
86
+ "@types/node": "^20.4.7",
87
+ "@types/sinon": "^10.0.16",
88
+ "@types/sinon-chai": "^3.2.9",
89
+ "@types/teen_process": "2.0.0",
90
+ "@typescript-eslint/eslint-plugin": "^5.62.0",
91
+ "@typescript-eslint/parser": "^5.62.0",
83
92
  "appium-xcode": "^5.0.0",
84
- "babel-plugin-source-map-support": "^2.2.0",
85
93
  "chai": "^4.1.2",
86
94
  "chai-as-promised": "^7.1.1",
87
95
  "conventional-changelog-conventionalcommits": "^6.0.0",
88
- "eslint": "^7.32.0",
89
- "eslint-config-prettier": "^8.5.0",
90
- "eslint-plugin-import": "^2.26.0",
91
- "eslint-plugin-mocha": "^9.0.0",
92
- "eslint-plugin-promise": "^6.0.0",
96
+ "eslint": "^8.46.0",
97
+ "eslint-config-prettier": "^8.9.0",
98
+ "eslint-import-resolver-typescript": "^3.5.5",
99
+ "eslint-plugin-import": "^2.28.0",
100
+ "eslint-plugin-mocha": "^10.1.0",
101
+ "eslint-plugin-promise": "^6.1.1",
93
102
  "lint-staged": "^14.0.0",
94
103
  "mocha": "^10.0.0",
95
104
  "pre-commit": "^1.1.3",
96
105
  "prettier": "^3.0.0",
97
106
  "proxyquire": "^2.1.3",
98
107
  "semantic-release": "^20.0.2",
99
- "sinon": "^15.0.0"
108
+ "sinon": "^15.0.0",
109
+ "ts-node": "^10.9.1",
110
+ "typescript": "^5.1.6"
100
111
  }
101
112
  }