nativescript 9.0.4-dev.1 → 9.0.4-dev.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 (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 +11 -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
package/lib/constants.js CHANGED
@@ -149,6 +149,7 @@ exports.RESERVED_TEMPLATE_NAMES = {
149
149
  solidjs: "@nativescript/template-blank-solid",
150
150
  solidts: "@nativescript/template-blank-solid-ts",
151
151
  svelte: "@nativescript/template-blank-svelte",
152
+ // vision templates
152
153
  vision: "@nativescript/template-hello-world-ts-vision",
153
154
  "vision-vue": "@nativescript/template-blank-vue-vision",
154
155
  "vision-ng": "@nativescript/template-hello-world-ng-vision",
@@ -224,6 +225,9 @@ DebugCommandErrors.UNABLE_TO_USE_FOR_DEVICE_AND_EMULATOR = "The options --for-de
224
225
  DebugCommandErrors.NO_DEVICES_EMULATORS_FOUND_FOR_OPTIONS = "Unable to find device or emulator for specified options.";
225
226
  DebugCommandErrors.UNSUPPORTED_DEVICE_OS_FOR_DEBUGGING = "Unsupported device OS for debugging";
226
227
  exports.AnalyticsEventLabelDelimiter = "__";
228
+ /**
229
+ * Used in ProjectDataService to concatenate the names of the properties inside nativescript key of package.json.
230
+ */
227
231
  exports.NATIVESCRIPT_PROPS_INTERNAL_DELIMITER = "**|__**";
228
232
  exports.CLI_RESOURCES_DIR_NAME = "resources";
229
233
  class AssetConstants {
@@ -240,6 +244,7 @@ AssetConstants.assets = "assets";
240
244
  AssetConstants.sizeDelimiter = "x";
241
245
  AssetConstants.defaultScale = 1;
242
246
  AssetConstants.defaultOverlayImageScale = 0.8;
247
+ // https://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history
243
248
  class MacOSVersions {
244
249
  }
245
250
  exports.MacOSVersions = MacOSVersions;
@@ -249,6 +254,14 @@ MacOSVersions.Mojave = "10.14";
249
254
  MacOSVersions.Catalina = "10.15";
250
255
  exports.MacOSDeprecationStringFormat = "NativeScript does not support macOS %s and some functionality may not work. Please, upgrade to the latest macOS version.";
251
256
  exports.XcodeDeprecationStringFormat = "The current Xcode version %s will not be supported in the next release of NativeScript. Consider updating your Xcode to latest official version.";
257
+ // export class TemplateVersions {
258
+ // public static v1 = "v1";
259
+ // public static v2 = "v2";
260
+ // }
261
+ // export class ProjectTemplateErrors {
262
+ // public static InvalidTemplateVersionStringFormat =
263
+ // "The template '%s' has a NativeScript version '%s' that is not supported. Unable to create project from it.";
264
+ // }
252
265
  class Hooks {
253
266
  }
254
267
  exports.Hooks = Hooks;
@@ -289,6 +302,7 @@ AndroidAppBundleMessages.ANDROID_APP_BUNDLE_DOCS_MESSAGE = "What is Android App
289
302
  AndroidAppBundleMessages.ANDROID_APP_BUNDLE_PUBLISH_DOCS_MESSAGE = "How to use Android App Bundle for publishing: https://docs.nativescript.org/tooling/publishing/publishing-android-apps#android-app-bundle";
290
303
  exports.RunOnDeviceEvents = {
291
304
  runOnDeviceStopped: "runOnDeviceStopped",
305
+ // In case we name it error, EventEmitter expects instance of Error to be raised and will also raise uncaught exception in case there's no handler
292
306
  runOnDeviceError: "runOnDeviceError",
293
307
  runOnDeviceExecuted: "runOnDeviceExecuted",
294
308
  runOnDeviceStarted: "runOnDeviceStarted",
@@ -325,14 +339,52 @@ var DeviceConnectionType;
325
339
  })(DeviceConnectionType || (exports.DeviceConnectionType = DeviceConnectionType = {}));
326
340
  var LoggerLevel;
327
341
  (function (LoggerLevel) {
342
+ /**
343
+ * Show all log messages.
344
+ * Log levels are used to assign importance to log messages, with the integer value being used to sort them.
345
+ * If you do not specify anything in your configuration, the default values are used (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)
346
+ */
328
347
  LoggerLevel["ALL"] = "ALL";
348
+ /**
349
+ * Log levels are used to assign importance to log messages, with the integer value being used to sort them.
350
+ * If you do not specify anything in your configuration, the default values are used (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)
351
+ */
329
352
  LoggerLevel["TRACE"] = "TRACE";
353
+ /**
354
+ * Log levels are used to assign importance to log messages, with the integer value being used to sort them.
355
+ * If you do not specify anything in your configuration, the default values are used (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)
356
+ */
330
357
  LoggerLevel["DEBUG"] = "DEBUG";
358
+ /**
359
+ * Log levels are used to assign importance to log messages, with the integer value being used to sort them.
360
+ * If you do not specify anything in your configuration, the default values are used (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)
361
+ */
331
362
  LoggerLevel["INFO"] = "INFO";
363
+ /**
364
+ * Log levels are used to assign importance to log messages, with the integer value being used to sort them.
365
+ * If you do not specify anything in your configuration, the default values are used (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)
366
+ */
332
367
  LoggerLevel["WARN"] = "WARN";
368
+ /**
369
+ * Log levels are used to assign importance to log messages, with the integer value being used to sort them.
370
+ * If you do not specify anything in your configuration, the default values are used (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)
371
+ */
333
372
  LoggerLevel["ERROR"] = "ERROR";
373
+ /**
374
+ * Log levels are used to assign importance to log messages, with the integer value being used to sort them.
375
+ * If you do not specify anything in your configuration, the default values are used (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)
376
+ */
334
377
  LoggerLevel["FATAL"] = "FATAL";
378
+ /**
379
+ * Log levels are used to assign importance to log messages, with the integer value being used to sort them.
380
+ * If you do not specify anything in your configuration, the default values are used (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)
381
+ */
335
382
  LoggerLevel["MARK"] = "MARK";
383
+ /**
384
+ * Disable all logging.
385
+ * Log levels are used to assign importance to log messages, with the integer value being used to sort them.
386
+ * If you do not specify anything in your configuration, the default values are used (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)
387
+ */
336
388
  LoggerLevel["OFF"] = "OFF";
337
389
  })(LoggerLevel || (exports.LoggerLevel = LoggerLevel = {}));
338
390
  var LoggerConfigData;
@@ -350,3 +402,4 @@ var PackageManagers;
350
402
  PackageManagers["yarn2"] = "yarn2";
351
403
  PackageManagers["bun"] = "bun";
352
404
  })(PackageManagers || (exports.PackageManagers = PackageManagers = {}));
