nativescript 9.0.4-dev.1 → 9.0.4-dev.3

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