nativescript 8.8.0 → 8.8.1
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.
- package/config/test-deps-versions-generated.json +1 -1
- package/lib/android-tools-info.js +12 -0
- package/lib/base-package-manager.js +11 -1
- package/lib/bootstrap.js +5 -1
- package/lib/bun-package-manager.js +17 -1
- package/lib/color.js +3 -0
- package/lib/commands/add-platform.js +1 -0
- package/lib/commands/apple-login.js +1 -0
- package/lib/commands/appstore-list.js +1 -0
- package/lib/commands/appstore-upload.js +4 -0
- package/lib/commands/build.js +3 -2
- package/lib/commands/clean.js +22 -1
- package/lib/commands/command-base.js +1 -0
- package/lib/commands/config.js +3 -0
- package/lib/commands/create-project.js +6 -0
- package/lib/commands/debug.js +6 -1
- package/lib/commands/deploy.js +3 -2
- package/lib/commands/embedding/embed.js +7 -0
- package/lib/commands/extensibility/install-extension.js +1 -0
- package/lib/commands/extensibility/list-extensions.js +1 -0
- package/lib/commands/extensibility/uninstall-extension.js +1 -0
- package/lib/commands/fonts.js +1 -0
- package/lib/commands/generate-assets.js +1 -0
- package/lib/commands/generate-help.js +1 -0
- package/lib/commands/generate.js +12 -2
- package/lib/commands/info.js +1 -0
- package/lib/commands/install.js +1 -0
- package/lib/commands/list-platforms.js +1 -0
- package/lib/commands/migrate.js +1 -0
- package/lib/commands/native-add.js +5 -0
- package/lib/commands/platform-clean.js +1 -0
- package/lib/commands/plugin/add-plugin.js +1 -0
- package/lib/commands/plugin/build-plugin.js +1 -0
- package/lib/commands/plugin/create-plugin.js +5 -0
- package/lib/commands/plugin/list-plugins.js +1 -0
- package/lib/commands/plugin/remove-plugin.js +2 -0
- package/lib/commands/plugin/update-plugin.js +1 -0
- package/lib/commands/post-install.js +6 -0
- package/lib/commands/prepare.js +4 -3
- package/lib/commands/preview.js +2 -0
- package/lib/commands/remove-platform.js +1 -0
- package/lib/commands/resources/resources-update.js +2 -0
- package/lib/commands/run.js +1 -0
- package/lib/commands/setup.js +1 -0
- package/lib/commands/start.js +1 -0
- package/lib/commands/test-init.js +4 -0
- package/lib/commands/test.js +9 -2
- package/lib/commands/typings.js +2 -1
- package/lib/commands/update-platform.js +5 -0
- package/lib/commands/update.js +2 -0
- package/lib/common/bootstrap.js +1 -0
- package/lib/common/child-process.js +3 -0
- package/lib/common/codeGeneration/code-entity.js +1 -0
- package/lib/common/codeGeneration/code-printer.js +1 -0
- package/lib/common/command-params.js +1 -0
- package/lib/common/commands/analytics.js +3 -0
- package/lib/common/commands/autocompletion.js +3 -0
- package/lib/common/commands/device/device-log-stream.js +1 -0
- package/lib/common/commands/device/get-file.js +2 -0
- package/lib/common/commands/device/list-applications.js +1 -0
- package/lib/common/commands/device/list-devices.js +3 -0
- package/lib/common/commands/device/list-files.js +2 -0
- package/lib/common/commands/device/put-file.js +2 -0
- package/lib/common/commands/device/run-application.js +1 -0
- package/lib/common/commands/device/stop-application.js +1 -0
- package/lib/common/commands/device/uninstall-application.js +1 -0
- package/lib/common/commands/doctor.js +3 -2
- package/lib/common/commands/generate-messages.js +1 -0
- package/lib/common/commands/help.js +1 -0
- package/lib/common/commands/package-manager-get.js +1 -0
- package/lib/common/commands/package-manager-set.js +1 -0
- package/lib/common/commands/post-install.js +1 -0
- package/lib/common/commands/preuninstall.js +11 -2
- package/lib/common/commands/proxy/proxy-base.js +4 -0
- package/lib/common/commands/proxy/proxy-clear.js +1 -0
- package/lib/common/commands/proxy/proxy-get.js +1 -0
- package/lib/common/commands/proxy/proxy-set.js +1 -0
- package/lib/common/common-lib.js +1 -0
- package/lib/common/constants.js +11 -0
- package/lib/common/decorators.js +48 -0
- package/lib/common/dispatchers.js +10 -1
- package/lib/common/errors.js +13 -3
- package/lib/common/file-system.js +13 -2
- package/lib/common/header.js +3 -0
- package/lib/common/helpers.js +89 -3
- package/lib/common/host-info.js +4 -0
- package/lib/common/http-client.js +20 -0
- package/lib/common/logger/appenders/cli-appender.js +4 -0
- package/lib/common/logger/appenders/emit-appender.js +4 -0
- package/lib/common/logger/layouts/cli-layout.js +1 -0
- package/lib/common/logger/logger.js +5 -0
- package/lib/common/messages/messages.js +6 -0
- package/lib/common/mobile/android/android-application-manager.js +20 -1
- package/lib/common/mobile/android/android-debug-bridge-result-handler.js +1 -0
- package/lib/common/mobile/android/android-debug-bridge.js +6 -0
- package/lib/common/mobile/android/android-device-file-system.js +4 -0
- package/lib/common/mobile/android/android-device-hash-service.js +3 -0
- package/lib/common/mobile/android/android-device.js +8 -0
- package/lib/common/mobile/android/android-emulator-services.js +2 -1
- package/lib/common/mobile/android/android-ini-file-parser.js +9 -0
- package/lib/common/mobile/android/android-log-filter.js +4 -0
- package/lib/common/mobile/android/android-virtual-device-service.js +30 -1
- package/lib/common/mobile/android/device-android-debug-bridge.js +1 -0
- package/lib/common/mobile/android/genymotion/genymotion-service.js +5 -0
- package/lib/common/mobile/android/genymotion/virtualbox-service.js +11 -0
- package/lib/common/mobile/android/logcat-helper.js +13 -0
- package/lib/common/mobile/application-manager-base.js +6 -0
- package/lib/common/mobile/device-emitter.js +4 -0
- package/lib/common/mobile/device-log-emitter.js +1 -0
- package/lib/common/mobile/device-log-provider-base.js +1 -0
- package/lib/common/mobile/device-log-provider.js +23 -0
- package/lib/common/mobile/device-platforms-constants.js +1 -0
- package/lib/common/mobile/emulator-helper.js +4 -0
- package/lib/common/mobile/ios/device/ios-application-manager.js +3 -0
- package/lib/common/mobile/ios/device/ios-device-file-system.js +1 -0
- package/lib/common/mobile/ios/device/ios-device-operations.js +4 -0
- package/lib/common/mobile/ios/device/ios-device.js +4 -0
- package/lib/common/mobile/ios/ios-device-base.js +1 -0
- package/lib/common/mobile/ios/ios-device-product-name-mapper.js +2 -0
- package/lib/common/mobile/ios/ios-log-filter.js +1 -0
- package/lib/common/mobile/ios/simulator/ios-emulator-services.js +4 -0
- package/lib/common/mobile/ios/simulator/ios-sim-resolver.js +1 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-application-manager.js +6 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-device.js +5 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-file-system.js +1 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-log-provider.js +1 -0
- package/lib/common/mobile/local-to-device-path-data-factory.js +1 -0
- package/lib/common/mobile/log-filter.js +2 -0
- package/lib/common/mobile/logging-levels.js +1 -0
- package/lib/common/mobile/mobile-core/android-device-discovery.js +2 -0
- package/lib/common/mobile/mobile-core/android-emulator-discovery.js +3 -0
- package/lib/common/mobile/mobile-core/android-process-service.js +32 -0
- package/lib/common/mobile/mobile-core/device-discovery.js +1 -0
- package/lib/common/mobile/mobile-core/devices-service.js +69 -0
- package/lib/common/mobile/mobile-core/ios-device-discovery.js +2 -0
- package/lib/common/mobile/mobile-core/ios-simulator-discovery.js +3 -0
- package/lib/common/mobile/mobile-helper.js +1 -0
- package/lib/common/mobile/wp8/wp8-emulator-services.js +1 -0
- package/lib/common/opener.js +1 -0
- package/lib/common/os-info.js +1 -0
- package/lib/common/plist-parser.js +1 -0
- package/lib/common/project-helper.js +1 -0
- package/lib/common/prompter.js +9 -1
- package/lib/common/queue.js +1 -0
- package/lib/common/resource-loader.js +1 -0
- package/lib/common/services/auto-completion-service.js +13 -1
- package/lib/common/services/cancellation.js +2 -1
- package/lib/common/services/commands-service.js +17 -6
- package/lib/common/services/help-service.js +11 -3
- package/lib/common/services/hooks-service.js +13 -0
- package/lib/common/services/ios-notification-service.js +1 -0
- package/lib/common/services/json-file-settings-service.js +6 -0
- package/lib/common/services/lock-service.js +6 -0
- package/lib/common/services/message-contract-generator.js +1 -0
- package/lib/common/services/messages-service.js +1 -0
- package/lib/common/services/micro-templating-service.js +6 -0
- package/lib/common/services/net-service.js +3 -0
- package/lib/common/services/project-files-manager.js +5 -0
- package/lib/common/services/project-files-provider-base.js +1 -0
- package/lib/common/services/proxy-service.js +1 -0
- package/lib/common/services/qr.js +1 -0
- package/lib/common/services/settings-service.js +1 -0
- package/lib/common/services/xcode-select-service.js +1 -0
- package/lib/common/utils.js +1 -0
- package/lib/common/validators/project-name-validator.js +1 -0
- package/lib/common/validators/validation-result.js +1 -0
- package/lib/common/verify-node-version.js +8 -1
- package/lib/common/yok.js +32 -11
- package/lib/config.js +22 -1
- package/lib/constants-provider.js +1 -0
- package/lib/constants.js +53 -0
- package/lib/controllers/build-controller.js +4 -3
- package/lib/controllers/debug-controller.js +8 -3
- package/lib/controllers/deploy-controller.js +1 -0
- package/lib/controllers/migrate-controller.js +91 -3
- package/lib/controllers/platform-controller.js +9 -1
- package/lib/controllers/prepare-controller.js +17 -4
- package/lib/controllers/run-controller.js +17 -1
- package/lib/controllers/update-controller-base.js +1 -0
- package/lib/controllers/update-controller.js +11 -0
- package/lib/data/build-data.js +1 -0
- package/lib/data/controller-data-base.js +1 -0
- package/lib/data/debug-data.js +1 -0
- package/lib/data/platform-data.js +1 -0
- package/lib/data/prepare-data.js +1 -0
- package/lib/data/run-data.js +1 -0
- package/lib/detached-processes/cleanup-js-subprocess.js +8 -2
- package/lib/detached-processes/cleanup-process.js +18 -14
- package/lib/detached-processes/file-log-service.js +2 -1
- package/lib/device-path-provider.js +1 -0
- package/lib/device-sockets/ios/app-debug-socket-proxy-factory.js +7 -0
- package/lib/device-sockets/ios/notification.js +3 -0
- package/lib/device-sockets/ios/socket-request-executor.js +3 -0
- package/lib/helpers/android-bundle-validator-helper.js +2 -1
- package/lib/helpers/deploy-command-helper.js +1 -0
- package/lib/helpers/key-command-helper.js +4 -2
- package/lib/helpers/livesync-command-helper.js +4 -1
- package/lib/helpers/network-connectivity-validator.js +1 -0
- package/lib/helpers/options-track-helper.js +3 -2
- package/lib/helpers/package-path-helper.js +1 -0
- package/lib/helpers/platform-command-helper.js +7 -2
- package/lib/helpers/version-validator-helper.js +1 -0
- package/lib/key-commands/bootstrap.js +3 -2
- package/lib/key-commands/index.js +5 -4
- package/lib/nativescript-cli-lib-bootstrap.js +4 -0
- package/lib/nativescript-cli-lib.js +1 -0
- package/lib/nativescript-cli.js +10 -1
- package/lib/node/pbxproj-dom-xcode.js +1 -0
- package/lib/node/xcode.js +1 -0
- package/lib/node-package-manager.js +11 -1
- package/lib/options.js +143 -118
- package/lib/package-installation-manager.js +8 -1
- package/lib/package-manager.js +2 -0
- package/lib/platform-command-param.js +1 -0
- package/lib/pnpm-package-manager.js +4 -1
- package/lib/project-data.js +12 -0
- package/lib/providers/project-files-provider.js +1 -0
- package/lib/resolvers/livesync-service-resolver.js +1 -0
- package/lib/services/analytics/analytics-broker-process.js +10 -6
- package/lib/services/analytics/analytics-broker.js +2 -1
- package/lib/services/analytics/analytics-service.js +29 -25
- package/lib/services/analytics/google-analytics-provider.js +13 -12
- package/lib/services/analytics-settings-service.js +5 -0
- package/lib/services/android/android-bundle-tool-service.js +1 -0
- package/lib/services/android/gradle-build-args-service.js +3 -0
- package/lib/services/android/gradle-build-service.js +1 -0
- package/lib/services/android/gradle-command-service.js +6 -1
- package/lib/services/android-device-debug-service.js +6 -0
- package/lib/services/android-plugin-build-service.js +33 -1
- package/lib/services/android-project-service.js +71 -4
- package/lib/services/android-resources-migration-service.js +7 -0
- package/lib/services/apple-portal/apple-portal-application-service.js +1 -0
- package/lib/services/apple-portal/apple-portal-cookie-service.js +1 -0
- package/lib/services/apple-portal/apple-portal-session-service.js +6 -4
- package/lib/services/assets-generation/assets-generation-service.js +16 -5
- package/lib/services/build-artifacts-service.js +2 -1
- package/lib/services/build-data-service.js +1 -0
- package/lib/services/build-info-file-service.js +1 -0
- package/lib/services/cleanup-service.js +13 -9
- package/lib/services/cocoapods-platform-manager.js +9 -0
- package/lib/services/cocoapods-service.js +21 -1
- package/lib/services/debug-data-service.js +1 -0
- package/lib/services/debug-service-base.js +7 -0
- package/lib/services/device/device-install-app-service.js +2 -1
- package/lib/services/doctor-service.js +21 -6
- package/lib/services/extensibility-service.js +8 -0
- package/lib/services/files-hash-service.js +1 -0
- package/lib/services/hmr-status-service.js +2 -0
- package/lib/services/info-service.js +1 -0
- package/lib/services/initialize-service.js +5 -1
- package/lib/services/ios/export-options-plist-service.js +4 -0
- package/lib/services/ios/ios-signing-service.js +4 -0
- package/lib/services/ios/spm-service.js +9 -0
- package/lib/services/ios/xcodebuild-args-service.js +9 -0
- package/lib/services/ios/xcodebuild-command-service.js +1 -0
- package/lib/services/ios/xcodebuild-service.js +1 -0
- package/lib/services/ios-debugger-port-service.js +1 -0
- package/lib/services/ios-device-debug-service.js +1 -0
- package/lib/services/ios-entitlements-service.js +1 -0
- package/lib/services/ios-extensions-service.js +1 -0
- package/lib/services/ios-log-filter.js +20 -0
- package/lib/services/ios-native-target-service.js +6 -4
- package/lib/services/ios-project-service.js +94 -2
- package/lib/services/ios-provision-service.js +3 -0
- package/lib/services/ios-watch-app-service.js +1 -0
- package/lib/services/ip-service.js +2 -0
- package/lib/services/itmstransporter-service.js +1 -0
- package/lib/services/karma-execution.js +2 -0
- package/lib/services/livesync/android-device-livesync-service-base.js +1 -0
- package/lib/services/livesync/android-device-livesync-service.js +2 -0
- package/lib/services/livesync/android-device-livesync-sockets-service.js +3 -0
- package/lib/services/livesync/android-livesync-service.js +1 -0
- package/lib/services/livesync/android-livesync-tool.js +4 -0
- package/lib/services/livesync/device-livesync-service-base.js +2 -0
- package/lib/services/livesync/ios-device-livesync-service.js +7 -0
- package/lib/services/livesync/ios-livesync-service.js +2 -0
- package/lib/services/livesync/livesync-socket.js +1 -0
- package/lib/services/livesync/platform-livesync-service-base.js +5 -0
- package/lib/services/livesync-process-data-service.js +1 -0
- package/lib/services/log-parser-service.js +1 -0
- package/lib/services/log-source-map-service.js +15 -0
- package/lib/services/marking-mode-service.js +8 -5
- package/lib/services/metadata-filtering-service.js +1 -0
- package/lib/services/npm-config-service.js +4 -0
- package/lib/services/pacote-service.js +7 -0
- package/lib/services/performance-service.js +3 -1
- package/lib/services/platform/add-platform-service.js +49 -2
- package/lib/services/platform/platform-validation-service.js +1 -0
- package/lib/services/platform/prepare-native-platform-service.js +5 -2
- package/lib/services/platform-environment-requirements.js +8 -3
- package/lib/services/platform-project-service-base.js +1 -0
- package/lib/services/platforms-data-service.js +1 -0
- package/lib/services/plugins-service.js +20 -2
- package/lib/services/prepare-data-service.js +1 -0
- package/lib/services/project-backup-service.js +4 -0
- package/lib/services/project-changes-service.js +14 -3
- package/lib/services/project-cleanup-service.js +2 -0
- package/lib/services/project-config-service.js +22 -2
- package/lib/services/project-data-service.js +36 -7
- package/lib/services/project-name-service.js +1 -0
- package/lib/services/project-service.js +10 -0
- package/lib/services/project-templates-service.js +3 -2
- package/lib/services/qr-code-terminal-service.js +1 -0
- package/lib/services/require-service.js +1 -0
- package/lib/services/start-service.js +1 -0
- package/lib/services/temp-service.js +1 -0
- package/lib/services/terminal-spinner-service.js +2 -0
- package/lib/services/test-execution-service.js +9 -2
- package/lib/services/test-initialization-service.js +4 -0
- package/lib/services/timeline-profiler-service.js +1 -0
- package/lib/services/user-settings-service.js +1 -0
- package/lib/services/versions-service.js +6 -4
- package/lib/services/watch-ignore-list-service.js +1 -0
- package/lib/services/webpack/webpack-compiler-service.js +42 -1
- package/lib/services/xcconfig-service.js +2 -0
- package/lib/services/xcproj-service.js +1 -0
- package/lib/shared-event-bus.js +6 -0
- package/lib/sys-info.js +2 -1
- package/lib/tools/config-manipulation/config-transformer.js +12 -0
- package/lib/tools/node-modules/node-modules-builder.js +1 -0
- package/lib/tools/node-modules/node-modules-dependencies-builder.js +6 -0
- package/lib/yarn-package-manager.js +1 -0
- package/lib/yarn2-package-manager.js +3 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/CHANGELOG.md +15 -0
- package/node_modules/rimraf/CHANGELOG.md +65 -0
- package/node_modules/stringify-package/CHANGELOG.md +16 -0
- package/package.json +2 -2
|
@@ -21,8 +21,12 @@ const helpers_1 = require("../common/helpers");
|
|
|
21
21
|
const yok_1 = require("../common/yok");
|
|
22
22
|
const temp = require("temp");
|
|
23
23
|
const color_1 = require("../color");
|
|
24
|
+
// const wait: (ms: number) => Promise<void> = (ms: number = 1000) =>
|
|
25
|
+
// new Promise((resolve) => setTimeout(resolve, ms));
|
|
24
26
|
class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
25
|
-
constructor($fs, $platformCommandHelper, $platformsDataService, $packageInstallationManager, $packageManager, $pacoteService,
|
|
27
|
+
constructor($fs, $platformCommandHelper, $platformsDataService, $packageInstallationManager, $packageManager, $pacoteService,
|
|
28
|
+
// private $androidResourcesMigrationService: IAndroidResourcesMigrationService,
|
|
29
|
+
$logger, $errors, $pluginsService, $projectDataService, $projectConfigService, $options, $resources, $injector, $settingsService, $staticConfig, $terminalSpinnerService, $projectCleanupService, $projectBackupService, $childProcess) {
|
|
26
30
|
super($fs, $platformCommandHelper, $platformsDataService, $packageInstallationManager, $packageManager, $pacoteService);
|
|
27
31
|
this.$fs = $fs;
|
|
28
32
|
this.$platformCommandHelper = $platformCommandHelper;
|
|
@@ -174,13 +178,16 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
174
178
|
replaceWith: "sass",
|
|
175
179
|
minVersion: "0.0.0",
|
|
176
180
|
isDev: true,
|
|
181
|
+
// shouldRemove: true,
|
|
177
182
|
},
|
|
178
183
|
{
|
|
179
184
|
packageName: "sass",
|
|
180
185
|
minVersion: "0.0.0",
|
|
181
186
|
desiredVersion: "^1.49.9",
|
|
182
187
|
isDev: true,
|
|
188
|
+
// shouldRemove: true,
|
|
183
189
|
},
|
|
190
|
+
// runtimes
|
|
184
191
|
{
|
|
185
192
|
packageName: "tns-ios",
|
|
186
193
|
minVersion: "6.5.3",
|
|
@@ -224,8 +231,10 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
224
231
|
remainingPlatforms.push(platform);
|
|
225
232
|
continue;
|
|
226
233
|
}
|
|
234
|
+
// should only run in loose mode...
|
|
227
235
|
const cachedResult = yield this.getCachedShouldMigrate(projectDir, platform);
|
|
228
236
|
this.$logger.trace(`Got cached result for shouldMigrate for platform: ${platform}: ${cachedResult}`);
|
|
237
|
+
// the cached result is only used if it's false, otherwise we need to check again
|
|
229
238
|
if (cachedResult !== false) {
|
|
230
239
|
remainingPlatforms.push(platform);
|
|
231
240
|
}
|
|
@@ -237,6 +246,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
237
246
|
loose,
|
|
238
247
|
});
|
|
239
248
|
this.$logger.trace(`Executed shouldMigrate for platforms: ${remainingPlatforms}. Result is: ${shouldMigrate}`);
|
|
249
|
+
// only cache results if running in loose mode
|
|
240
250
|
if (!shouldMigrate && loose) {
|
|
241
251
|
for (const remainingPlatform of remainingPlatforms) {
|
|
242
252
|
yield this.setCachedShouldMigrate(projectDir, remainingPlatform);
|
|
@@ -267,37 +277,46 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
267
277
|
platforms,
|
|
268
278
|
loose: loose,
|
|
269
279
|
});
|
|
280
|
+
// ensure in git repo and require --force if not (for safety)
|
|
281
|
+
// ensure git branch is clean
|
|
270
282
|
const canMigrate = yield this.ensureGitCleanOrForce(projectDir);
|
|
271
283
|
if (!canMigrate) {
|
|
272
284
|
this.spinner.fail("Pre-Migration verification failed");
|
|
273
285
|
return;
|
|
274
286
|
}
|
|
275
287
|
this.spinner.succeed("Pre-Migration verification complete");
|
|
288
|
+
// back up project files and folders
|
|
276
289
|
this.spinner.info("Backing up project files before migration");
|
|
277
290
|
const backup = yield this.backupProject(projectDir);
|
|
278
291
|
this.spinner.succeed("Project files have been backed up");
|
|
292
|
+
// clean up project files
|
|
279
293
|
this.spinner.info("Cleaning up project files before migration");
|
|
280
294
|
yield this.cleanUpProject(projectData);
|
|
281
295
|
this.spinner.succeed("Project files have been cleaned up");
|
|
296
|
+
// clean up artifacts
|
|
282
297
|
this.spinner.info("Cleaning up old artifacts");
|
|
283
298
|
yield this.handleAutoGeneratedFiles(backup, projectData);
|
|
284
299
|
this.spinner.succeed("Cleaned old artifacts");
|
|
285
300
|
const newConfigPath = path.resolve(projectDir, "nativescript.config.ts");
|
|
286
301
|
if (!this.$fs.exists(newConfigPath)) {
|
|
302
|
+
// migrate configs
|
|
287
303
|
this.spinner.info(`Migrating project to use ${color_1.color.green("nativescript.config.ts")}`);
|
|
288
304
|
yield this.migrateConfigs(projectDir);
|
|
289
305
|
this.spinner.succeed(`Project has been migrated to use ${color_1.color.green("nativescript.config.ts")}`);
|
|
290
306
|
}
|
|
307
|
+
// update dependencies
|
|
291
308
|
this.spinner.info("Updating project dependencies");
|
|
292
309
|
yield this.migrateDependencies(projectData, platforms, loose);
|
|
293
310
|
this.spinner.succeed("Project dependencies have been updated");
|
|
294
311
|
const isAngular = this.hasDependency({
|
|
295
312
|
packageName: "@nativescript/angular",
|
|
296
313
|
}, projectData);
|
|
314
|
+
// ensure polyfills.ts exists in angular projects
|
|
297
315
|
let polyfillsPath;
|
|
298
316
|
if (isAngular) {
|
|
299
317
|
polyfillsPath = yield this.checkOrCreatePolyfillsTS(projectData);
|
|
300
318
|
}
|
|
319
|
+
// update tsconfig
|
|
301
320
|
const tsConfigPath = path.resolve(projectDir, "tsconfig.json");
|
|
302
321
|
if (this.$fs.exists(tsConfigPath)) {
|
|
303
322
|
this.spinner.info(`Updating ${color_1.color.yellow("tsconfig.json")}`);
|
|
@@ -309,11 +328,21 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
309
328
|
this.spinner.succeed(`Updated ${color_1.color.yellow("tsconfig.json")}`);
|
|
310
329
|
}
|
|
311
330
|
yield this.migrateWebpack5(projectDir, projectData);
|
|
331
|
+
// run @nativescript/eslint over codebase
|
|
312
332
|
yield this.runESLint(projectDir);
|
|
313
333
|
this.spinner.succeed("Migration complete.");
|
|
314
334
|
this.$logger.info("");
|
|
315
335
|
this.$logger.printMarkdown("Project has been successfully migrated. The next step is to run `ns run <platform>` to ensure everything is working properly." +
|
|
316
|
-
"\n\nPlease note that you may need additional changes to complete the migration."
|
|
336
|
+
"\n\nPlease note that you may need additional changes to complete the migration."
|
|
337
|
+
// + "\n\nYou may restore your project with `ns migrate restore`"
|
|
338
|
+
);
|
|
339
|
+
// print markdown for next steps:
|
|
340
|
+
// if no runtime has been added, print a message that it will be added when they run ns run <platform>
|
|
341
|
+
// if all is good, run ns migrate clean to clean up backup folders
|
|
342
|
+
// in case of failure, print diagnostic data: what failed and why
|
|
343
|
+
// restore all files - or perhaps let the user sort it out
|
|
344
|
+
// or ns migrate restore - to restore from pre-migration backup
|
|
345
|
+
// for some known cases, print suggestions perhaps
|
|
317
346
|
});
|
|
318
347
|
}
|
|
319
348
|
_shouldMigrate({ projectDir, platforms, loose, }) {
|
|
@@ -332,6 +361,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
332
361
|
if (dependency.shouldAddIfMissing) {
|
|
333
362
|
this.$logger.trace(`${shouldMigrateCommonMessage}'${dependency.packageName}' is missing.`);
|
|
334
363
|
if (loose) {
|
|
364
|
+
// in loose mode we ignore missing dependencies
|
|
335
365
|
continue;
|
|
336
366
|
}
|
|
337
367
|
return true;
|
|
@@ -347,6 +377,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
347
377
|
}
|
|
348
378
|
if (dependency.replaceWith || dependency.shouldRemove) {
|
|
349
379
|
this.$logger.trace(`${shouldMigrateCommonMessage}'${dependency.packageName}' is deprecated.`);
|
|
380
|
+
// in loose mode we ignore deprecated dependencies
|
|
350
381
|
if (loose) {
|
|
351
382
|
continue;
|
|
352
383
|
}
|
|
@@ -398,12 +429,33 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
398
429
|
return yield this.$fs.getFileShasum(projectPackageJsonFilePath);
|
|
399
430
|
});
|
|
400
431
|
}
|
|
432
|
+
// private async migrateOldAndroidAppResources(
|
|
433
|
+
// projectData: IProjectData,
|
|
434
|
+
// backupDir: string
|
|
435
|
+
// ) {
|
|
436
|
+
// const appResourcesPath = projectData.getAppResourcesDirectoryPath();
|
|
437
|
+
// if (!this.$androidResourcesMigrationService.hasMigrated(appResourcesPath)) {
|
|
438
|
+
// this.spinner.info("Migrate old Android App_Resources structure.");
|
|
439
|
+
// try {
|
|
440
|
+
// await this.$androidResourcesMigrationService.migrate(
|
|
441
|
+
// appResourcesPath,
|
|
442
|
+
// backupDir
|
|
443
|
+
// );
|
|
444
|
+
// } catch (error) {
|
|
445
|
+
// this.$logger.warn(
|
|
446
|
+
// "Migrate old Android App_Resources structure failed: ",
|
|
447
|
+
// error.message
|
|
448
|
+
// );
|
|
449
|
+
// }
|
|
450
|
+
// }
|
|
451
|
+
// }
|
|
401
452
|
ensureGitCleanOrForce(projectDir) {
|
|
402
453
|
return __awaiter(this, void 0, void 0, function* () {
|
|
403
454
|
const git = (0, simple_git_1.default)(projectDir);
|
|
404
455
|
const isGit = yield git.checkIsRepo();
|
|
405
456
|
const isForce = this.$options.force;
|
|
406
457
|
if (!isGit) {
|
|
458
|
+
// not a git repo and no --force
|
|
407
459
|
if (!isForce) {
|
|
408
460
|
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\`.`);
|
|
409
461
|
this.$errors.fail("Not in Git repo.");
|
|
@@ -454,6 +506,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
454
506
|
const { dependencies, devDependencies } = yield this.$pluginsService.getDependenciesFromPackageJson(projectData.projectDir);
|
|
455
507
|
const hasSchematics = [...dependencies, ...devDependencies].find((p) => p.name === "@nativescript/schematics");
|
|
456
508
|
if (!hasSchematics) {
|
|
509
|
+
// clean tsconfig.tns.json if not in a shared project
|
|
457
510
|
yield this.$projectCleanupService.clean([
|
|
458
511
|
constants.TSCCONFIG_TNS_JSON_NAME,
|
|
459
512
|
]);
|
|
@@ -503,12 +556,14 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
503
556
|
});
|
|
504
557
|
}
|
|
505
558
|
isOutdatedVersion(current, target, loose) {
|
|
559
|
+
// in loose mode, a falsy version is not considered outdated
|
|
506
560
|
if (!current && loose) {
|
|
507
561
|
return false;
|
|
508
562
|
}
|
|
509
563
|
const installed = semver.coerce(current);
|
|
510
564
|
const min = semver.coerce(target.minVersion);
|
|
511
565
|
const desired = semver.coerce(target.desiredVersion);
|
|
566
|
+
// in loose mode we check if we satisfy the min version
|
|
512
567
|
if (loose) {
|
|
513
568
|
if (!installed || !min) {
|
|
514
569
|
return false;
|
|
@@ -518,6 +573,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
518
573
|
if (!installed || !desired) {
|
|
519
574
|
return true;
|
|
520
575
|
}
|
|
576
|
+
// otherwise we compare with the desired version
|
|
521
577
|
return semver.lt(installed, desired);
|
|
522
578
|
}
|
|
523
579
|
detectAppPath(projectDir, configData) {
|
|
@@ -585,6 +641,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
585
641
|
var _a, _b, _c, _d, _e;
|
|
586
642
|
return __awaiter(this, void 0, void 0, function* () {
|
|
587
643
|
const hasDependency = this.hasDependency(dependency, projectData);
|
|
644
|
+
// show warning if needed
|
|
588
645
|
if (hasDependency && dependency.warning) {
|
|
589
646
|
this.$logger.warn(dependency.warning);
|
|
590
647
|
}
|
|
@@ -600,7 +657,9 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
600
657
|
return;
|
|
601
658
|
}
|
|
602
659
|
if (dependency.replaceWith || dependency.shouldRemove) {
|
|
660
|
+
// remove
|
|
603
661
|
this.$pluginsService.removeFromPackageJson(dependency.packageName, projectData.projectDir);
|
|
662
|
+
// no replacement required - we're done
|
|
604
663
|
if (!dependency.replaceWith) {
|
|
605
664
|
return;
|
|
606
665
|
}
|
|
@@ -609,6 +668,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
609
668
|
this.$errors.fail("Failed to find replacement dependency.");
|
|
610
669
|
}
|
|
611
670
|
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;
|
|
671
|
+
// add replacement dependency
|
|
612
672
|
this.$pluginsService.addToPackageJson(replacementDep.packageName, version, replacementDep.isDev, projectData.projectDir);
|
|
613
673
|
this.spinner.clear();
|
|
614
674
|
this.$logger.info(` - ${color_1.color.yellow(dependency.packageName)} has been replaced with ${color_1.color.cyan(replacementDep.packageName)} ${color_1.color.green(version)}`);
|
|
@@ -630,35 +690,51 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
630
690
|
migrateConfigs(projectDir) {
|
|
631
691
|
return __awaiter(this, void 0, void 0, function* () {
|
|
632
692
|
const projectData = this.$projectDataService.getProjectData(projectDir);
|
|
693
|
+
// package.json
|
|
633
694
|
const rootPackageJsonPath = path.resolve(projectDir, constants.PACKAGE_JSON_FILE_NAME);
|
|
695
|
+
// nested package.json
|
|
634
696
|
const embeddedPackageJsonPath = path.resolve(projectData.projectDir, projectData.getAppDirectoryRelativePath(), constants.PACKAGE_JSON_FILE_NAME);
|
|
697
|
+
// nsconfig.json
|
|
635
698
|
const legacyNsConfigPath = path.resolve(projectData.projectDir, constants.CONFIG_NS_FILE_NAME);
|
|
636
699
|
let rootPackageJsonData = {};
|
|
637
700
|
if (this.$fs.exists(rootPackageJsonPath)) {
|
|
638
701
|
rootPackageJsonData = this.$fs.readJson(rootPackageJsonPath);
|
|
639
702
|
}
|
|
703
|
+
// write the default config unless it already exists
|
|
640
704
|
const newConfigPath = this.$projectConfigService.writeDefaultConfig(projectData.projectDir);
|
|
705
|
+
// force legacy config mode
|
|
641
706
|
this.$projectConfigService.setForceUsingLegacyConfig(true);
|
|
707
|
+
// all different sources are combined into configData (nested package.json, nsconfig and root package.json[nativescript])
|
|
642
708
|
const configData = this.$projectConfigService.readConfig(projectData.projectDir);
|
|
709
|
+
// we no longer want to force legacy config mode
|
|
643
710
|
this.$projectConfigService.setForceUsingLegacyConfig(false);
|
|
711
|
+
// move main key into root package.json
|
|
644
712
|
if (configData.main) {
|
|
645
713
|
rootPackageJsonData.main = configData.main;
|
|
646
714
|
delete configData.main;
|
|
647
715
|
}
|
|
716
|
+
// detect appPath and App_Resources path
|
|
648
717
|
configData.appPath = this.detectAppPath(projectDir, configData);
|
|
649
718
|
configData.appResourcesPath = this.detectAppResourcesPath(projectDir, configData);
|
|
719
|
+
// delete nativescript key from root package.json
|
|
650
720
|
if (rootPackageJsonData.nativescript) {
|
|
651
721
|
delete rootPackageJsonData.nativescript;
|
|
652
722
|
}
|
|
723
|
+
// force the config service to use nativescript.config.ts
|
|
653
724
|
this.$projectConfigService.setForceUsingNewConfig(true);
|
|
654
|
-
|
|
725
|
+
// migrate data into nativescript.config.ts
|
|
726
|
+
const hasUpdatedConfigSuccessfully = yield this.$projectConfigService.setValue("", // root
|
|
727
|
+
configData);
|
|
655
728
|
if (!hasUpdatedConfigSuccessfully) {
|
|
656
729
|
if (typeof newConfigPath === "string") {
|
|
730
|
+
// only clean the config if it was created by the migration script
|
|
657
731
|
yield this.$projectCleanupService.cleanPath(newConfigPath);
|
|
658
732
|
}
|
|
659
733
|
this.$errors.fail(`Failed to migrate project to use ${constants.CONFIG_FILE_NAME_TS}. One or more values could not be updated.`);
|
|
660
734
|
}
|
|
735
|
+
// save root package.json
|
|
661
736
|
this.$fs.writeJson(rootPackageJsonPath, rootPackageJsonData);
|
|
737
|
+
// delete migrated files
|
|
662
738
|
yield this.$projectCleanupService.cleanPath(embeddedPackageJsonPath);
|
|
663
739
|
yield this.$projectCleanupService.cleanPath(legacyNsConfigPath);
|
|
664
740
|
return true;
|
|
@@ -666,6 +742,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
666
742
|
}
|
|
667
743
|
migrateUnitTestRunner(projectData, migrationBackupDirPath) {
|
|
668
744
|
return __awaiter(this, void 0, void 0, function* () {
|
|
745
|
+
// Migrate karma.conf.js
|
|
669
746
|
const pathToKarmaConfig = path.join(migrationBackupDirPath, constants.KARMA_CONFIG_NAME);
|
|
670
747
|
if (this.$fs.exists(pathToKarmaConfig)) {
|
|
671
748
|
const oldKarmaContent = this.$fs.readText(pathToKarmaConfig);
|
|
@@ -683,6 +760,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
683
760
|
});
|
|
684
761
|
this.$fs.writeFile(path.join(projectData.projectDir, constants.KARMA_CONFIG_NAME), karmaConf);
|
|
685
762
|
}
|
|
763
|
+
// Dependencies to migrate
|
|
686
764
|
const dependencies = [
|
|
687
765
|
{
|
|
688
766
|
packageName: "karma-webpack",
|
|
@@ -726,6 +804,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
726
804
|
return __awaiter(this, void 0, void 0, function* () {
|
|
727
805
|
try {
|
|
728
806
|
const configContents = this.$fs.readJson(tsConfigPath);
|
|
807
|
+
// update
|
|
729
808
|
configContents.compilerOptions = configContents.compilerOptions || {};
|
|
730
809
|
configContents.compilerOptions.target = "es2020";
|
|
731
810
|
configContents.compilerOptions.module = "esnext";
|
|
@@ -736,6 +815,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
736
815
|
...new Set([...(configContents.compilerOptions.lib || []), "ESNext"]),
|
|
737
816
|
];
|
|
738
817
|
if (isAngular) {
|
|
818
|
+
// make sure polyfills.ts is in files
|
|
739
819
|
if (configContents.files) {
|
|
740
820
|
configContents.files = [
|
|
741
821
|
...new Set([
|
|
@@ -771,8 +851,10 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
771
851
|
const tempDir = temp.mkdirSync({
|
|
772
852
|
prefix: "migrate-angular-polyfills",
|
|
773
853
|
});
|
|
854
|
+
// get from default angular template
|
|
774
855
|
yield this.$pacoteService.extractPackage(constants.RESERVED_TEMPLATE_NAMES["angular"], tempDir);
|
|
775
856
|
this.$fs.copyFile(path.resolve(tempDir, "src/polyfills.ts"), possiblePaths[0]);
|
|
857
|
+
// clean up temp project
|
|
776
858
|
this.$fs.deleteDirectory(tempDir);
|
|
777
859
|
this.spinner.succeed(`Created fresh ${color_1.color.cyan("polyfills.ts")}`);
|
|
778
860
|
return "./" + path.relative(projectDir, possiblePaths[0]);
|
|
@@ -843,6 +925,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
843
925
|
desiredVersion: "~0.14.0",
|
|
844
926
|
shouldAddIfMissing: true,
|
|
845
927
|
},
|
|
928
|
+
// devDependencies
|
|
846
929
|
{
|
|
847
930
|
packageName: "@angular/cli",
|
|
848
931
|
minVersion,
|
|
@@ -915,10 +998,12 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
915
998
|
packageName: "@babel/preset-env",
|
|
916
999
|
shouldRemove: true,
|
|
917
1000
|
},
|
|
1001
|
+
// remove any version of vue
|
|
918
1002
|
{
|
|
919
1003
|
packageName: "vue",
|
|
920
1004
|
shouldRemove: true,
|
|
921
1005
|
},
|
|
1006
|
+
// add latest
|
|
922
1007
|
{
|
|
923
1008
|
packageName: "vue",
|
|
924
1009
|
desiredVersion: "2.6.12",
|
|
@@ -1020,6 +1105,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
1020
1105
|
return;
|
|
1021
1106
|
}
|
|
1022
1107
|
}
|
|
1108
|
+
// clean old config before generating new one
|
|
1023
1109
|
yield this.$projectCleanupService.clean(["webpack.config.js"]);
|
|
1024
1110
|
this.spinner.info(`Initializing new ${color_1.color.yellow("webpack.config.js")}`);
|
|
1025
1111
|
const { desiredVersion: webpackVersion } = this.migrationDependencies.find((dep) => dep.packageName === constants.WEBPACK_PLUGIN_NAME);
|
|
@@ -1098,6 +1184,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
1098
1184
|
});
|
|
1099
1185
|
}
|
|
1100
1186
|
}
|
|
1187
|
+
// static readonly typescriptPackageName: string = "typescript";
|
|
1101
1188
|
MigrateController.backupFolderName = ".migration_backup";
|
|
1102
1189
|
MigrateController.pathsToBackup = [
|
|
1103
1190
|
constants.LIB_DIR_NAME,
|
|
@@ -1111,3 +1198,4 @@ MigrateController.pathsToBackup = [
|
|
|
1111
1198
|
];
|
|
1112
1199
|
exports.MigrateController = MigrateController;
|
|
1113
1200
|
yok_1.injector.register("migrateController", MigrateController);
|
|
1201
|
+
//# sourceMappingURL=migrate-controller.js.map
|
|
@@ -98,9 +98,13 @@ class PlatformController {
|
|
|
98
98
|
desiredRuntimePackage.version = version;
|
|
99
99
|
}
|
|
100
100
|
if (!desiredRuntimePackage.version) {
|
|
101
|
+
// if no version is explicitly added, then we use the latest
|
|
101
102
|
desiredRuntimePackage.version =
|
|
102
103
|
yield this.$packageInstallationManager.getLatestCompatibleVersion(desiredRuntimePackage.name);
|
|
103
104
|
}
|
|
105
|
+
// const currentPlatformData = this.$projectDataService.getNSValue(projectData.projectDir, platformData.frameworkPackageName);
|
|
106
|
+
// version = (currentPlatformData && currentPlatformData.version) ||
|
|
107
|
+
// await this.$packageInstallationManager.getLatestCompatibleVersion(platformData.frameworkPackageName);
|
|
104
108
|
result = `${desiredRuntimePackage.name}@${desiredRuntimePackage.version}`;
|
|
105
109
|
}
|
|
106
110
|
return result;
|
|
@@ -113,11 +117,14 @@ class PlatformController {
|
|
|
113
117
|
const prepareInfo = this.$projectChangesService.getPrepareInfo(platformData);
|
|
114
118
|
const requiresNativePlatformAdd = prepareInfo &&
|
|
115
119
|
prepareInfo.nativePlatformStatus ===
|
|
116
|
-
"1"
|
|
120
|
+
"1" /* NativePlatformStatus.requiresPlatformAdd */;
|
|
117
121
|
const shouldAddPlatform = !hasPlatformDirectory ||
|
|
118
122
|
(shouldAddNativePlatform && requiresNativePlatformAdd);
|
|
119
123
|
if (hasPlatformDirectory && !shouldAddPlatform) {
|
|
120
124
|
const platformDirectoryItemCount = this.$fs.readDirectory(path.join(projectData.platformsDir, platformName)).length;
|
|
125
|
+
// 2 is a magic number to approximate a valid platform folder
|
|
126
|
+
// any valid platform should contain at least 2 files/folders
|
|
127
|
+
// we choose 2 to avoid false-positives due to system files like .DS_Store etc.
|
|
121
128
|
if (platformDirectoryItemCount <= 2) {
|
|
122
129
|
this.$logger.warn(`The platforms/${platformName} folder appears to be invalid. If the build fails, run 'ns clean' and rebuild the app.`, { wrapMessageWithBorders: true });
|
|
123
130
|
}
|
|
@@ -127,3 +134,4 @@ class PlatformController {
|
|
|
127
134
|
}
|
|
128
135
|
exports.PlatformController = PlatformController;
|
|
129
136
|
yok_1.injector.register("platformController", PlatformController);
|
|
137
|
+
//# sourceMappingURL=platform-controller.js.map
|
|
@@ -90,6 +90,10 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
90
90
|
yield this.$platformController.addPlatformIfNeeded(prepareData, projectData);
|
|
91
91
|
yield this.trackRuntimeVersion(prepareData.platform, projectData);
|
|
92
92
|
this.$logger.info("Preparing project...");
|
|
93
|
+
// we need to mark the ~/package.json (used by core modules)
|
|
94
|
+
// as external for us to be able to write the config to it
|
|
95
|
+
// in writeRuntimePackageJson() below, because otherwise
|
|
96
|
+
// webpack will inline it into the bundle/vendor chunks
|
|
93
97
|
prepareData.env = prepareData.env || {};
|
|
94
98
|
prepareData.env.externals = prepareData.env.externals || [];
|
|
95
99
|
prepareData.env.externals.push("~/package.json");
|
|
@@ -132,8 +136,8 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
132
136
|
},
|
|
133
137
|
};
|
|
134
138
|
}
|
|
135
|
-
yield this.startJSWatcherWithPrepare(platformData, projectData, prepareData);
|
|
136
|
-
const hasNativeChanges = yield this.startNativeWatcherWithPrepare(platformData, projectData, prepareData);
|
|
139
|
+
yield this.startJSWatcherWithPrepare(platformData, projectData, prepareData); // -> start watcher + initial compilation
|
|
140
|
+
const hasNativeChanges = yield this.startNativeWatcherWithPrepare(platformData, projectData, prepareData); // -> start watcher + initial prepare
|
|
137
141
|
const result = {
|
|
138
142
|
platform: platformData.platformNameLowerCase,
|
|
139
143
|
hasNativeChanges,
|
|
@@ -142,6 +146,7 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
142
146
|
if (hasPersistedDataWithNativeChanges) {
|
|
143
147
|
result.hasNativeChanges = true;
|
|
144
148
|
}
|
|
149
|
+
// TODO: Do not persist this in `this` context. Also it should be per platform.
|
|
145
150
|
this.isInitialPrepareReady = true;
|
|
146
151
|
if (this.persistedData && this.persistedData.length) {
|
|
147
152
|
this.emitPrepareEvent({
|
|
@@ -200,7 +205,7 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
200
205
|
pollInterval: 100,
|
|
201
206
|
stabilityThreshold: 500,
|
|
202
207
|
},
|
|
203
|
-
ignored: ["**/.*", ".*"],
|
|
208
|
+
ignored: ["**/.*", ".*"], // hidden files
|
|
204
209
|
};
|
|
205
210
|
const watcher = choki
|
|
206
211
|
.watch(patterns, watcherOptions)
|
|
@@ -247,6 +252,9 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
247
252
|
return patterns;
|
|
248
253
|
});
|
|
249
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* TODO: move this logic to the webpack side of things - WIP and deprecate here with a webpack version check...
|
|
257
|
+
*/
|
|
250
258
|
writeRuntimePackageJson(projectData, platformData) {
|
|
251
259
|
return __awaiter(this, void 0, void 0, function* () {
|
|
252
260
|
const configInfo = this.$projectConfigService.detectProjectConfigs(projectData.projectDir);
|
|
@@ -276,7 +284,11 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
276
284
|
packagePath = path.join(platformData.projectRoot, this.$options.hostProjectModuleName, "src", this.$options.hostProjectPath ? "nativescript" : "main", "assets", "app", "package.json");
|
|
277
285
|
}
|
|
278
286
|
try {
|
|
287
|
+
// this will read the package.json that is already emitted by
|
|
288
|
+
// the GenerateNativeScriptEntryPointsPlugin webpack plugin
|
|
279
289
|
const emittedPackageData = this.$fs.readJson(packagePath);
|
|
290
|
+
// since ns7 we only care about the main key from the emitted
|
|
291
|
+
// package.json, the rest is coming from the new config.
|
|
280
292
|
if (emittedPackageData === null || emittedPackageData === void 0 ? void 0 : emittedPackageData.main) {
|
|
281
293
|
packageData.main = emittedPackageData.main;
|
|
282
294
|
}
|
|
@@ -303,7 +315,7 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
303
315
|
return;
|
|
304
316
|
}
|
|
305
317
|
yield this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
306
|
-
action: "Using Runtime Version"
|
|
318
|
+
action: "Using Runtime Version" /* TrackActionNames.UsingRuntimeVersion */,
|
|
307
319
|
additionalData: `${platform.toLowerCase()}${constants_1.AnalyticsEventLabelDelimiter}${version}`,
|
|
308
320
|
});
|
|
309
321
|
});
|
|
@@ -351,3 +363,4 @@ __decorate([
|
|
|
351
363
|
], PrepareController.prototype, "trackRuntimeVersion", null);
|
|
352
364
|
exports.PrepareController = PrepareController;
|
|
353
365
|
yok_1.injector.register("prepareController", PrepareController);
|
|
366
|
+
//# sourceMappingURL=prepare-controller.js.map
|
|
@@ -90,11 +90,14 @@ class RunController extends events_1.EventEmitter {
|
|
|
90
90
|
const { projectDir, deviceIdentifiers, stopOptions } = data;
|
|
91
91
|
const liveSyncProcessInfo = this.$liveSyncProcessDataService.getPersistedData(projectDir);
|
|
92
92
|
if (liveSyncProcessInfo && !liveSyncProcessInfo.isStopped) {
|
|
93
|
+
// In case we are coming from error during livesync, the current action is the one that erred (but we are still executing it),
|
|
94
|
+
// so we cannot await it as this will cause infinite loop.
|
|
93
95
|
const shouldAwaitPendingOperation = !stopOptions || stopOptions.shouldAwaitAllActions;
|
|
94
96
|
const deviceIdentifiersToRemove = deviceIdentifiers && deviceIdentifiers.length
|
|
95
97
|
? deviceIdentifiers
|
|
96
98
|
: _.map(liveSyncProcessInfo.deviceDescriptors, (d) => d.identifier);
|
|
97
99
|
const removedDeviceIdentifiers = _.remove(liveSyncProcessInfo.deviceDescriptors, (descriptor) => _.includes(deviceIdentifiersToRemove, descriptor.identifier)).map((descriptor) => descriptor.identifier);
|
|
100
|
+
// Handle the case when no more devices left for any of the persisted platforms
|
|
98
101
|
for (let i = 0; i < liveSyncProcessInfo.platforms.length; i++) {
|
|
99
102
|
const platform = liveSyncProcessInfo.platforms[i];
|
|
100
103
|
const devices = this.$devicesService.getDevicesForPlatform(platform);
|
|
@@ -102,6 +105,7 @@ class RunController extends events_1.EventEmitter {
|
|
|
102
105
|
yield this.$prepareController.stopWatchers(projectDir, platform);
|
|
103
106
|
}
|
|
104
107
|
}
|
|
108
|
+
// In case deviceIdentifiers are not passed, we should stop the whole LiveSync.
|
|
105
109
|
if (!deviceIdentifiers ||
|
|
106
110
|
!deviceIdentifiers.length ||
|
|
107
111
|
!liveSyncProcessInfo.deviceDescriptors ||
|
|
@@ -132,6 +136,7 @@ class RunController extends events_1.EventEmitter {
|
|
|
132
136
|
shouldAwaitPendingOperation) {
|
|
133
137
|
yield liveSyncProcessInfo.currentSyncAction;
|
|
134
138
|
}
|
|
139
|
+
// Emit RunOnDevice stopped when we've really stopped.
|
|
135
140
|
_.each(removedDeviceIdentifiers, (deviceIdentifier) => {
|
|
136
141
|
this.emitCore(constants_2.RunOnDeviceEvents.runOnDeviceStopped, {
|
|
137
142
|
projectDir,
|
|
@@ -173,6 +178,8 @@ class RunController extends events_1.EventEmitter {
|
|
|
173
178
|
shouldSkipEmitLiveSyncNotification: true,
|
|
174
179
|
shouldCheckDeveloperDiscImage: true,
|
|
175
180
|
});
|
|
181
|
+
// we do not stop the application when debugBrk is false, so we need to attach, instead of launch
|
|
182
|
+
// if we try to send the launch request, the debugger port will not be printed and the command will timeout
|
|
176
183
|
debugOptions.start = !debugOptions.debugBrk;
|
|
177
184
|
debugOptions.forceDebuggerAttachedEvent = refreshInfo.didRestart;
|
|
178
185
|
yield this.$debugController.enableDebuggingCoreWithoutWaitingCurrentAction(projectData.projectDir, deviceDescriptor.identifier, debugOptions);
|
|
@@ -243,6 +250,7 @@ class RunController extends events_1.EventEmitter {
|
|
|
243
250
|
getDeviceDescriptorsForInitialSync(projectDir, deviceDescriptors) {
|
|
244
251
|
const currentRunData = this.$liveSyncProcessDataService.getPersistedData(projectDir);
|
|
245
252
|
const isAlreadyLiveSyncing = currentRunData && !currentRunData.isStopped;
|
|
253
|
+
// Prevent cases where liveSync is called consecutive times with the same device, for example [ A, B, C ] and then [ A, B, D ] - we want to execute initialSync only for D.
|
|
246
254
|
const deviceDescriptorsForInitialSync = isAlreadyLiveSyncing
|
|
247
255
|
? _.differenceBy(deviceDescriptors, currentRunData.deviceDescriptors, "identifier")
|
|
248
256
|
: deviceDescriptors;
|
|
@@ -291,6 +299,8 @@ class RunController extends events_1.EventEmitter {
|
|
|
291
299
|
const platformData = this.$platformsDataService.getPlatformData(device.deviceInfo.platform, projectData);
|
|
292
300
|
try {
|
|
293
301
|
let packageFilePath = null;
|
|
302
|
+
// Case where we have three devices attached, a change that requires build is found,
|
|
303
|
+
// we'll rebuild the app only for the first device, but we should install new package on all three devices.
|
|
294
304
|
if (rebuiltInformation[platformData.platformNameLowerCase] &&
|
|
295
305
|
(this.$mobileHelper.isAndroidPlatform(platformData.platformNameLowerCase) ||
|
|
296
306
|
rebuiltInformation[platformData.platformNameLowerCase]
|
|
@@ -314,7 +324,7 @@ class RunController extends events_1.EventEmitter {
|
|
|
314
324
|
}
|
|
315
325
|
else {
|
|
316
326
|
yield this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
317
|
-
action: "LiveSync"
|
|
327
|
+
action: "LiveSync" /* TrackActionNames.LiveSync */,
|
|
318
328
|
device,
|
|
319
329
|
projectDir: projectData.projectDir,
|
|
320
330
|
});
|
|
@@ -381,6 +391,9 @@ class RunController extends events_1.EventEmitter {
|
|
|
381
391
|
const watchInfo = {
|
|
382
392
|
liveSyncDeviceData: deviceDescriptor,
|
|
383
393
|
projectData,
|
|
394
|
+
// todo: remove stale files once everything is stable
|
|
395
|
+
// currently, watcher fires multiple times & may clean up unsynced files
|
|
396
|
+
// filesToRemove: data.staleFiles ?? [],
|
|
384
397
|
filesToRemove: [],
|
|
385
398
|
filesToSync,
|
|
386
399
|
hmrData: data.hmrData,
|
|
@@ -426,6 +439,7 @@ class RunController extends events_1.EventEmitter {
|
|
|
426
439
|
const fullSyncAction = () => __awaiter(this, void 0, void 0, function* () {
|
|
427
440
|
watchInfo.filesToSync = allAppFiles;
|
|
428
441
|
const fullLiveSyncResultInfo = yield platformLiveSyncService.liveSyncWatchAction(device, watchInfo);
|
|
442
|
+
// IMPORTANT: keep the same instance as we rely on side effects
|
|
429
443
|
_.assign(liveSyncResultInfo, fullLiveSyncResultInfo);
|
|
430
444
|
});
|
|
431
445
|
yield this.$hooksService.executeBeforeHooks("watchAction", {
|
|
@@ -440,6 +454,7 @@ class RunController extends events_1.EventEmitter {
|
|
|
440
454
|
yield this.refreshApplication(projectData, liveSyncResultInfo, data, deviceDescriptor, fullSyncAction);
|
|
441
455
|
if (!liveSyncResultInfo.didRecover && isInHMRMode) {
|
|
442
456
|
const status = yield this.$hmrStatusService.getHmrStatus(device.deviceInfo.identifier, data.hmrData.hash);
|
|
457
|
+
// the timeout is assumed OK as the app could be blocked on a breakpoint
|
|
443
458
|
if (status === constants_1.HmrConstants.HMR_ERROR_STATUS) {
|
|
444
459
|
yield fullSyncAction();
|
|
445
460
|
liveSyncResultInfo.isFullSync = true;
|
|
@@ -524,3 +539,4 @@ __decorate([
|
|
|
524
539
|
], RunController.prototype, "attachDeviceLostHandler", null);
|
|
525
540
|
exports.RunController = RunController;
|
|
526
541
|
yok_1.injector.register("runController", RunController);
|
|
542
|
+
//# sourceMappingURL=run-controller.js.map
|
|
@@ -38,12 +38,15 @@ class UpdateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
38
38
|
this.spinner = this.$terminalSpinnerService.createSpinner();
|
|
39
39
|
const projectData = this.$projectDataService.getProjectData(updateOptions.projectDir);
|
|
40
40
|
updateOptions.version = updateOptions.version || constants_1.PackageVersion.LATEST;
|
|
41
|
+
// back up project files and folders
|
|
41
42
|
this.spinner.info("Backing up project files before update");
|
|
42
43
|
yield this.backupProject();
|
|
43
44
|
this.spinner.succeed("Project files have been backed up");
|
|
45
|
+
// clean up project files
|
|
44
46
|
this.spinner.info("Cleaning up project files before update");
|
|
45
47
|
yield this.cleanUpProject();
|
|
46
48
|
this.spinner.succeed("Project files have been cleaned up");
|
|
49
|
+
// update dependencies
|
|
47
50
|
this.spinner.info("Updating project dependencies");
|
|
48
51
|
yield this.updateDependencies(projectData, updateOptions.version);
|
|
49
52
|
this.spinner.succeed("Project dependencies have been updated");
|
|
@@ -95,6 +98,10 @@ class UpdateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
95
98
|
if (!shouldUpdate) {
|
|
96
99
|
return;
|
|
97
100
|
}
|
|
101
|
+
// check if the coerced version is the same as desired and prefix it with a ~
|
|
102
|
+
// for example:
|
|
103
|
+
// 8.0.0 -> ~8.0.0
|
|
104
|
+
// 8.0.8-next-XXX -> 8.0.8-next-XXX
|
|
98
105
|
const updatedVersion = (() => {
|
|
99
106
|
if (desiredVersion === version) {
|
|
100
107
|
return desiredVersion;
|
|
@@ -155,9 +162,11 @@ class UpdateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
155
162
|
}
|
|
156
163
|
}
|
|
157
164
|
UpdateController.updatableDependencies = [
|
|
165
|
+
// dependencies
|
|
158
166
|
{
|
|
159
167
|
packageName: "@nativescript/core",
|
|
160
168
|
},
|
|
169
|
+
// devDependencies
|
|
161
170
|
{
|
|
162
171
|
packageName: "@nativescript/webpack",
|
|
163
172
|
isDev: true,
|
|
@@ -166,6 +175,7 @@ UpdateController.updatableDependencies = [
|
|
|
166
175
|
packageName: "@nativescript/types",
|
|
167
176
|
isDev: true,
|
|
168
177
|
},
|
|
178
|
+
// runtimes
|
|
169
179
|
{
|
|
170
180
|
packageName: "@nativescript/ios",
|
|
171
181
|
isDev: true,
|
|
@@ -186,3 +196,4 @@ UpdateController.pathsToBackup = [
|
|
|
186
196
|
];
|
|
187
197
|
exports.UpdateController = UpdateController;
|
|
188
198
|
yok_1.injector.register("updateController", UpdateController);
|
|
199
|
+
//# sourceMappingURL=update-controller.js.map
|
package/lib/data/build-data.js
CHANGED
package/lib/data/debug-data.js
CHANGED
package/lib/data/prepare-data.js
CHANGED