405
+ //# sourceMappingURL=constants.js.map
@@ -35,7 +35,7 @@ class BuildController extends events_1.EventEmitter {
35
35
  const platform = buildData.platform.toLowerCase();
36
36
  const projectData = this.$projectDataService.getProjectData(buildData.projectDir);
37
37
  const platformData = this.$platformsDataService.getPlatformData(platform, projectData);
38
- const action = "Build";
38
+ const action = "Build" /* constants.TrackActionNames.Build */;
39
39
  const isForDevice = this.$mobileHelper.isAndroidPlatform(platform)
40
40
  ? null
41
41
  : buildData && buildData.buildForDevice;
@@ -45,8 +45,8 @@ class BuildController extends events_1.EventEmitter {
45
45
  platform,
46
46
  projectDir: projectData.projectDir,
47
47
  additionalData: `${buildData.release ? constants_1.Configurations.Release : constants_1.Configurations.Debug}_${buildData.clean
48
- ? "Clean"
49
- : "Incremental"}`,
48
+ ? "Clean" /* constants.BuildStates.Clean */
49
+ : "Incremental" /* constants.BuildStates.Incremental */}`,
50
50
  });
51
51
  if (buildData.clean) {
52
52
  await platformData.platformProjectService.cleanProject(platformData.projectRoot);
@@ -114,3 +114,4 @@ class BuildController extends events_1.EventEmitter {
114
114
  }
115
115
  exports.BuildController = BuildController;
116
116
  yok_1.injector.register("buildController", BuildController);
117
+ //# sourceMappingURL=build-controller.js.map
@@ -40,13 +40,13 @@ class DebugController extends events_1.EventEmitter {
40
40
  this.$errors.fail(`The device with identifier ${debugData.deviceIdentifier} is unreachable. Make sure it is Trusted and try again.`);
41
41
  }
42
42
  await this.$analyticsService.trackEventActionInGoogleAnalytics({
43
- action: "Debug",
43
+ action: "Debug" /* TrackActionNames.Debug */,
44
44
  device,
45
45
  additionalData: this.$mobileHelper.isiOSPlatform(device.deviceInfo.platform) &&
46
46
  options &&
47
47
  options.inspector
48
- ? "Inspector"
49
- : "Chrome",
48
+ ? "Inspector" /* DebugTools.Inspector */
49
+ : "Chrome" /* DebugTools.Chrome */,
50
50
  projectDir: debugData.projectDir,
51
51
  });
52
52
  if (!(await device.applicationManager.isApplicationInstalled(debugData.applicationIdentifier))) {
@@ -87,6 +87,7 @@ class DebugController extends events_1.EventEmitter {
87
87
  }
88
88
  }
89
89
  async attachDebugger(attachDebuggerData) {
90
+ // Default values
90
91
  if (attachDebuggerData.debugOptions) {
91
92
  attachDebuggerData.debugOptions.chrome =
92
93
  attachDebuggerData.debugOptions.chrome === undefined
@@ -105,6 +106,9 @@ class DebugController extends events_1.EventEmitter {
105
106
  }
106
107
  const projectData = this.$projectDataService.getProjectData(attachDebuggerData.projectDir);
107
108
  const debugData = this.$debugDataService.getDebugData(attachDebuggerData.deviceIdentifier, projectData, attachDebuggerData.debugOptions);
109
+ // const platformData = this.$platformsDataService.getPlatformData(settings.platform, projectData);
110
+ // Of the properties below only `buildForDevice` and `release` are currently used.
111
+ // Leaving the others with placeholder values so that they may not be forgotten in future implementations.
108
112
  const debugInfo = await this.startDebug(debugData);
109
113
  const result = this.printDebugInformation(debugInfo, attachDebuggerData.debugOptions.forceDebuggerAttachedEvent);
110
114
  return result;
@@ -212,3 +216,4 @@ __decorate([
212
216
  (0, decorators_1.performanceLog)()
213
217
  ], DebugController.prototype, "enableDebuggingCoreWithoutWaitingCurrentAction", null);
214
218
  yok_1.injector.register("debugController", DebugController);
219
+ //# sourceMappingURL=debug-controller.js.map
@@ -28,3 +28,4 @@ class DeployController {
28
28
  }
29
29
  exports.DeployController = DeployController;
30
30
  yok_1.injector.register("deployController", DeployController);
31
+ //# sourceMappingURL=deploy-controller.js.map
@@ -13,8 +13,12 @@ const yok_1 = require("../common/yok");
13
13
  const fs = require("fs");
14
14
  const os_1 = require("os");
15
15
  const color_1 = require("../color");
16
+ // const wait: (ms: number) => Promise<void> = (ms: number = 1000) =>
17
+ // new Promise((resolve) => setTimeout(resolve, ms));
16
18
  class MigrateController extends update_controller_base_1.UpdateControllerBase {
17
- constructor($fs, $platformCommandHelper, $platformsDataService, $packageInstallationManager, $packageManager, $pacoteService, $logger, $errors, $pluginsService, $projectDataService, $projectConfigService, $options, $resources, $injector, $settingsService, $staticConfig, $terminalSpinnerService, $projectCleanupService, $projectBackupService, $childProcess) {
19
+ constructor($fs, $platformCommandHelper, $platformsDataService, $packageInstallationManager, $packageManager, $pacoteService,
20
+ // private $androidResourcesMigrationService: IAndroidResourcesMigrationService,
21
+ $logger, $errors, $pluginsService, $projectDataService, $projectConfigService, $options, $resources, $injector, $settingsService, $staticConfig, $terminalSpinnerService, $projectCleanupService, $projectBackupService, $childProcess) {
18
22
  super($fs, $platformCommandHelper, $platformsDataService, $packageInstallationManager, $packageManager, $pacoteService);
19
23
  this.$fs = $fs;
20
24
  this.$platformCommandHelper = $platformCommandHelper;
@@ -152,15 +156,18 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
152
156
  {
153
157
  packageName: "node-sass",
154
158
  replaceWith: "sass",
155
- minVersion: "0.0.0",
159
+ minVersion: "0.0.0", // ignore
156
160
  isDev: true,
161
+ // shouldRemove: true,
157
162
  },
158
163
  {
159
164
  packageName: "sass",
160
- minVersion: "0.0.0",
165
+ minVersion: "0.0.0", // ignore
161
166
  desiredVersion: "^1.49.9",
162
167
  isDev: true,
168
+ // shouldRemove: true,
163
169
  },
170
+ // runtimes
164
171
  {
165
172
  packageName: "tns-ios",
166
173
  minVersion: "6.5.3",
@@ -203,8 +210,10 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
203
210
  remainingPlatforms.push(platform);
204
211
  continue;
205
212
  }
213
+ // should only run in loose mode...
206
214
  const cachedResult = await this.getCachedShouldMigrate(projectDir, platform);
207
215
  this.$logger.trace(`Got cached result for shouldMigrate for platform: ${platform}: ${cachedResult}`);
216
+ // the cached result is only used if it's false, otherwise we need to check again
208
217
  if (cachedResult !== false) {
209
218
  remainingPlatforms.push(platform);
210
219
  }
@@ -216,6 +225,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
216
225
  loose,
217
226
  });
218
227
  this.$logger.trace(`Executed shouldMigrate for platforms: ${remainingPlatforms}. Result is: ${shouldMigrate}`);
228
+ // only cache results if running in loose mode
219
229
  if (!shouldMigrate && loose) {
220
230
  for (const remainingPlatform of remainingPlatforms) {
221
231
  await this.setCachedShouldMigrate(projectDir, remainingPlatform);
@@ -242,37 +252,46 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
242
252
  platforms,
243
253
  loose: loose,
244
254
  });
255
+ // ensure in git repo and require --force if not (for safety)
256
+ // ensure git branch is clean
245
257
  const canMigrate = await this.ensureGitCleanOrForce(projectDir);
246
258
  if (!canMigrate) {
247
259
  this.spinner.fail("Pre-Migration verification failed");
248
260
  return;
249
261
  }
250
262
  this.spinner.succeed("Pre-Migration verification complete");
263
+ // back up project files and folders
251
264
  this.spinner.info("Backing up project files before migration");
252
265
  const backup = await this.backupProject(projectDir);
253
266
  this.spinner.succeed("Project files have been backed up");
267
+ // clean up project files
254
268
  this.spinner.info("Cleaning up project files before migration");
255
269
  await this.cleanUpProject(projectData);
256
270
  this.spinner.succeed("Project files have been cleaned up");
271
+ // clean up artifacts
257
272
  this.spinner.info("Cleaning up old artifacts");
258
273
  await this.handleAutoGeneratedFiles(backup, projectData);
259
274
  this.spinner.succeed("Cleaned old artifacts");
260
275
  const newConfigPath = path.resolve(projectDir, "nativescript.config.ts");
261
276
  if (!this.$fs.exists(newConfigPath)) {
277
+ // migrate configs
262
278
  this.spinner.info(`Migrating project to use ${color_1.color.green("nativescript.config.ts")}`);
263
279
  await this.migrateConfigs(projectDir);
264
280
  this.spinner.succeed(`Project has been migrated to use ${color_1.color.green("nativescript.config.ts")}`);
265
281
  }
282
+ // update dependencies
266
283
  this.spinner.info("Updating project dependencies");
267
284
  await this.migrateDependencies(projectData, platforms, loose);
268
285
  this.spinner.succeed("Project dependencies have been updated");
269
286
  const isAngular = this.hasDependency({
270
287
  packageName: "@nativescript/angular",
271
288
  }, projectData);
289
+ // ensure polyfills.ts exists in angular projects
272
290
  let polyfillsPath;
273
291
  if (isAngular) {
274
292
  polyfillsPath = await this.checkOrCreatePolyfillsTS(projectData);
275
293
  }
294
+ // update tsconfig
276
295
  const tsConfigPath = path.resolve(projectDir, "tsconfig.json");
277
296
  if (this.$fs.exists(tsConfigPath)) {
278
297
  this.spinner.info(`Updating ${color_1.color.yellow("tsconfig.json")}`);
@@ -284,11 +303,19 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
284
303
  this.spinner.succeed(`Updated ${color_1.color.yellow("tsconfig.json")}`);
285
304
  }
286
305
  await this.migrateWebpack5(projectDir, projectData);
306
+ // run @nativescript/eslint over codebase
287
307
  await this.runESLint(projectDir);
288
308
  this.spinner.succeed("Migration complete.");
289
309
  this.$logger.info("");
290
310
  this.$logger.printMarkdown("Project has been successfully migrated. The next step is to run `ns run <platform>` to ensure everything is working properly." +
291
311
  "\n\nPlease note that you may need additional changes to complete the migration.");
312
+ // print markdown for next steps:
313
+ // if no runtime has been added, print a message that it will be added when they run ns run <platform>
314
+ // if all is good, run ns migrate clean to clean up backup folders
315
+ // in case of failure, print diagnostic data: what failed and why
316
+ // restore all files - or perhaps let the user sort it out
317
+ // or ns migrate restore - to restore from pre-migration backup
318
+ // for some known cases, print suggestions perhaps
292
319
  }
293
320
  async _shouldMigrate({ projectDir, platforms, loose, }) {
294
321
  const isMigrate = _.get(this.$options, "argv._[0]") === "migrate";
@@ -305,6 +332,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
305
332
  if (dependency.shouldAddIfMissing) {
306
333
  this.$logger.trace(`${shouldMigrateCommonMessage}'${dependency.packageName}' is missing.`);
307
334
  if (loose) {
335
+ // in loose mode we ignore missing dependencies
308
336
  continue;
309
337
  }
310
338
  return true;
@@ -320,6 +348,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
320
348
  }
321
349
  if (dependency.replaceWith || dependency.shouldRemove) {
322
350
  this.$logger.trace(`${shouldMigrateCommonMessage}'${dependency.packageName}' is deprecated.`);
351
+ // in loose mode we ignore deprecated dependencies
323
352
  if (loose) {
324
353
  continue;
325
354
  }
@@ -362,11 +391,32 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
362
391
  const projectPackageJsonFilePath = path.join(projectDir, constants.PACKAGE_JSON_FILE_NAME);
363
392
  return await this.$fs.getFileShasum(projectPackageJsonFilePath);
364
393
  }
394
+ // private async migrateOldAndroidAppResources(
395
+ // projectData: IProjectData,
396
+ // backupDir: string
397
+ // ) {
398
+ // const appResourcesPath = projectData.getAppResourcesDirectoryPath();
399
+ // if (!this.$androidResourcesMigrationService.hasMigrated(appResourcesPath)) {
400
+ // this.spinner.info("Migrate old Android App_Resources structure.");
401
+ // try {
402
+ // await this.$androidResourcesMigrationService.migrate(
403
+ // appResourcesPath,
404
+ // backupDir
405
+ // );
406
+ // } catch (error) {
407
+ // this.$logger.warn(
408
+ // "Migrate old Android App_Resources structure failed: ",
409
+ // error.message
410
+ // );
411
+ // }
412
+ // }
413
+ // }
365
414
  async ensureGitCleanOrForce(projectDir) {
366
415
  const git = (0, simple_git_1.default)(projectDir);
367
416
  const isGit = await git.checkIsRepo();
368
417
  const isForce = this.$options.force;
369
418
  if (!isGit) {
419
+ // not a git repo and no --force
370
420
  if (!isForce) {
371
421
  this.$logger.printMarkdown(`Running \`ns migrate\` in a non-git project is not recommended. If you want to skip this check run \`ns migrate --force\`.`);
