nativescript 8.7.0-rc.0 → 8.7.0-rc.2

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 (324) hide show
  1. package/lib/android-tools-info.js +12 -0
  2. package/lib/base-package-manager.js +7 -0
  3. package/lib/bootstrap.js +7 -1
  4. package/lib/color.js +3 -0
  5. package/lib/commands/add-platform.js +1 -0
  6. package/lib/commands/apple-login.js +1 -0
  7. package/lib/commands/appstore-list.js +1 -0
  8. package/lib/commands/appstore-upload.js +4 -0
  9. package/lib/commands/build.js +20 -3
  10. package/lib/commands/clean.js +22 -1
  11. package/lib/commands/command-base.js +1 -0
  12. package/lib/commands/config.js +3 -0
  13. package/lib/commands/create-project.js +34 -19
  14. package/lib/commands/debug.js +6 -1
  15. package/lib/commands/deploy.js +3 -2
  16. package/lib/commands/extensibility/install-extension.js +1 -0
  17. package/lib/commands/extensibility/list-extensions.js +1 -0
  18. package/lib/commands/extensibility/uninstall-extension.js +1 -0
  19. package/lib/commands/fonts.js +1 -0
  20. package/lib/commands/generate-assets.js +1 -0
  21. package/lib/commands/generate-help.js +1 -0
  22. package/lib/commands/generate.js +12 -2
  23. package/lib/commands/info.js +1 -0
  24. package/lib/commands/install.js +1 -0
  25. package/lib/commands/list-platforms.js +1 -0
  26. package/lib/commands/migrate.js +1 -0
  27. package/lib/commands/platform-clean.js +1 -0
  28. package/lib/commands/plugin/add-plugin.js +1 -0
  29. package/lib/commands/plugin/build-plugin.js +1 -0
  30. package/lib/commands/plugin/create-plugin.js +5 -0
  31. package/lib/commands/plugin/list-plugins.js +1 -0
  32. package/lib/commands/plugin/remove-plugin.js +2 -0
  33. package/lib/commands/plugin/update-plugin.js +1 -0
  34. package/lib/commands/post-install.js +6 -0
  35. package/lib/commands/prepare.js +3 -2
  36. package/lib/commands/preview.js +2 -0
  37. package/lib/commands/remove-platform.js +1 -0
  38. package/lib/commands/resources/resources-update.js +2 -0
  39. package/lib/commands/run.js +1 -0
  40. package/lib/commands/setup.js +1 -0
  41. package/lib/commands/start.js +1 -0
  42. package/lib/commands/test-init.js +4 -0
  43. package/lib/commands/test.js +9 -2
  44. package/lib/commands/typings.js +1 -0
  45. package/lib/commands/update-platform.js +5 -0
  46. package/lib/commands/update.js +2 -0
  47. package/lib/common/bootstrap.js +1 -0
  48. package/lib/common/child-process.js +3 -0
  49. package/lib/common/codeGeneration/code-entity.js +1 -0
  50. package/lib/common/codeGeneration/code-printer.js +1 -0
  51. package/lib/common/command-params.js +1 -0
  52. package/lib/common/commands/analytics.js +3 -0
  53. package/lib/common/commands/autocompletion.js +3 -0
  54. package/lib/common/commands/device/device-log-stream.js +1 -0
  55. package/lib/common/commands/device/get-file.js +2 -0
  56. package/lib/common/commands/device/list-applications.js +1 -0
  57. package/lib/common/commands/device/list-devices.js +3 -0
  58. package/lib/common/commands/device/list-files.js +2 -0
  59. package/lib/common/commands/device/put-file.js +2 -0
  60. package/lib/common/commands/device/run-application.js +1 -0
  61. package/lib/common/commands/device/stop-application.js +1 -0
  62. package/lib/common/commands/device/uninstall-application.js +1 -0
  63. package/lib/common/commands/doctor.js +3 -2
  64. package/lib/common/commands/generate-messages.js +1 -0
  65. package/lib/common/commands/help.js +1 -0
  66. package/lib/common/commands/package-manager-get.js +1 -0
  67. package/lib/common/commands/package-manager-set.js +1 -0
  68. package/lib/common/commands/post-install.js +1 -0
  69. package/lib/common/commands/preuninstall.js +11 -2
  70. package/lib/common/commands/proxy/proxy-base.js +4 -0
  71. package/lib/common/commands/proxy/proxy-clear.js +1 -0
  72. package/lib/common/commands/proxy/proxy-get.js +1 -0
  73. package/lib/common/commands/proxy/proxy-set.js +1 -0
  74. package/lib/common/common-lib.js +1 -0
  75. package/lib/common/constants.js +11 -0
  76. package/lib/common/decorators.js +48 -0
  77. package/lib/common/definitions/mobile.d.ts +1 -1
  78. package/lib/common/dispatchers.js +10 -1
  79. package/lib/common/errors.js +13 -3
  80. package/lib/common/file-system.js +13 -2
  81. package/lib/common/header.js +3 -0
  82. package/lib/common/helpers.js +89 -3
  83. package/lib/common/host-info.js +4 -0
  84. package/lib/common/http-client.js +20 -0
  85. package/lib/common/logger/appenders/cli-appender.js +4 -0
  86. package/lib/common/logger/appenders/emit-appender.js +4 -0
  87. package/lib/common/logger/layouts/cli-layout.js +1 -0
  88. package/lib/common/logger/logger.js +5 -0
  89. package/lib/common/messages/messages.js +6 -0
  90. package/lib/common/mobile/android/android-application-manager.js +20 -1
  91. package/lib/common/mobile/android/android-debug-bridge-result-handler.js +1 -0
  92. package/lib/common/mobile/android/android-debug-bridge.js +6 -0
  93. package/lib/common/mobile/android/android-device-file-system.js +4 -0
  94. package/lib/common/mobile/android/android-device-hash-service.js +3 -0
  95. package/lib/common/mobile/android/android-device.js +8 -0
  96. package/lib/common/mobile/android/android-emulator-services.js +2 -1
  97. package/lib/common/mobile/android/android-ini-file-parser.js +9 -0
  98. package/lib/common/mobile/android/android-log-filter.js +4 -0
  99. package/lib/common/mobile/android/android-virtual-device-service.js +26 -0
  100. package/lib/common/mobile/android/device-android-debug-bridge.js +1 -0
  101. package/lib/common/mobile/android/genymotion/genymotion-service.js +5 -0
  102. package/lib/common/mobile/android/genymotion/virtualbox-service.js +11 -0
  103. package/lib/common/mobile/android/logcat-helper.js +20 -1
  104. package/lib/common/mobile/application-manager-base.js +6 -0
  105. package/lib/common/mobile/device-emitter.js +4 -0
  106. package/lib/common/mobile/device-log-emitter.js +1 -0
  107. package/lib/common/mobile/device-log-provider-base.js +1 -0
  108. package/lib/common/mobile/device-log-provider.js +23 -0
  109. package/lib/common/mobile/device-platforms-constants.js +1 -0
  110. package/lib/common/mobile/emulator-helper.js +3 -0
  111. package/lib/common/mobile/ios/device/ios-application-manager.js +3 -0
  112. package/lib/common/mobile/ios/device/ios-device-file-system.js +1 -0
  113. package/lib/common/mobile/ios/device/ios-device-operations.js +4 -0
  114. package/lib/common/mobile/ios/device/ios-device.js +4 -0
  115. package/lib/common/mobile/ios/ios-device-base.js +1 -0
  116. package/lib/common/mobile/ios/ios-device-product-name-mapper.js +2 -0
  117. package/lib/common/mobile/ios/ios-log-filter.js +1 -0
  118. package/lib/common/mobile/ios/simulator/ios-emulator-services.js +4 -0
  119. package/lib/common/mobile/ios/simulator/ios-sim-resolver.js +1 -0
  120. package/lib/common/mobile/ios/simulator/ios-simulator-application-manager.js +6 -0
  121. package/lib/common/mobile/ios/simulator/ios-simulator-device.js +5 -0
  122. package/lib/common/mobile/ios/simulator/ios-simulator-file-system.js +1 -0
  123. package/lib/common/mobile/ios/simulator/ios-simulator-log-provider.js +1 -0
  124. package/lib/common/mobile/local-to-device-path-data-factory.js +1 -0
  125. package/lib/common/mobile/log-filter.js +2 -0
  126. package/lib/common/mobile/logging-levels.js +1 -0
  127. package/lib/common/mobile/mobile-core/android-device-discovery.js +2 -0
  128. package/lib/common/mobile/mobile-core/android-emulator-discovery.js +3 -0
  129. package/lib/common/mobile/mobile-core/android-process-service.js +32 -0
  130. package/lib/common/mobile/mobile-core/device-discovery.js +1 -0
  131. package/lib/common/mobile/mobile-core/devices-service.js +72 -3
  132. package/lib/common/mobile/mobile-core/ios-device-discovery.js +3 -1
  133. package/lib/common/mobile/mobile-core/ios-simulator-discovery.js +3 -0
  134. package/lib/common/mobile/mobile-helper.js +2 -1
  135. package/lib/common/mobile/wp8/wp8-emulator-services.js +1 -0
  136. package/lib/common/opener.js +1 -0
  137. package/lib/common/os-info.js +1 -0
  138. package/lib/common/plist-parser.js +1 -0
  139. package/lib/common/project-helper.js +1 -0
  140. package/lib/common/prompter.js +9 -1
  141. package/lib/common/queue.js +1 -0
  142. package/lib/common/resource-loader.js +1 -0
  143. package/lib/common/services/auto-completion-service.js +12 -1
  144. package/lib/common/services/cancellation.js +2 -1
  145. package/lib/common/services/commands-service.js +17 -6
  146. package/lib/common/services/help-service.js +11 -3
  147. package/lib/common/services/hooks-service.js +13 -0
  148. package/lib/common/services/ios-notification-service.js +1 -0
  149. package/lib/common/services/json-file-settings-service.js +6 -0
  150. package/lib/common/services/lock-service.js +6 -0
  151. package/lib/common/services/message-contract-generator.js +1 -0
  152. package/lib/common/services/messages-service.js +1 -0
  153. package/lib/common/services/micro-templating-service.js +6 -0
  154. package/lib/common/services/net-service.js +3 -0
  155. package/lib/common/services/project-files-manager.js +5 -0
  156. package/lib/common/services/project-files-provider-base.js +1 -0
  157. package/lib/common/services/proxy-service.js +1 -0
  158. package/lib/common/services/qr.js +1 -0
  159. package/lib/common/services/settings-service.js +1 -0
  160. package/lib/common/services/xcode-select-service.js +1 -0
  161. package/lib/common/utils.js +1 -0
  162. package/lib/common/validators/project-name-validator.js +1 -0
  163. package/lib/common/validators/validation-result.js +1 -0
  164. package/lib/common/verify-node-version.js +8 -1
  165. package/lib/common/yok.js +32 -11
  166. package/lib/config.js +22 -1
  167. package/lib/constants-provider.js +1 -0
  168. package/lib/constants.js +58 -5
  169. package/lib/controllers/build-controller.js +4 -3
  170. package/lib/controllers/debug-controller.js +8 -3
  171. package/lib/controllers/deploy-controller.js +1 -0
  172. package/lib/controllers/migrate-controller.js +91 -3
  173. package/lib/controllers/platform-controller.js +9 -1
  174. package/lib/controllers/prepare-controller.js +15 -5
  175. package/lib/controllers/run-controller.js +17 -1
  176. package/lib/controllers/update-controller-base.js +1 -0
  177. package/lib/controllers/update-controller.js +11 -0
  178. package/lib/data/build-data.js +1 -0
  179. package/lib/data/controller-data-base.js +1 -0
  180. package/lib/data/debug-data.js +1 -0
  181. package/lib/data/platform-data.js +1 -0
  182. package/lib/data/prepare-data.js +1 -0
  183. package/lib/data/run-data.js +1 -0
  184. package/lib/detached-processes/cleanup-js-subprocess.js +8 -2
  185. package/lib/detached-processes/cleanup-process.js +18 -14
  186. package/lib/detached-processes/file-log-service.js +2 -1
  187. package/lib/device-path-provider.js +3 -2
  188. package/lib/device-sockets/ios/app-debug-socket-proxy-factory.js +7 -0
  189. package/lib/device-sockets/ios/notification.js +3 -0
  190. package/lib/device-sockets/ios/socket-request-executor.js +3 -0
  191. package/lib/helpers/android-bundle-validator-helper.js +2 -1
  192. package/lib/helpers/deploy-command-helper.js +1 -0
  193. package/lib/helpers/key-command-helper.js +4 -2
  194. package/lib/helpers/livesync-command-helper.js +5 -2
  195. package/lib/helpers/network-connectivity-validator.js +1 -0
  196. package/lib/helpers/options-track-helper.js +3 -2
  197. package/lib/helpers/package-path-helper.js +1 -0
  198. package/lib/helpers/platform-command-helper.js +7 -2
  199. package/lib/helpers/version-validator-helper.js +1 -0
  200. package/lib/key-commands/bootstrap.js +3 -2
  201. package/lib/key-commands/index.js +5 -4
  202. package/lib/nativescript-cli-lib-bootstrap.js +4 -0
  203. package/lib/nativescript-cli-lib.js +1 -0
  204. package/lib/nativescript-cli.js +10 -1
  205. package/lib/node/pbxproj-dom-xcode.js +1 -0
  206. package/lib/node/xcode.js +1 -0
  207. package/lib/node-package-manager.js +11 -1
  208. package/lib/options.js +141 -115
  209. package/lib/package-installation-manager.js +8 -1
  210. package/lib/package-manager.js +2 -0
  211. package/lib/platform-command-param.js +1 -0
  212. package/lib/pnpm-package-manager.js +4 -1
  213. package/lib/project-data.js +12 -0
  214. package/lib/providers/project-files-provider.js +1 -0
  215. package/lib/resolvers/livesync-service-resolver.js +2 -1
  216. package/lib/services/analytics/analytics-broker-process.js +10 -6
  217. package/lib/services/analytics/analytics-broker.js +2 -1
  218. package/lib/services/analytics/analytics-service.js +29 -25
  219. package/lib/services/analytics/google-analytics-provider.js +13 -12
  220. package/lib/services/analytics-settings-service.js +5 -0
  221. package/lib/services/android/android-bundle-tool-service.js +1 -0
  222. package/lib/services/android/gradle-build-args-service.js +3 -0
  223. package/lib/services/android/gradle-build-service.js +1 -0
  224. package/lib/services/android/gradle-command-service.js +1 -0
  225. package/lib/services/android-device-debug-service.js +6 -0
  226. package/lib/services/android-plugin-build-service.js +28 -0
  227. package/lib/services/android-project-service.js +71 -4
  228. package/lib/services/android-resources-migration-service.js +7 -0
  229. package/lib/services/apple-portal/apple-portal-application-service.js +1 -0
  230. package/lib/services/apple-portal/apple-portal-cookie-service.js +1 -0
  231. package/lib/services/apple-portal/apple-portal-session-service.js +6 -4
  232. package/lib/services/assets-generation/assets-generation-service.js +16 -5
  233. package/lib/services/build-artifacts-service.js +2 -1
  234. package/lib/services/build-data-service.js +2 -1
  235. package/lib/services/build-info-file-service.js +1 -0
  236. package/lib/services/cleanup-service.js +13 -9
  237. package/lib/services/cocoapods-platform-manager.js +9 -0
  238. package/lib/services/cocoapods-service.js +21 -1
  239. package/lib/services/debug-data-service.js +1 -0
  240. package/lib/services/debug-service-base.js +7 -0
  241. package/lib/services/device/device-install-app-service.js +2 -1
  242. package/lib/services/doctor-service.js +21 -6
  243. package/lib/services/extensibility-service.js +8 -0
  244. package/lib/services/files-hash-service.js +1 -0
  245. package/lib/services/hmr-status-service.js +2 -0
  246. package/lib/services/info-service.js +1 -0
  247. package/lib/services/initialize-service.js +5 -1
  248. package/lib/services/ios/export-options-plist-service.js +4 -0
  249. package/lib/services/ios/ios-signing-service.js +4 -0
  250. package/lib/services/ios/spm-service.js +10 -1
  251. package/lib/services/ios/xcodebuild-args-service.js +13 -4
  252. package/lib/services/ios/xcodebuild-command-service.js +1 -0
  253. package/lib/services/ios/xcodebuild-service.js +1 -0
  254. package/lib/services/ios-debugger-port-service.js +1 -0
  255. package/lib/services/ios-device-debug-service.js +1 -0
  256. package/lib/services/ios-entitlements-service.js +1 -0
  257. package/lib/services/ios-extensions-service.js +1 -0
  258. package/lib/services/ios-log-filter.js +20 -0
  259. package/lib/services/ios-native-target-service.js +6 -4
  260. package/lib/services/ios-project-service.js +29 -7
  261. package/lib/services/ios-provision-service.js +3 -0
  262. package/lib/services/ios-watch-app-service.js +1 -0
  263. package/lib/services/ip-service.js +2 -0
  264. package/lib/services/itmstransporter-service.js +1 -0
  265. package/lib/services/karma-execution.js +2 -0
  266. package/lib/services/livesync/android-device-livesync-service-base.js +1 -0
  267. package/lib/services/livesync/android-device-livesync-service.js +2 -0
  268. package/lib/services/livesync/android-device-livesync-sockets-service.js +3 -0
  269. package/lib/services/livesync/android-livesync-service.js +1 -0
  270. package/lib/services/livesync/android-livesync-tool.js +4 -0
  271. package/lib/services/livesync/device-livesync-service-base.js +2 -0
  272. package/lib/services/livesync/ios-device-livesync-service.js +7 -0
  273. package/lib/services/livesync/ios-livesync-service.js +2 -0
  274. package/lib/services/livesync/livesync-socket.js +1 -0
  275. package/lib/services/livesync/platform-livesync-service-base.js +5 -0
  276. package/lib/services/livesync-process-data-service.js +1 -0
  277. package/lib/services/log-parser-service.js +1 -0
  278. package/lib/services/log-source-map-service.js +15 -0
  279. package/lib/services/marking-mode-service.js +8 -5
  280. package/lib/services/metadata-filtering-service.js +1 -0
  281. package/lib/services/npm-config-service.js +4 -0
  282. package/lib/services/pacote-service.js +7 -0
  283. package/lib/services/performance-service.js +3 -1
  284. package/lib/services/platform/add-platform-service.js +47 -2
  285. package/lib/services/platform/platform-validation-service.js +1 -0
  286. package/lib/services/platform/prepare-native-platform-service.js +5 -2
  287. package/lib/services/platform-environment-requirements.js +8 -3
  288. package/lib/services/platform-project-service-base.js +1 -0
  289. package/lib/services/platforms-data-service.js +1 -0
  290. package/lib/services/plugins-service.js +18 -2
  291. package/lib/services/prepare-data-service.js +2 -1
  292. package/lib/services/project-backup-service.js +4 -0
  293. package/lib/services/project-changes-service.js +12 -3
  294. package/lib/services/project-cleanup-service.js +2 -0
  295. package/lib/services/project-config-service.js +18 -1
  296. package/lib/services/project-data-service.js +36 -7
  297. package/lib/services/project-name-service.js +1 -0
  298. package/lib/services/project-service.js +10 -0
  299. package/lib/services/project-templates-service.js +3 -2
  300. package/lib/services/qr-code-terminal-service.js +1 -0
  301. package/lib/services/require-service.js +1 -0
  302. package/lib/services/start-service.js +1 -0
  303. package/lib/services/temp-service.js +1 -0
  304. package/lib/services/terminal-spinner-service.js +2 -0
  305. package/lib/services/test-execution-service.js +9 -2
  306. package/lib/services/test-initialization-service.js +4 -0
  307. package/lib/services/timeline-profiler-service.js +1 -0
  308. package/lib/services/user-settings-service.js +1 -0
  309. package/lib/services/versions-service.js +6 -4
  310. package/lib/services/watch-ignore-list-service.js +1 -0
  311. package/lib/services/webpack/webpack-compiler-service.js +42 -1
  312. package/lib/services/xcconfig-service.js +2 -0
  313. package/lib/services/xcproj-service.js +1 -0
  314. package/lib/shared-event-bus.js +6 -0
  315. package/lib/sys-info.js +2 -1
  316. package/lib/tools/config-manipulation/config-transformer.js +12 -0
  317. package/lib/tools/node-modules/node-modules-builder.js +1 -0
  318. package/lib/tools/node-modules/node-modules-dependencies-builder.js +6 -0
  319. package/lib/yarn-package-manager.js +1 -0
  320. package/lib/yarn2-package-manager.js +3 -0
  321. package/node_modules/@npmcli/move-file/node_modules/mkdirp/CHANGELOG.md +15 -0
  322. package/node_modules/rimraf/CHANGELOG.md +65 -0
  323. package/node_modules/stringify-package/CHANGELOG.md +16 -0
  324. package/package.json +1 -1