372
422
  this.$errors.fail("Not in Git repo.");
@@ -413,6 +463,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
413
463
  const { dependencies, devDependencies } = await this.$pluginsService.getDependenciesFromPackageJson(projectData.projectDir);
414
464
  const hasSchematics = [...dependencies, ...devDependencies].find((p) => p.name === "@nativescript/schematics");
415
465
  if (!hasSchematics) {
466
+ // clean tsconfig.tns.json if not in a shared project
416
467
  await this.$projectCleanupService.clean([
417
468
  constants.TSCCONFIG_TNS_JSON_NAME,
418
469
  ]);
@@ -459,12 +510,14 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
459
510
  });
460
511
  }
461
512
  isOutdatedVersion(current, target, loose) {
513
+ // in loose mode, a falsy version is not considered outdated
462
514
  if (!current && loose) {
463
515
  return false;
464
516
  }
465
517
  const installed = semver.coerce(current);
466
518
  const min = semver.coerce(target.minVersion);
467
519
  const desired = semver.coerce(target.desiredVersion);
520
+ // in loose mode we check if we satisfy the min version
468
521
  if (loose) {
469
522
  if (!installed || !min) {
470
523
  return false;
@@ -474,6 +527,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
474
527
  if (!installed || !desired) {
475
528
  return true;
476
529
  }
530
+ // otherwise we compare with the desired version
477
531
  return semver.lt(installed, desired);
478
532
  }
479
533
  detectAppPath(projectDir, configData) {
@@ -536,6 +590,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
536
590
  async migrateDependency(dependency, projectData, loose) {
537
591
  var _a, _b, _c, _d, _e;
538
592
  const hasDependency = this.hasDependency(dependency, projectData);
593
+ // show warning if needed
539
594
  if (hasDependency && dependency.warning) {
540
595
  this.$logger.warn(dependency.warning);
541
596
  }
@@ -551,7 +606,9 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
551
606
  return;
552
607
  }
553
608
  if (dependency.replaceWith || dependency.shouldRemove) {
609
+ // remove
554
610
  this.$pluginsService.removeFromPackageJson(dependency.packageName, projectData.projectDir);
611
+ // no replacement required - we're done
555
612
  if (!dependency.replaceWith) {
556
613
  return;
557
614
  }
@@ -560,6 +617,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
560
617
  this.$errors.fail("Failed to find replacement dependency.");
561
618
  }
562
619
  const version = (_d = (_c = (_b = replacementDep.desiredVersion) !== null && _b !== void 0 ? _b : replacementDep.minVersion) !== null && _c !== void 0 ? _c : dependency.desiredVersion) !== null && _d !== void 0 ? _d : dependency.minVersion;
620
+ // add replacement dependency
563
621
  this.$pluginsService.addToPackageJson(replacementDep.packageName, version, replacementDep.isDev, projectData.projectDir);
564
622
  this.spinner.clear();
565
623
  this.$logger.info(` - ${color_1.color.yellow(dependency.packageName)} has been replaced with ${color_1.color.cyan(replacementDep.packageName)} ${color_1.color.green(version)}`);
@@ -579,40 +637,57 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
579
637
  }
580
638
  async migrateConfigs(projectDir) {
581
639
  const projectData = this.$projectDataService.getProjectData(projectDir);
640
+ // package.json
582
641
  const rootPackageJsonPath = path.resolve(projectDir, constants.PACKAGE_JSON_FILE_NAME);
642
+ // nested package.json
583
643
  const embeddedPackageJsonPath = path.resolve(projectData.projectDir, projectData.getAppDirectoryRelativePath(), constants.PACKAGE_JSON_FILE_NAME);
644
+ // nsconfig.json
584
645
  const legacyNsConfigPath = path.resolve(projectData.projectDir, constants.CONFIG_NS_FILE_NAME);
585
646
  let rootPackageJsonData = {};
586
647
  if (this.$fs.exists(rootPackageJsonPath)) {
587
648
  rootPackageJsonData = this.$fs.readJson(rootPackageJsonPath);
588
649
  }
650
+ // write the default config unless it already exists
589
651
  const newConfigPath = this.$projectConfigService.writeDefaultConfig(projectData.projectDir);
652
+ // force legacy config mode
590
653
  this.$projectConfigService.setForceUsingLegacyConfig(true);
654
+ // all different sources are combined into configData (nested package.json, nsconfig and root package.json[nativescript])
591
655
  const configData = this.$projectConfigService.readConfig(projectData.projectDir);
656
+ // we no longer want to force legacy config mode
592
657
  this.$projectConfigService.setForceUsingLegacyConfig(false);
658
+ // move main key into root package.json
593
659
  if (configData.main) {
594
660
  rootPackageJsonData.main = configData.main;
595
661
  delete configData.main;
596
662
  }
663
+ // detect appPath and App_Resources path
597
664
  configData.appPath = this.detectAppPath(projectDir, configData);
598
665
  configData.appResourcesPath = this.detectAppResourcesPath(projectDir, configData);
666
+ // delete nativescript key from root package.json
599
667
  if (rootPackageJsonData.nativescript) {
600
668
  delete rootPackageJsonData.nativescript;
601
669
  }
670
+ // force the config service to use nativescript.config.ts
602
671
  this.$projectConfigService.setForceUsingNewConfig(true);
603
- const hasUpdatedConfigSuccessfully = await this.$projectConfigService.setValue("", configData);
672
+ // migrate data into nativescript.config.ts
673
+ const hasUpdatedConfigSuccessfully = await this.$projectConfigService.setValue("", // root
674
+ configData);
604
675
  if (!hasUpdatedConfigSuccessfully) {
605
676
  if (typeof newConfigPath === "string") {
677
+ // only clean the config if it was created by the migration script
606
678
  await this.$projectCleanupService.cleanPath(newConfigPath);
607
679
  }
608
680
  this.$errors.fail(`Failed to migrate project to use ${constants.CONFIG_FILE_NAME_TS}. One or more values could not be updated.`);
609
681
  }
682
+ // save root package.json
610
683
  this.$fs.writeJson(rootPackageJsonPath, rootPackageJsonData);
684
+ // delete migrated files
611
685
  await this.$projectCleanupService.cleanPath(embeddedPackageJsonPath);
612
686
  await this.$projectCleanupService.cleanPath(legacyNsConfigPath);
613
687
  return true;
614
688
  }
615
689
  async migrateUnitTestRunner(projectData, migrationBackupDirPath) {
690
+ // Migrate karma.conf.js
616
691
  const pathToKarmaConfig = path.join(migrationBackupDirPath, constants.KARMA_CONFIG_NAME);
617
692
  if (this.$fs.exists(pathToKarmaConfig)) {
618
693
  const oldKarmaContent = this.$fs.readText(pathToKarmaConfig);
@@ -630,6 +705,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
630
705
  });
631
706
  this.$fs.writeFile(path.join(projectData.projectDir, constants.KARMA_CONFIG_NAME), karmaConf);
632
707
  }
708
+ // Dependencies to migrate
633
709
  const dependencies = [
634
710
  {
635
711
  packageName: "karma-webpack",
@@ -671,6 +747,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
671
747
  async migrateTSConfig({ tsConfigPath, isAngular, polyfillsPath, }) {
672
748
  try {
673
749
  const configContents = this.$fs.readJson(tsConfigPath);
750
+ // update
674
751
  configContents.compilerOptions = configContents.compilerOptions || {};
675
752
  configContents.compilerOptions.target = "es2020";
676
753
  configContents.compilerOptions.module = "esnext";
@@ -681,6 +758,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
681
758
  ...new Set([...(configContents.compilerOptions.lib || []), "ESNext"]),
682
759
  ];
683
760
  if (isAngular) {
761
+ // make sure polyfills.ts is in files
684
762
  if (configContents.files) {
685
763
  configContents.files = [
686
764
  ...new Set([
@@ -712,8 +790,10 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
712
790
  return "./" + path.relative(projectDir, polyfillsPath);
713
791
  }
714
792
  const tempDir = fs.mkdtempSync(path.join((0, os_1.tmpdir)(), "migrate-angular-polyfills-"));
793
+ // get from default angular template
715
794
  await this.$pacoteService.extractPackage(constants.RESERVED_TEMPLATE_NAMES["angular"], tempDir);
716
795
  this.$fs.copyFile(path.resolve(tempDir, "src/polyfills.ts"), possiblePaths[0]);
796
+ // clean up temp project
717
797
  this.$fs.deleteDirectory(tempDir);
718
798
  this.spinner.succeed(`Created fresh ${color_1.color.cyan("polyfills.ts")}`);
719
799
  return "./" + path.relative(projectDir, possiblePaths[0]);
@@ -782,6 +862,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
782
862
  desiredVersion: "~0.15.0",
783
863
  shouldAddIfMissing: true,
784
864
  },
865
+ // devDependencies
785
866
  {
786
867
  packageName: "@angular/cli",
787
868
  minVersion,
@@ -852,10 +933,12 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
852
933
  packageName: "@babel/preset-env",
853
934
  shouldRemove: true,
854
935
  },
936
+ // remove any version of vue
855
937
  {
856
938
  packageName: "vue",
857
939
  shouldRemove: true,
858
940
  },
941
+ // add latest
859
942
  {
860
943
  packageName: "vue",
861
944
  desiredVersion: "2.6.12",
@@ -951,6 +1034,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
951
1034
  return;
952
1035
  }
953
1036
  }
1037
+ // clean old config before generating new one
954
1038
  await this.$projectCleanupService.clean(["webpack.config.js"]);
955
1039
  this.spinner.info(`Initializing new ${color_1.color.yellow("webpack.config.js")}`);
956
1040
  const { desiredVersion: webpackVersion } = this.migrationDependencies.find((dep) => dep.packageName === constants.WEBPACK_PLUGIN_NAME);
@@ -1025,6 +1109,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
1025
1109
  }
1026
1110
  }
1027
1111
  exports.MigrateController = MigrateController;
1112
+ // static readonly typescriptPackageName: string = "typescript";
1028
1113
  MigrateController.backupFolderName = ".migration_backup";
1029
1114
  MigrateController.pathsToBackup = [
1030
1115
  constants.LIB_DIR_NAME,
@@ -1037,3 +1122,4 @@ MigrateController.pathsToBackup = [
1037
1122
  constants.CONFIG_NS_FILE_NAME,
1038
1123
  ];
1039
1124
  yok_1.injector.register("migrateController", MigrateController);
1125
+ //# sourceMappingURL=migrate-controller.js.map
@@ -84,9 +84,13 @@ class PlatformController {
84
84
  desiredRuntimePackage.version = version;
85
85
  }
86
86
  if (!desiredRuntimePackage.version) {
87
+ // if no version is explicitly added, then we use the latest
87
88
  desiredRuntimePackage.version =
88
89
  await this.$packageInstallationManager.getLatestCompatibleVersion(desiredRuntimePackage.name);
89
90
  }
91
+ // const currentPlatformData = this.$projectDataService.getNSValue(projectData.projectDir, platformData.frameworkPackageName);
92
+ // version = (currentPlatformData && currentPlatformData.version) ||
93
+ // await this.$packageInstallationManager.getLatestCompatibleVersion(platformData.frameworkPackageName);
90
94
  result = `${desiredRuntimePackage.name}@${desiredRuntimePackage.version}`;
91
95
  }
92
96
  return result;
@@ -98,11 +102,14 @@ class PlatformController {
98
102
  const prepareInfo = this.$projectChangesService.getPrepareInfo(platformData);
99
103
  const requiresNativePlatformAdd = prepareInfo &&
100
104
  prepareInfo.nativePlatformStatus ===
101
- "1";
105
+ "1" /* NativePlatformStatus.requiresPlatformAdd */;
102
106
  const shouldAddPlatform = !hasPlatformDirectory ||
103
107
  (shouldAddNativePlatform && requiresNativePlatformAdd);
104
108
  if (hasPlatformDirectory && !shouldAddPlatform) {
105
109
  const platformDirectoryItemCount = this.$fs.readDirectory(path.join(projectData.platformsDir, platformName)).length;
110
+ // 2 is a magic number to approximate a valid platform folder
111
+ // any valid platform should contain at least 2 files/folders
112
+ // we choose 2 to avoid false-positives due to system files like .DS_Store etc.
106
113
  if (platformDirectoryItemCount <= 2) {
107
114
  this.$logger.warn(`The platforms/${platformName} folder appears to be invalid. If the build fails, run 'ns clean' and rebuild the app.`, { wrapMessageWithBorders: true });
108
115
  }
@@ -112,3 +119,4 @@ class PlatformController {
112
119
  }
113
120
  exports.PlatformController = PlatformController;
114
121
  yok_1.injector.register("platformController", PlatformController);
122
+ //# sourceMappingURL=platform-controller.js.map
@@ -76,6 +76,10 @@ class PrepareController extends events_1.EventEmitter {
76
76
  await this.$platformController.addPlatformIfNeeded(prepareData, projectData);
77
77
  await this.trackRuntimeVersion(prepareData.platform, projectData);
78
78
  this.$logger.info("Preparing project...");
79
+ // we need to mark the ~/package.json (used by core modules)
80
+ // as external for us to be able to write the config to it
81
+ // in writeRuntimePackageJson() below, because otherwise
82
+ // webpack will inline it into the bundle/vendor chunks
79
83
  prepareData.env = prepareData.env || {};
80
84
  prepareData.env.externals = prepareData.env.externals || [];
81
85
  prepareData.env.externals.push("~/package.json");
@@ -116,8 +120,8 @@ class PrepareController extends events_1.EventEmitter {
116
120
  },
117
121
  };
118
122
  }
119
- await this.startJSWatcherWithPrepare(platformData, projectData, prepareData);
120
- const hasNativeChanges = await this.startNativeWatcherWithPrepare(platformData, projectData, prepareData);
123
+ await this.startJSWatcherWithPrepare(platformData, projectData, prepareData); // -> start watcher + initial compilation
124
+ const hasNativeChanges = await this.startNativeWatcherWithPrepare(platformData, projectData, prepareData); // -> start watcher + initial prepare
121
125
  const result = {
122
126
  platform: platformData.platformNameLowerCase,
123
127
  hasNativeChanges,
@@ -126,6 +130,7 @@ class PrepareController extends events_1.EventEmitter {
126
130
  if (hasPersistedDataWithNativeChanges) {
127
131
  result.hasNativeChanges = true;
128
132
  }
133
+ // TODO: Do not persist this in `this` context. Also it should be per platform.
129
134
  this.isInitialPrepareReady = true;
130
135
  if (this.persistedData && this.persistedData.length) {
131
136
  this.emitPrepareEvent({
@@ -178,7 +183,7 @@ class PrepareController extends events_1.EventEmitter {
178
183
  pollInterval: 100,
179
184
  stabilityThreshold: 500,
180
185
  },
181
- ignored: ["**/.*", ".*"],
186
+ ignored: ["**/.*", ".*"], // hidden files
182
187
  };
183
188
  const watcher = (0, chokidar_1.watch)(patterns, watcherOptions).on("all", async (event, filePath) => {
184
189
  if (this.isFileWatcherPaused())
@@ -220,6 +225,9 @@ class PrepareController extends events_1.EventEmitter {
220
225
  .concat(pluginsPackageJsonFiles);
221
226
  return patterns;
222
227
  }
228
+ /**
229
+ * TODO: move this logic to the webpack side of things - WIP and deprecate here with a webpack version check...
230
+ */
223
231
  async writeRuntimePackageJson(projectData, platformData, prepareData = null) {
224
232
  const configInfo = this.$projectConfigService.detectProjectConfigs(projectData.projectDir);
225
233
  if (configInfo.usingNSConfig) {
@@ -252,7 +260,11 @@ class PrepareController extends events_1.EventEmitter {
252
260
  packagePath = path.join(platformData.projectRoot, this.$options.hostProjectModuleName, "src", this.$options.hostProjectPath ? "nativescript" : "main", "assets", "app", "package.json");
253
261
  }
254
262
  try {
263
+ // this will read the package.json that is already emitted by
264
+ // the GenerateNativeScriptEntryPointsPlugin webpack plugin
255
265
  const emittedPackageData = this.$fs.readJson(packagePath);
266
+ // since ns7 we only care about the main key from the emitted
267
+ // package.json, the rest is coming from the new config.
256
268
  if (emittedPackageData === null || emittedPackageData === void 0 ? void 0 : emittedPackageData.main) {
257
269
  packageData.main = emittedPackageData.main;
258
270
  }
@@ -280,7 +292,7 @@ class PrepareController extends events_1.EventEmitter {
280
292
  return;
281
293
  }
282
294
  await this.$analyticsService.trackEventActionInGoogleAnalytics({
283
- action: "Using Runtime Version",
295
+ action: "Using Runtime Version" /* TrackActionNames.UsingRuntimeVersion */,
284
296
  additionalData: `${platform.toLowerCase()}${constants_1.AnalyticsEventLabelDelimiter}${version}`,
285
297
  });
286
298
  }
@@ -325,3 +337,4 @@ __decorate([
325
337
  (0, decorators_1.cache)()
326
338
  ], PrepareController.prototype, "trackRuntimeVersion", null);
327
339
  yok_1.injector.register("prepareController", PrepareController);
340
+ //# sourceMappingURL=prepare-controller.js.map