@@ -47,8 +47,12 @@ class NodePackageManager extends base_package_manager_1.BasePackageManager {
47
47
  }
48
48
  params = params.concat(flags);
49
49
  const cwd = pathToSave;
50
+ // Npm creates `etc` directory in installation dir when --prefix is passed
51
+ // https://github.com/npm/npm/issues/11486
52
+ // we should delete it if it was created because of us
50
53
  const etcDirectoryLocation = (0, path_1.join)(cwd, "etc");
51
54
  const etcExistsPriorToInstallation = this.$fs.exists(etcDirectoryLocation);
55
+ //TODO: plamen5kov: workaround is here for a reason (remove whole file later)
52
56
  if (config.path) {
53
57
  let relativePathFromCwdToSource = "";
54
58
  if (config.frameworkPath) {
@@ -64,9 +68,13 @@ class NodePackageManager extends base_package_manager_1.BasePackageManager {
64
68
  }
65
69
  catch (err) {
66
70
  if (err.message && err.message.indexOf("EPEERINVALID") !== -1) {
71
+ // Not installed peer dependencies are treated by npm 2 as errors, but npm 3 treats them as warnings.
72
+ // We'll show them as warnings and let the user install them in case they are needed.
67
73
  this.$logger.warn(err.message);
68
74
  }
69
75
  else {
76
+ // All other errors should be handled by the caller code.
77
+ // Revert package.json contents to preserve valid state
70
78
  this.$fs.writeJson(packageJsonPath, jsonContentBefore);
71
79
  throw err;
72
80
  }
@@ -94,7 +102,7 @@ class NodePackageManager extends base_package_manager_1.BasePackageManager {
94
102
  }
95
103
  view(packageName, config) {
96
104
  return __awaiter(this, void 0, void 0, function* () {
97
- const wrappedConfig = _.extend({}, config, { json: true });
105
+ const wrappedConfig = _.extend({}, config, { json: true }); // always require view response as JSON
98
106
  const flags = this.getFlagsString(wrappedConfig, false);
99
107
  let viewResult;
100
108
  try {
@@ -113,6 +121,7 @@ class NodePackageManager extends base_package_manager_1.BasePackageManager {
113
121
  }
114
122
  searchNpms(keyword) {
115
123
  return __awaiter(this, void 0, void 0, function* () {
124
+ // TODO: Fix the generation of url - in case it contains @ or / , the call may fail.
116
125
  const httpRequestResult = yield this.$httpClient.httpRequest(`https://api.npms.io/v2/search?q=keywords:${keyword}`);
117
126
  const result = JSON.parse(httpRequestResult.body);
118
127
  return result;
@@ -154,3 +163,4 @@ __decorate([
154
163
  ], NodePackageManager.prototype, "getCachePath", null);
155
164
  exports.NodePackageManager = NodePackageManager;
156
165
  yok_1.injector.register("npm", NodePackageManager);
166
+ //# sourceMappingURL=node-package-manager.js.map
package/lib/options.js CHANGED
@@ -22,6 +22,7 @@ class Options {
22
22
  this.setArgv();
23
23
  }
24
24
  this.argv.bundle = "webpack";
25
+ // Check if the user has explicitly provide --hmr and --release options from command line
25
26
  if (this.initialArgv.release && this.initialArgv.hmr) {
26
27
  this.$errors.fail("The options --release and --hmr cannot be used simultaneously.");
27
28
  }
@@ -29,6 +30,8 @@ class Options {
29
30
  this.argv.hmr = !this.argv.release;
30
31
  }
31
32
  if (this.argv.debugBrk) {
33
+ // we cannot use HMR along with debug-brk because we have to restart the app
34
+ // on each livesync in order to stop and allow debugging on app start
32
35
  this.argv.hmr = false;
33
36
  }
34
37
  if (this.argv.justlaunch) {
@@ -46,17 +49,18 @@ class Options {
46
49
  "timeout",
47
50
  "_",
48
51
  "$0",
49
- ];
52
+ ]; // These options shouldn't be validated
50
53
  this.globalOptions = {
51
- log: { type: "string", hasSensitiveValue: false },
52
- verbose: { type: "boolean", hasSensitiveValue: false },
53
- version: { type: "boolean", alias: "v", hasSensitiveValue: false },
54
- help: { type: "boolean", alias: "h", hasSensitiveValue: false },
55
- profileDir: { type: "string", hasSensitiveValue: true },
56
- analyticsClient: { type: "string", hasSensitiveValue: false },
57
- path: { type: "string", alias: "p", hasSensitiveValue: true },
58
- config: { type: "string", alias: "c", hasSensitiveValue: true },
59
- _: { type: "string", hasSensitiveValue: false },
54
+ log: { type: "string" /* OptionType.String */, hasSensitiveValue: false },
55
+ verbose: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
56
+ version: { type: "boolean" /* OptionType.Boolean */, alias: "v", hasSensitiveValue: false },
57
+ help: { type: "boolean" /* OptionType.Boolean */, alias: "h", hasSensitiveValue: false },
58
+ profileDir: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
59
+ analyticsClient: { type: "string" /* OptionType.String */, hasSensitiveValue: false },
60
+ path: { type: "string" /* OptionType.String */, alias: "p", hasSensitiveValue: true },
61
+ config: { type: "string" /* OptionType.String */, alias: "c", hasSensitiveValue: true },
62
+ // This will parse all non-hyphenated values as strings.
63
+ _: { type: "string" /* OptionType.String */, hasSensitiveValue: false },
60
64
  };
61
65
  this.options = _.extend({}, this.commonOptions, this.globalOptions);
62
66
  this.setArgv();
@@ -72,155 +76,157 @@ class Options {
72
76
  }
73
77
  get commonOptions() {
74
78
  return {
75
- ipa: { type: "string", hasSensitiveValue: true },
76
- frameworkPath: { type: "string", hasSensitiveValue: true },
77
- frameworkName: { type: "string", hasSensitiveValue: false },
78
- framework: { type: "string", hasSensitiveValue: false },
79
- frameworkVersion: { type: "string", hasSensitiveValue: false },
80
- forDevice: { type: "boolean", hasSensitiveValue: false },
79
+ ipa: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
80
+ frameworkPath: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
81
+ frameworkName: { type: "string" /* OptionType.String */, hasSensitiveValue: false },
82
+ framework: { type: "string" /* OptionType.String */, hasSensitiveValue: false },
83
+ frameworkVersion: { type: "string" /* OptionType.String */, hasSensitiveValue: false },
84
+ forDevice: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
81
85
  iCloudContainerEnvironment: {
82
- type: "string",
86
+ type: "string" /* OptionType.String */,
83
87
  hasSensitiveValue: false,
84
88
  },
85
- provision: { type: "object", hasSensitiveValue: true },
89
+ provision: { type: "object" /* OptionType.Object */, hasSensitiveValue: true },
86
90
  client: {
87
- type: "boolean",
91
+ type: "boolean" /* OptionType.Boolean */,
88
92
  default: true,
89
93
  hasSensitiveValue: false,
90
94
  },
91
- env: { type: "object", hasSensitiveValue: false },
92
- production: { type: "boolean", hasSensitiveValue: false },
93
- debugTransport: { type: "boolean", hasSensitiveValue: false },
94
- keyStorePath: { type: "string", hasSensitiveValue: true },
95
- keyStorePassword: { type: "string", hasSensitiveValue: true },
96
- keyStoreAlias: { type: "string", hasSensitiveValue: true },
95
+ env: { type: "object" /* OptionType.Object */, hasSensitiveValue: false },
96
+ production: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
97
+ debugTransport: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
98
+ keyStorePath: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
99
+ keyStorePassword: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
100
+ keyStoreAlias: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
97
101
  keyStoreAliasPassword: {
98
- type: "string",
102
+ type: "string" /* OptionType.String */,
99
103
  hasSensitiveValue: true,
100
104
  },
101
- ignoreScripts: { type: "boolean", hasSensitiveValue: false },
102
- disableNpmInstall: { type: "boolean", hasSensitiveValue: false },
103
- compileSdk: { type: "number", hasSensitiveValue: false },
104
- port: { type: "number", hasSensitiveValue: false },
105
- copyTo: { type: "string", hasSensitiveValue: true },
106
- js: { type: "boolean", hasSensitiveValue: false },
107
- javascript: { type: "boolean", hasSensitiveValue: false },
108
- ng: { type: "boolean", hasSensitiveValue: false },
109
- angular: { type: "boolean", hasSensitiveValue: false },
110
- react: { type: "boolean", hasSensitiveValue: false },
111
- reactjs: { type: "boolean", hasSensitiveValue: false },
112
- vue: { type: "boolean", hasSensitiveValue: false },
113
- vuejs: { type: "boolean", hasSensitiveValue: false },
114
- svelte: { type: "boolean", hasSensitiveValue: false },
115
- "vision-ng": { type: "boolean", hasSensitiveValue: false },
116
- "vision-react": { type: "boolean", hasSensitiveValue: false },
117
- "vision-solid": { type: "boolean", hasSensitiveValue: false },
118
- "vision-svelte": { type: "boolean", hasSensitiveValue: false },
119
- "vision-vue": { type: "boolean", hasSensitiveValue: false },
120
- tsc: { type: "boolean", hasSensitiveValue: false },
121
- ts: { type: "boolean", hasSensitiveValue: false },
122
- typescript: { type: "boolean", hasSensitiveValue: false },
123
- yarn: { type: "boolean", hasSensitiveValue: false },
124
- yarn2: { type: "boolean", hasSensitiveValue: false },
125
- pnpm: { type: "boolean", hasSensitiveValue: false },
126
- androidTypings: { type: "boolean", hasSensitiveValue: false },
127
- bundle: { type: "string", hasSensitiveValue: false },
128
- all: { type: "boolean", hasSensitiveValue: false },
129
- teamId: { type: "object", hasSensitiveValue: true },
130
- chrome: { type: "boolean", hasSensitiveValue: false },
131
- inspector: { type: "boolean", hasSensitiveValue: false },
132
- clean: { type: "boolean", hasSensitiveValue: false },
105
+ ignoreScripts: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
106
+ disableNpmInstall: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
107
+ compileSdk: { type: "number" /* OptionType.Number */, hasSensitiveValue: false },
108
+ port: { type: "number" /* OptionType.Number */, hasSensitiveValue: false },
109
+ copyTo: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
110
+ js: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
111
+ javascript: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
112
+ ng: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
113
+ angular: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
114
+ react: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
115
+ reactjs: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
116
+ vue: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
117
+ vuejs: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
118
+ svelte: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
119
+ vision: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
120
+ "vision-ng": { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
121
+ "vision-react": { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
122
+ "vision-solid": { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
123
+ "vision-svelte": { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
124
+ "vision-vue": { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
125
+ tsc: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
126
+ ts: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
127
+ typescript: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
128
+ yarn: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
129
+ yarn2: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
130
+ pnpm: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
131
+ androidTypings: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
132
+ bundle: { type: "string" /* OptionType.String */, hasSensitiveValue: false },
133
+ all: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
134
+ teamId: { type: "object" /* OptionType.Object */, hasSensitiveValue: true },
135
+ chrome: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
136
+ inspector: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
137
+ clean: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
133
138
  watch: {
134
- type: "boolean",
139
+ type: "boolean" /* OptionType.Boolean */,
135
140
  default: true,
136
141
  hasSensitiveValue: false,
137
142
  },
138
- background: { type: "string", hasSensitiveValue: false },
139
- username: { type: "string", hasSensitiveValue: true },
140
- pluginName: { type: "string", hasSensitiveValue: false },
143
+ background: { type: "string" /* OptionType.String */, hasSensitiveValue: false },
144
+ username: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
145
+ pluginName: { type: "string" /* OptionType.String */, hasSensitiveValue: false },
141
146
  includeTypeScriptDemo: {
142
- type: "string",
147
+ type: "string" /* OptionType.String */,
143
148
  hasSensitiveValue: false,
144
149
  },
145
- includeAngularDemo: { type: "string", hasSensitiveValue: false },
150
+ includeAngularDemo: { type: "string" /* OptionType.String */, hasSensitiveValue: false },
146
151
  hmr: {
147
- type: "boolean",
152
+ type: "boolean" /* OptionType.Boolean */,
148
153
  hasSensitiveValue: false,
149
154
  default: true,
150
155
  },
151
156
  collection: {
152
- type: "string",
157
+ type: "string" /* OptionType.String */,
153
158
  alias: "c",
154
159
  hasSensitiveValue: false,
155
160
  },
156
- json: { type: "boolean", hasSensitiveValue: false },
157
- avd: { type: "string", hasSensitiveValue: true },
158
- config: { type: "array", hasSensitiveValue: false },
161
+ json: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
162
+ avd: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
163
+ // check not used
164
+ config: { type: "array" /* OptionType.Array */, hasSensitiveValue: false },
159
165
  insecure: {
160
- type: "boolean",
166
+ type: "boolean" /* OptionType.Boolean */,
161
167
  alias: "k",
162
168
  hasSensitiveValue: false,
163
169
  },
164
- debug: { type: "boolean", alias: "d", hasSensitiveValue: false },
165
- timeout: { type: "string", hasSensitiveValue: false },
166
- device: { type: "string", hasSensitiveValue: true },
167
- availableDevices: { type: "boolean", hasSensitiveValue: false },
168
- appid: { type: "string", hasSensitiveValue: true },
169
- geny: { type: "string", hasSensitiveValue: true },
170
- debugBrk: { type: "boolean", hasSensitiveValue: false },
171
- debugPort: { type: "number", hasSensitiveValue: false },
172
- start: { type: "boolean", hasSensitiveValue: false },
173
- stop: { type: "boolean", hasSensitiveValue: false },
174
- ddi: { type: "string", hasSensitiveValue: true },
175
- justlaunch: { type: "boolean", hasSensitiveValue: false },
176
- file: { type: "string", hasSensitiveValue: true },
177
- force: { type: "boolean", alias: "f", hasSensitiveValue: false },
178
- emulator: { type: "boolean", hasSensitiveValue: false },
179
- simulator: { type: "boolean", hasSensitiveValue: false },
180
- sdk: { type: "string", hasSensitiveValue: false },
181
- template: { type: "string", hasSensitiveValue: true },
182
- certificate: { type: "string", hasSensitiveValue: true },
183
- certificatePassword: { type: "string", hasSensitiveValue: true },
170
+ debug: { type: "boolean" /* OptionType.Boolean */, alias: "d", hasSensitiveValue: false },
171
+ timeout: { type: "string" /* OptionType.String */, hasSensitiveValue: false },
172
+ device: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
173
+ availableDevices: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
174
+ appid: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
175
+ geny: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
176
+ debugBrk: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
177
+ debugPort: { type: "number" /* OptionType.Number */, hasSensitiveValue: false },
178
+ start: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
179
+ stop: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
180
+ ddi: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
181
+ justlaunch: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
182
+ file: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
183
+ force: { type: "boolean" /* OptionType.Boolean */, alias: "f", hasSensitiveValue: false },
184
+ emulator: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
185
+ simulator: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
186
+ sdk: { type: "string" /* OptionType.String */, hasSensitiveValue: false },
187
+ template: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
188
+ certificate: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
189
+ certificatePassword: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
184
190
  release: {
185
- type: "boolean",
191
+ type: "boolean" /* OptionType.Boolean */,
186
192
  alias: "r",
187
193
  hasSensitiveValue: false,
188
194
  },
189
- markingMode: { type: "boolean", hasSensitiveValue: false },
190
- var: { type: "object", hasSensitiveValue: true },
191
- default: { type: "boolean", hasSensitiveValue: false },
192
- count: { type: "number", hasSensitiveValue: false },
193
- analyticsLogFile: { type: "string", hasSensitiveValue: true },
194
- disableAnalytics: { type: "boolean", hasSensitiveValue: false },
195
- cleanupLogFile: { type: "string", hasSensitiveValue: true },
195
+ markingMode: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
196
+ var: { type: "object" /* OptionType.Object */, hasSensitiveValue: true },
197
+ default: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
198
+ count: { type: "number" /* OptionType.Number */, hasSensitiveValue: false },
199
+ analyticsLogFile: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
200
+ disableAnalytics: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
201
+ cleanupLogFile: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
196
202
  hooks: {
197
- type: "boolean",
203
+ type: "boolean" /* OptionType.Boolean */,
198
204
  default: true,
199
205
  hasSensitiveValue: false,
200
206
  },
201
207
  link: {
202
- type: "boolean",
208
+ type: "boolean" /* OptionType.Boolean */,
203
209
  default: false,
204
210
  hasSensitiveValue: false,
205
211
  },
206
- gradlePath: { type: "string", hasSensitiveValue: false },
207
- gradleArgs: { type: "string", hasSensitiveValue: false },
208
- aab: { type: "boolean", hasSensitiveValue: false },
209
- performance: { type: "object", hasSensitiveValue: true },
212
+ gradlePath: { type: "string" /* OptionType.String */, hasSensitiveValue: false },
213
+ gradleArgs: { type: "string" /* OptionType.String */, hasSensitiveValue: false },
214
+ aab: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
215
+ performance: { type: "object" /* OptionType.Object */, hasSensitiveValue: true },
210
216
  appleApplicationSpecificPassword: {
211
- type: "string",
217
+ type: "string" /* OptionType.String */,
212
218
  hasSensitiveValue: true,
213
219
  },
214
- appleSessionBase64: { type: "string", hasSensitiveValue: true },
215
- jar: { type: "string", hasSensitiveValue: true },
216
- aar: { type: "string", hasSensitiveValue: true },
217
- filter: { type: "string", hasSensitiveValue: true },
220
+ appleSessionBase64: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
221
+ jar: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
222
+ aar: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
223
+ filter: { type: "string" /* OptionType.String */, hasSensitiveValue: true },
218
224
  git: {
219
- type: "boolean",
225
+ type: "boolean" /* OptionType.Boolean */,
220
226
  hasSensitiveValue: false,
221
227
  default: true,
222
228
  },
223
- dryRun: { type: "boolean", hasSensitiveValue: false },
229
+ dryRun: { type: "boolean" /* OptionType.Boolean */, hasSensitiveValue: false },
224
230
  };
225
231
  }
226
232
  get optionNames() {
@@ -238,6 +244,7 @@ class Options {
238
244
  parsed[optionName] = this.getOptionValue(optionName);
239
245
  }
240
246
  _.each(parsed, (value, originalOptionName) => {
247
+ // when this.options are passed to yargs, it returns all of them and the ones that are not part of process.argv are set to undefined.
241
248
  if (value === undefined) {
242
249
  return;
243
250
  }
@@ -247,14 +254,14 @@ class Options {
247
254
  this.$errors.failWithHelp(`The option '${originalOptionName}' is not supported.`);
248
255
  }
249
256
  const optionType = this.getOptionType(optionName), optionValue = parsed[optionName];
250
- if (_.isArray(optionValue) && optionType !== "array") {
257
+ if (_.isArray(optionValue) && optionType !== "array" /* OptionType.Array */) {
251
258
  this.$errors.failWithHelp("The '%s' option requires a single value.", originalOptionName);
252
259
  }
253
- else if (optionType === "string" &&
260
+ else if (optionType === "string" /* OptionType.String */ &&
254
261
  helpers.isNullOrWhitespace(optionValue)) {
255
262
  this.$errors.failWithHelp("The option '%s' requires non-empty value.", originalOptionName);
256
263
  }
257
- else if (optionType === "array" &&
264
+ else if (optionType === "array" /* OptionType.Array */ &&
258
265
  optionValue.length === 0) {
259
266
  this.$errors.failWithHelp(`The option '${originalOptionName}' requires one or more values, separated by a space.`);
260
267
  }
@@ -282,9 +289,16 @@ class Options {
282
289
  }
283
290
  return true;
284
291
  }
292
+ // If you pass value with dash, yargs adds it to yargs.argv in two ways:
293
+ // with dash and without dash, replacing first symbol after it with its toUpper equivalent
294
+ // ex, "$ <cli name> emulate android --profile-dir" will add profile-dir to yargs.argv as profile-dir and profileDir
295
+ // IMPORTANT: In your code, it is better to use the value without dashes (profileDir in the example).
296
+ // This way your code will work in case "$ <cli name> emulate android --profile-dir" or "$ <cli name> emulate android --profileDir" is used by user.
285
297
  getNonDashedOptionName(optionName) {
286
298
  const matchUpperCaseLetters = optionName.match(Options.NONDASHED_OPTION_REGEX);
287
299
  if (matchUpperCaseLetters) {
300
+ // get here if option with upperCase letter is specified, for example profileDir
301
+ // check if in knownOptions we have its kebabCase presentation
288
302
  const secondaryOptionName = matchUpperCaseLetters[1] +
289
303
  matchUpperCaseLetters[2].toUpperCase() +
290
304
  matchUpperCaseLetters[3] || "";
@@ -313,15 +327,18 @@ class Options {
313
327
  const args = argv._.slice(1);
314
328
  const commands = yok_1.injector
315
329
  .getRegisteredCommandsNames(false)
316
- .filter((c) => c != "/?");
330
+ .filter((c) => c != "/?"); // remove the /? command, looks weird... :D
317
331
  const currentDepth = args.length > 0 ? args.length - 1 : 0;
318
332
  const current = (_a = current_ !== null && current_ !== void 0 ? current_ : args[currentDepth]) !== null && _a !== void 0 ? _a : "";
333
+ // split all commands into their components ie. "device|list" => ["device", "list"]
319
334
  const matchGroups = commands.map((c) => c.split("|"));
335
+ // find all commands that match the current depth and all the previous args
320
336
  const possibleMatches = matchGroups.filter((group) => {
321
337
  return group.slice(0, currentDepth).every((g, i) => {
322
338
  return g === args[i] || args[i].at(0) === "-";
323
339
  });
324
340
  });
341
+ // filter out duplicates
325
342
  const completions = [
326
343
  ...new Set(possibleMatches
327
344
  .map((match) => {
@@ -329,21 +346,28 @@ class Options {
329
346
  })
330
347
  .filter(Boolean)),
331
348
  ];
349
+ // autocomplete long -- options
332
350
  if (current.startsWith("--")) {
333
351
  return this.optionNames.filter((o) => o !== "_").map((o) => `--${o}`);
334
352
  }
353
+ // autocomple short - options
335
354
  if (current.startsWith("-")) {
336
355
  return this.shorthands.map((o) => `-${o}`);
337
356
  }
357
+ // autocomplete matched completions
338
358
  return completions;
339
359
  }));
340
360
  this.initialArgv = parsed.argv;
341
361
  this.argv = parsed.options(opts).argv;
362
+ // For backwards compatibility
363
+ // Previously profileDir had a default option and calling `this.$options.profileDir` always returned valid result.
364
+ // Now the profileDir should be used from $settingsService, but ensure the `this.$options.profileDir` returns the same value.
342
365
  this.$settingsService.setSettings({
343
366
  profileDir: this.argv.profileDir,
344
367
  });
345
368
  this.argv.profileDir = this.argv["profile-dir"] =
346
369
  this.$settingsService.getProfileDir();
370
+ // if justlaunch is set, it takes precedence over the --watch flag and the default true value
347
371
  if (this.argv.justlaunch) {
348
372
  this.argv.watch = false;
349
373
  }
@@ -359,6 +383,7 @@ class Options {
359
383
  if (this.argv.javascript) {
360
384
  this.argv.js = true;
361
385
  }
386
+ // alias --simulator to --emulator
362
387
  if (this.argv.simulator) {
363
388
  this.argv.emulator = this.argv.simulator;
364
389
  }
@@ -383,3 +408,4 @@ Options.DASHED_OPTION_REGEX = /(.+?)([A-Z])(.*)/;
383
408
  Options.NONDASHED_OPTION_REGEX = /(.+?)[-]([a-zA-Z])(.*)/;
384
409
  exports.Options = Options;
385
410
  yok_1.injector.register("options", Options);
411
+ //# sourceMappingURL=options.js.map
@@ -38,6 +38,7 @@ class PackageInstallationManager {
38
38
  return __awaiter(this, void 0, void 0, function* () {
39
39
  referenceVersion = referenceVersion || this.$staticConfig.version;
40
40
  const isPreReleaseVersion = semver.prerelease(referenceVersion) !== null;
41
+ // if the user has some v.v.v-prerelease-xx.xx pre-release version, include pre-release versions in the search query.
41
42
  const compatibleVersionRange = isPreReleaseVersion
42
43
  ? `~${referenceVersion}`
43
44
  : `~${semver.major(referenceVersion)}.${semver.minor(referenceVersion)}.0`;
@@ -133,13 +134,14 @@ class PackageInstallationManager {
133
134
  getInspectorFromCache(inspectorNpmPackageName, projectDir) {
134
135
  return __awaiter(this, void 0, void 0, function* () {
135
136
  const inspectorPath = path.join(projectDir, constants.NODE_MODULES_FOLDER_NAME, inspectorNpmPackageName);
137
+ // local installation takes precedence over cache
136
138
  if (this.inspectorAlreadyInstalled(inspectorPath)) {
137
139
  return inspectorPath;
138
140
  }
139
141
  const cachePath = this.getInspectorCachePath();
140
142
  this.prepareCacheDir(cachePath);
141
143
  const pathToPackageInCache = path.join(cachePath, constants.NODE_MODULES_FOLDER_NAME, inspectorNpmPackageName);
142
- const iOSFrameworkNSValue = this.$projectDataService.getRuntimePackage(projectDir, "ios");
144
+ const iOSFrameworkNSValue = this.$projectDataService.getRuntimePackage(projectDir, "ios" /* constants.PlatformTypes.ios */);
143
145
  const version = yield this.getLatestCompatibleVersion(inspectorNpmPackageName, iOSFrameworkNSValue.version);
144
146
  let shouldInstall = !this.$fs.exists(pathToPackageInCache);
145
147
  if (!shouldInstall) {
@@ -205,6 +207,10 @@ class PackageInstallationManager {
205
207
  return yield this.$packageManager.install(packageName, pathToSave, npmOptions);
206
208
  });
207
209
  }
210
+ /**
211
+ * This function must not be used with packageName being a URL or local file,
212
+ * because npm view doens't work with those
213
+ */
208
214
  getVersion(packageName, version) {
209
215
  var _a;
210
216
  return __awaiter(this, void 0, void 0, function* () {
@@ -219,3 +225,4 @@ class PackageInstallationManager {
219
225
  }
220
226
  exports.PackageInstallationManager = PackageInstallationManager;
221
227
  yok_1.injector.register("packageInstallationManager", PackageInstallationManager);
228
+ //# sourceMappingURL=package-installation-manager.js.map
@@ -113,6 +113,7 @@ class PackageManager {
113
113
  }
114
114
  }
115
115
  catch (err) {
116
+ // ignore error, but log info
116
117
  this.$logger.trace("Tried to read cli.packageManager from project config and failed. Error is: ", err);
117
118
  }
118
119
  if (pm === constants_1.PackageManagers.yarn || this.$options.yarn) {
@@ -177,3 +178,4 @@ __decorate([
177
178
  ], PackageManager.prototype, "getCachePath", null);
178
179
  exports.PackageManager = PackageManager;
179
180
  yok_1.injector.register("packageManager", PackageManager);
181
+ //# sourceMappingURL=package-manager.js.map
@@ -27,3 +27,4 @@ class PlatformCommandParameter {
27
27
  }
28
28
  exports.PlatformCommandParameter = PlatformCommandParameter;
29
29
  yok_1.injector.register("platformCommandParameter", PlatformCommandParameter);
30
+ //# sourceMappingURL=platform-command-param.js.map
@@ -34,13 +34,14 @@ class PnpmPackageManager extends base_package_manager_1.BasePackageManager {
34
34
  if (config.disableNpmInstall) {
35
35
  return;
36
36
  }
37
- delete config.dev;
37
+ delete config.dev; // temporary fix for unsupported yarn flag
38
38
  if (config.ignoreScripts) {
39
39
  config["ignore-scripts"] = true;
40
40
  }
41
41
  const packageJsonPath = path.join(pathToSave, "package.json");
42
42
  const jsonContentBefore = this.$fs.readJson(packageJsonPath);
43
43
  const flags = this.getFlagsString(config, true);
44
+ // With pnpm we need to install as "flat" or some imports wont be found
44
45
  let params = ["i", "--shamefully-hoist"];
45
46
  const isInstallingAllDependencies = packageName === pathToSave;
46
47
  if (!isInstallingAllDependencies) {
@@ -59,6 +60,7 @@ class PnpmPackageManager extends base_package_manager_1.BasePackageManager {
59
60
  });
60
61
  }
61
62
  uninstall(packageName, config, cwd) {
63
+ // pnpm does not want save option in remove. It saves it by default
62
64
  delete config["save"];
63
65
  const flags = this.getFlagsString(config, false);
64
66
  return this.$childProcess.exec(`pnpm remove ${packageName} ${flags}`, {
@@ -134,3 +136,4 @@ __decorate([
134
136
  ], PnpmPackageManager.prototype, "getCachePath", null);
135
137
  exports.PnpmPackageManager = PnpmPackageManager;
136
138
  yok_1.injector.register("pnpm", PnpmPackageManager);
139
+ //# sourceMappingURL=pnpm-package-manager.js.map
@@ -19,6 +19,7 @@ class ProjectData {
19
19
  this.warnProjectId();
20
20
  return this.projectIdentifiers.ios;
21
21
  }
22
+ //just in case hook/extension modifies it.
22
23
  set projectId(identifier) {
23
24
  this.warnProjectId();
24
25
  this.projectIdentifiers.ios = identifier;
@@ -44,6 +45,7 @@ class ProjectData {
44
45
  return;
45
46
  }
46
47
  projectDir = projectDir || this.$projectHelper.projectDir;
48
+ // If no project found, projectDir should be null
47
49
  if (projectDir) {
48
50
  const projectFilePath = this.getProjectFilePath(projectDir);
49
51
  if (this.$fs.exists(projectFilePath)) {
@@ -107,6 +109,7 @@ class ProjectData {
107
109
  errorInvalidProject(projectDir) {
108
110
  const currentDir = path.resolve(".");
109
111
  this.$logger.trace(`Unable to find project. projectDir: ${projectDir}, options.path: ${this.$options.path}, ${currentDir}`);
112
+ // This is the case when no project file found
110
113
  this.$errors.fail("No project found at or above '%s' and neither was a --path specified.", projectDir || this.$options.path || currentDir);
111
114
  }
112
115
  getProjectFilePath(projectDir) {
@@ -122,6 +125,10 @@ class ProjectData {
122
125
  return this.nsConfig[constants.CONFIG_NS_APP_RESOURCES_ENTRY];
123
126
  }
124
127
  return constants.APP_RESOURCES_FOLDER_NAME;
128
+ // return path.join(
129
+ // this.getAppDirectoryRelativePath(),
130
+ // constants.APP_RESOURCES_FOLDER_NAME
131
+ // );
125
132
  }
126
133
  getAppDirectoryPath(projectDir) {
127
134
  const appRelativePath = this.getAppDirectoryRelativePath();
@@ -135,6 +142,7 @@ class ProjectData {
135
142
  return constants.SRC_DIR;
136
143
  }
137
144
  else {
145
+ // legacy project setup often uses app folder
138
146
  return constants.APP_FOLDER_NAME;
139
147
  }
140
148
  }
@@ -191,6 +199,9 @@ class ProjectData {
191
199
  this.$logger.warn("[WARNING]: IProjectData.projectId is deprecated. Please use IProjectData.projectIdentifiers[platform].");
192
200
  }
193
201
  }
202
+ /**
203
+ * NOTE: Order of the elements is important as the TypeScript dependencies are commonly included in Angular project as well.
204
+ */
194
205
  ProjectData.PROJECT_TYPES = [
195
206
  {
196
207
  type: constants.ProjectTypes.JsFlavorName,
@@ -229,3 +240,4 @@ __decorate([
229
240
  ], ProjectData.prototype, "warnProjectId", null);
230
241
  exports.ProjectData = ProjectData;
231
242
  yok_1.injector.register("projectData", ProjectData, true);
243
+ //# sourceMappingURL=project-data.js.map
@@ -44,3 +44,4 @@ class ProjectFilesProvider extends project_files_provider_base_1.ProjectFilesPro
44
44
  ProjectFilesProvider.INTERNAL_NONPROJECT_FILES = ["**/*.ts"];
45
45
  exports.ProjectFilesProvider = ProjectFilesProvider;
46
46
  yok_1.injector.register("projectFilesProvider", ProjectFilesProvider);
47
+ //# sourceMappingURL=project-files-provider.js.map
@@ -9,7 +9,7 @@ class LiveSyncServiceResolver {
9
9
  this.$mobileHelper = $mobileHelper;
10
10
  }
11
11
  resolveLiveSyncService(platform) {
12
- if (this.$mobileHelper.isApplePlatfrom(platform)) {
12
+ if (this.$mobileHelper.isApplePlatform(platform)) {
13
13
  return this.$injector.resolve("iOSLiveSyncService");
14
14
  }
15
15
  else if (this.$mobileHelper.isAndroidPlatform(platform)) {
@@ -20,3 +20,4 @@ class LiveSyncServiceResolver {
20
20
  }
21
21
  exports.LiveSyncServiceResolver = LiveSyncServiceResolver;
22
22
  yok_1.injector.register("liveSyncServiceResolver", LiveSyncServiceResolver);
23
+ //# sourceMappingURL=livesync-service-resolver.js.map