nativescript 8.9.1 → 8.9.3-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/test-deps-versions-generated.json +1 -1
- package/lib/android-tools-info.js +0 -12
- package/lib/base-package-manager.js +0 -7
- package/lib/bootstrap.js +1 -5
- package/lib/bun-package-manager.js +1 -17
- package/lib/color.js +0 -3
- package/lib/commands/add-platform.js +0 -1
- package/lib/commands/apple-login.js +0 -1
- package/lib/commands/appstore-list.js +0 -1
- package/lib/commands/appstore-upload.js +0 -3
- package/lib/commands/build.js +2 -3
- package/lib/commands/clean.js +1 -22
- package/lib/commands/command-base.js +0 -1
- package/lib/commands/config.js +0 -4
- package/lib/commands/create-project.js +0 -6
- package/lib/commands/debug.js +1 -6
- package/lib/commands/deploy.js +2 -3
- package/lib/commands/embedding/embed.js +0 -7
- package/lib/commands/extensibility/install-extension.js +0 -1
- package/lib/commands/extensibility/list-extensions.js +0 -1
- package/lib/commands/extensibility/uninstall-extension.js +0 -1
- package/lib/commands/fonts.js +0 -1
- package/lib/commands/generate-assets.js +0 -1
- package/lib/commands/generate-help.js +0 -1
- package/lib/commands/generate.js +1 -48
- package/lib/commands/info.js +0 -1
- package/lib/commands/install.js +0 -1
- package/lib/commands/list-platforms.js +0 -1
- package/lib/commands/migrate.js +0 -1
- package/lib/commands/native-add.js +0 -5
- package/lib/commands/platform-clean.js +0 -1
- package/lib/commands/plugin/add-plugin.js +0 -1
- package/lib/commands/plugin/build-plugin.js +0 -1
- package/lib/commands/plugin/create-plugin.js +0 -5
- package/lib/commands/plugin/list-plugins.js +0 -1
- package/lib/commands/plugin/remove-plugin.js +0 -2
- package/lib/commands/plugin/update-plugin.js +0 -1
- package/lib/commands/post-install.js +0 -6
- package/lib/commands/prepare.js +3 -4
- package/lib/commands/preview.js +0 -2
- package/lib/commands/remove-platform.js +0 -1
- package/lib/commands/resources/resources-update.js +0 -2
- package/lib/commands/run.js +0 -1
- package/lib/commands/setup.js +0 -1
- package/lib/commands/start.js +0 -1
- package/lib/commands/test-init.js +0 -4
- package/lib/commands/test.js +2 -9
- package/lib/commands/typings.js +1 -2
- package/lib/commands/update-platform.js +0 -5
- package/lib/commands/update.js +0 -2
- package/lib/commands/widget.js +1 -20
- package/lib/common/bootstrap.js +0 -1
- package/lib/common/child-process.js +0 -3
- package/lib/common/codeGeneration/code-entity.js +0 -1
- package/lib/common/codeGeneration/code-printer.js +0 -1
- package/lib/common/command-params.js +0 -1
- package/lib/common/commands/analytics.js +0 -3
- package/lib/common/commands/autocompletion.js +0 -3
- package/lib/common/commands/device/device-log-stream.js +0 -1
- package/lib/common/commands/device/get-file.js +0 -2
- package/lib/common/commands/device/list-applications.js +0 -1
- package/lib/common/commands/device/list-devices.js +0 -3
- package/lib/common/commands/device/list-files.js +0 -2
- package/lib/common/commands/device/put-file.js +0 -2
- package/lib/common/commands/device/run-application.js +0 -1
- package/lib/common/commands/device/stop-application.js +0 -1
- package/lib/common/commands/device/uninstall-application.js +0 -1
- package/lib/common/commands/doctor.js +2 -3
- package/lib/common/commands/generate-messages.js +0 -1
- package/lib/common/commands/help.js +0 -1
- package/lib/common/commands/package-manager-get.js +0 -1
- package/lib/common/commands/package-manager-set.js +0 -1
- package/lib/common/commands/post-install.js +0 -1
- package/lib/common/commands/preuninstall.js +2 -11
- package/lib/common/commands/proxy/proxy-base.js +0 -4
- package/lib/common/commands/proxy/proxy-clear.js +0 -1
- package/lib/common/commands/proxy/proxy-get.js +0 -1
- package/lib/common/commands/proxy/proxy-set.js +0 -1
- package/lib/common/common-lib.js +0 -1
- package/lib/common/constants.js +0 -11
- package/lib/common/decorators.js +0 -48
- package/lib/common/dispatchers.js +1 -10
- package/lib/common/errors.js +3 -13
- package/lib/common/file-system.js +2 -13
- package/lib/common/header.js +0 -3
- package/lib/common/helpers.js +3 -89
- package/lib/common/host-info.js +0 -4
- package/lib/common/http-client.js +0 -20
- package/lib/common/logger/appenders/cli-appender.js +0 -4
- package/lib/common/logger/appenders/emit-appender.js +0 -4
- package/lib/common/logger/layouts/cli-layout.js +0 -1
- package/lib/common/logger/logger.js +0 -5
- package/lib/common/messages/messages.js +0 -6
- package/lib/common/mobile/android/android-application-manager.js +1 -20
- package/lib/common/mobile/android/android-debug-bridge-result-handler.js +0 -1
- package/lib/common/mobile/android/android-debug-bridge.js +0 -6
- package/lib/common/mobile/android/android-device-file-system.js +0 -4
- package/lib/common/mobile/android/android-device-hash-service.js +0 -3
- package/lib/common/mobile/android/android-device.js +0 -8
- package/lib/common/mobile/android/android-emulator-services.js +1 -2
- package/lib/common/mobile/android/android-ini-file-parser.js +0 -9
- package/lib/common/mobile/android/android-log-filter.js +0 -4
- package/lib/common/mobile/android/android-virtual-device-service.js +0 -26
- package/lib/common/mobile/android/device-android-debug-bridge.js +0 -1
- package/lib/common/mobile/android/genymotion/genymotion-service.js +1 -6
- package/lib/common/mobile/android/genymotion/virtualbox-service.js +0 -11
- package/lib/common/mobile/android/logcat-helper.js +0 -13
- package/lib/common/mobile/application-manager-base.js +0 -6
- package/lib/common/mobile/device-emitter.js +0 -4
- package/lib/common/mobile/device-log-emitter.js +0 -1
- package/lib/common/mobile/device-log-provider-base.js +0 -1
- package/lib/common/mobile/device-log-provider.js +0 -23
- package/lib/common/mobile/device-platforms-constants.js +0 -1
- package/lib/common/mobile/emulator-helper.js +0 -3
- package/lib/common/mobile/ios/device/ios-application-manager.js +0 -3
- package/lib/common/mobile/ios/device/ios-device-file-system.js +0 -1
- package/lib/common/mobile/ios/device/ios-device-operations.js +0 -4
- package/lib/common/mobile/ios/device/ios-device.js +0 -4
- package/lib/common/mobile/ios/ios-device-base.js +0 -1
- package/lib/common/mobile/ios/ios-device-product-name-mapper.js +0 -2
- package/lib/common/mobile/ios/ios-log-filter.js +0 -1
- package/lib/common/mobile/ios/simulator/ios-emulator-services.js +0 -4
- package/lib/common/mobile/ios/simulator/ios-sim-resolver.js +0 -1
- package/lib/common/mobile/ios/simulator/ios-simulator-application-manager.js +0 -6
- package/lib/common/mobile/ios/simulator/ios-simulator-device.js +0 -5
- package/lib/common/mobile/ios/simulator/ios-simulator-file-system.js +0 -1
- package/lib/common/mobile/ios/simulator/ios-simulator-log-provider.js +0 -1
- package/lib/common/mobile/local-to-device-path-data-factory.js +0 -1
- package/lib/common/mobile/log-filter.js +0 -2
- package/lib/common/mobile/logging-levels.js +0 -1
- package/lib/common/mobile/mobile-core/android-device-discovery.js +0 -2
- package/lib/common/mobile/mobile-core/android-emulator-discovery.js +0 -3
- package/lib/common/mobile/mobile-core/android-process-service.js +0 -32
- package/lib/common/mobile/mobile-core/device-discovery.js +0 -1
- package/lib/common/mobile/mobile-core/devices-service.js +0 -69
- package/lib/common/mobile/mobile-core/ios-device-discovery.js +0 -2
- package/lib/common/mobile/mobile-core/ios-simulator-discovery.js +0 -3
- package/lib/common/mobile/mobile-helper.js +0 -1
- package/lib/common/mobile/wp8/wp8-emulator-services.js +0 -1
- package/lib/common/opener.js +0 -1
- package/lib/common/os-info.js +0 -1
- package/lib/common/plist-parser.js +0 -1
- package/lib/common/project-helper.js +0 -1
- package/lib/common/prompter.js +1 -9
- package/lib/common/queue.js +0 -1
- package/lib/common/resource-loader.js +0 -1
- package/lib/common/services/auto-completion-service.js +1 -13
- package/lib/common/services/cancellation.js +1 -2
- package/lib/common/services/commands-service.js +6 -17
- package/lib/common/services/help-service.js +3 -11
- package/lib/common/services/hooks-service.js +0 -13
- package/lib/common/services/ios-notification-service.js +0 -1
- package/lib/common/services/json-file-settings-service.js +0 -6
- package/lib/common/services/lock-service.js +0 -6
- package/lib/common/services/message-contract-generator.js +0 -1
- package/lib/common/services/messages-service.js +0 -1
- package/lib/common/services/micro-templating-service.js +0 -6
- package/lib/common/services/net-service.js +0 -3
- package/lib/common/services/project-files-manager.js +0 -5
- package/lib/common/services/project-files-provider-base.js +0 -1
- package/lib/common/services/proxy-service.js +0 -1
- package/lib/common/services/qr.js +0 -1
- package/lib/common/services/settings-service.js +0 -1
- package/lib/common/services/xcode-select-service.js +0 -1
- package/lib/common/utils.js +0 -1
- package/lib/common/validators/project-name-validator.js +0 -1
- package/lib/common/validators/validation-result.js +0 -1
- package/lib/common/verify-node-version.js +1 -8
- package/lib/common/yok.js +11 -32
- package/lib/config.js +1 -22
- package/lib/constants-provider.js +0 -1
- package/lib/constants.js +0 -53
- package/lib/controllers/build-controller.js +3 -4
- package/lib/controllers/debug-controller.js +3 -8
- package/lib/controllers/deploy-controller.js +0 -1
- package/lib/controllers/migrate-controller.js +4 -90
- package/lib/controllers/platform-controller.js +1 -9
- package/lib/controllers/prepare-controller.js +4 -17
- package/lib/controllers/run-controller.js +1 -17
- package/lib/controllers/update-controller-base.js +0 -1
- package/lib/controllers/update-controller.js +0 -11
- package/lib/data/build-data.js +0 -1
- package/lib/data/controller-data-base.js +0 -1
- package/lib/data/debug-data.js +0 -1
- package/lib/data/platform-data.js +0 -1
- package/lib/data/prepare-data.js +0 -1
- package/lib/data/run-data.js +0 -1
- package/lib/definitions/project.d.ts +7 -0
- package/lib/detached-processes/cleanup-js-subprocess.js +2 -8
- package/lib/detached-processes/cleanup-process.js +14 -18
- package/lib/detached-processes/file-log-service.js +1 -2
- package/lib/device-path-provider.js +0 -1
- package/lib/device-sockets/ios/app-debug-socket-proxy-factory.js +0 -7
- package/lib/device-sockets/ios/notification.js +0 -3
- package/lib/device-sockets/ios/socket-request-executor.js +0 -3
- package/lib/helpers/android-bundle-validator-helper.js +1 -2
- package/lib/helpers/deploy-command-helper.js +0 -1
- package/lib/helpers/key-command-helper.js +2 -4
- package/lib/helpers/livesync-command-helper.js +1 -4
- package/lib/helpers/network-connectivity-validator.js +0 -1
- package/lib/helpers/options-track-helper.js +2 -3
- package/lib/helpers/package-path-helper.js +0 -1
- package/lib/helpers/platform-command-helper.js +2 -7
- package/lib/helpers/version-validator-helper.js +0 -1
- package/lib/key-commands/bootstrap.js +2 -3
- package/lib/key-commands/index.js +4 -5
- package/lib/nativescript-cli-lib-bootstrap.js +0 -4
- package/lib/nativescript-cli-lib.js +0 -1
- package/lib/nativescript-cli.js +1 -10
- package/lib/node/pbxproj-dom-xcode.js +0 -1
- package/lib/node/xcode.js +0 -1
- package/lib/node-package-manager.js +1 -11
- package/lib/options.js +119 -144
- package/lib/package-installation-manager.js +1 -8
- package/lib/package-manager.js +0 -2
- package/lib/platform-command-param.js +0 -1
- package/lib/pnpm-package-manager.js +1 -4
- package/lib/project-data.js +4 -12
- package/lib/providers/project-files-provider.js +0 -1
- package/lib/resolvers/livesync-service-resolver.js +0 -1
- package/lib/services/analytics/analytics-broker-process.js +6 -10
- package/lib/services/analytics/analytics-broker.js +1 -2
- package/lib/services/analytics/analytics-service.js +25 -29
- package/lib/services/analytics/google-analytics-provider.js +12 -13
- package/lib/services/analytics-settings-service.js +0 -5
- package/lib/services/android/android-bundle-tool-service.js +0 -1
- package/lib/services/android/gradle-build-args-service.js +0 -3
- package/lib/services/android/gradle-build-service.js +0 -1
- package/lib/services/android/gradle-command-service.js +0 -1
- package/lib/services/android-device-debug-service.js +0 -6
- package/lib/services/android-plugin-build-service.js +2 -31
- package/lib/services/android-project-service.js +4 -71
- package/lib/services/android-resources-migration-service.js +0 -7
- package/lib/services/apple-portal/apple-portal-application-service.js +0 -1
- package/lib/services/apple-portal/apple-portal-cookie-service.js +0 -1
- package/lib/services/apple-portal/apple-portal-session-service.js +4 -6
- package/lib/services/apple-portal/srp/srp-wrapper.js +1 -4
- package/lib/services/assets-generation/assets-generation-service.js +5 -16
- package/lib/services/build-artifacts-service.js +1 -2
- package/lib/services/build-data-service.js +0 -1
- package/lib/services/build-info-file-service.js +0 -1
- package/lib/services/cleanup-service.js +9 -13
- package/lib/services/cocoapods-platform-manager.js +0 -9
- package/lib/services/cocoapods-service.js +1 -21
- package/lib/services/debug-data-service.js +0 -1
- package/lib/services/debug-service-base.js +0 -7
- package/lib/services/device/device-install-app-service.js +1 -2
- package/lib/services/doctor-service.js +6 -21
- package/lib/services/extensibility-service.js +0 -8
- package/lib/services/files-hash-service.js +0 -1
- package/lib/services/hmr-status-service.js +0 -2
- package/lib/services/info-service.js +0 -1
- package/lib/services/initialize-service.js +1 -5
- package/lib/services/ios/export-options-plist-service.js +0 -4
- package/lib/services/ios/ios-signing-service.js +0 -4
- package/lib/services/ios/spm-service.js +0 -11
- package/lib/services/ios/xcodebuild-args-service.js +0 -9
- package/lib/services/ios/xcodebuild-command-service.js +0 -1
- package/lib/services/ios/xcodebuild-service.js +1 -2
- package/lib/services/ios-debugger-port-service.js +0 -1
- package/lib/services/ios-device-debug-service.js +0 -1
- package/lib/services/ios-entitlements-service.js +0 -1
- package/lib/services/ios-extensions-service.js +0 -1
- package/lib/services/ios-log-filter.js +0 -20
- package/lib/services/ios-native-target-service.js +4 -6
- package/lib/services/ios-project-service.js +1 -91
- package/lib/services/ios-provision-service.js +0 -3
- package/lib/services/ios-watch-app-service.js +0 -1
- package/lib/services/ip-service.js +0 -2
- package/lib/services/itmstransporter-service.js +0 -1
- package/lib/services/karma-execution.js +0 -2
- package/lib/services/livesync/android-device-livesync-service-base.js +0 -1
- package/lib/services/livesync/android-device-livesync-service.js +0 -2
- package/lib/services/livesync/android-device-livesync-sockets-service.js +0 -3
- package/lib/services/livesync/android-livesync-service.js +0 -1
- package/lib/services/livesync/android-livesync-tool.js +0 -4
- package/lib/services/livesync/device-livesync-service-base.js +0 -2
- package/lib/services/livesync/ios-device-livesync-service.js +0 -7
- package/lib/services/livesync/ios-livesync-service.js +0 -2
- package/lib/services/livesync/livesync-socket.js +0 -1
- package/lib/services/livesync/platform-livesync-service-base.js +0 -5
- package/lib/services/livesync-process-data-service.js +0 -1
- package/lib/services/log-parser-service.js +0 -1
- package/lib/services/log-source-map-service.js +0 -15
- package/lib/services/marking-mode-service.js +5 -8
- package/lib/services/metadata-filtering-service.js +0 -1
- package/lib/services/npm-config-service.js +0 -4
- package/lib/services/pacote-service.js +0 -7
- package/lib/services/performance-service.js +1 -3
- package/lib/services/platform/add-platform-service.js +2 -49
- package/lib/services/platform/platform-validation-service.js +0 -1
- package/lib/services/platform/prepare-native-platform-service.js +2 -5
- package/lib/services/platform-environment-requirements.js +3 -8
- package/lib/services/platform-project-service-base.js +0 -1
- package/lib/services/platforms-data-service.js +0 -1
- package/lib/services/plugins-service.js +2 -20
- package/lib/services/prepare-data-service.js +0 -1
- package/lib/services/project-backup-service.js +0 -4
- package/lib/services/project-changes-service.js +3 -14
- package/lib/services/project-cleanup-service.js +0 -2
- package/lib/services/project-config-service.js +2 -21
- package/lib/services/project-data-service.js +7 -36
- package/lib/services/project-name-service.js +0 -1
- package/lib/services/project-service.js +0 -10
- package/lib/services/project-templates-service.js +2 -3
- package/lib/services/qr-code-terminal-service.js +0 -1
- package/lib/services/require-service.js +0 -1
- package/lib/services/start-service.js +0 -1
- package/lib/services/temp-service.js +0 -1
- package/lib/services/terminal-spinner-service.js +0 -2
- package/lib/services/test-execution-service.js +2 -9
- package/lib/services/test-initialization-service.js +0 -4
- package/lib/services/timeline-profiler-service.js +0 -1
- package/lib/services/user-settings-service.js +0 -1
- package/lib/services/versions-service.js +4 -6
- package/lib/services/watch-ignore-list-service.js +0 -1
- package/lib/services/webpack/webpack-compiler-service.js +35 -57
- package/lib/services/xcconfig-service.js +0 -2
- package/lib/services/xcproj-service.js +0 -1
- package/lib/shared-event-bus.js +0 -6
- package/lib/sys-info.js +1 -2
- package/lib/tools/config-manipulation/config-transformer.js +0 -12
- package/lib/tools/node-modules/node-modules-builder.js +0 -1
- package/lib/tools/node-modules/node-modules-dependencies-builder.js +0 -6
- package/lib/yarn-package-manager.js +0 -1
- package/lib/yarn2-package-manager.js +0 -3
- package/package.json +1 -1
|
@@ -12,12 +12,8 @@ const helpers_1 = require("../common/helpers");
|
|
|
12
12
|
const yok_1 = require("../common/yok");
|
|
13
13
|
const temp = require("temp");
|
|
14
14
|
const color_1 = require("../color");
|
|
15
|
-
// const wait: (ms: number) => Promise<void> = (ms: number = 1000) =>
|
|
16
|
-
// new Promise((resolve) => setTimeout(resolve, ms));
|
|
17
15
|
class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
18
|
-
constructor($fs, $platformCommandHelper, $platformsDataService, $packageInstallationManager, $packageManager, $pacoteService,
|
|
19
|
-
// private $androidResourcesMigrationService: IAndroidResourcesMigrationService,
|
|
20
|
-
$logger, $errors, $pluginsService, $projectDataService, $projectConfigService, $options, $resources, $injector, $settingsService, $staticConfig, $terminalSpinnerService, $projectCleanupService, $projectBackupService, $childProcess) {
|
|
16
|
+
constructor($fs, $platformCommandHelper, $platformsDataService, $packageInstallationManager, $packageManager, $pacoteService, $logger, $errors, $pluginsService, $projectDataService, $projectConfigService, $options, $resources, $injector, $settingsService, $staticConfig, $terminalSpinnerService, $projectCleanupService, $projectBackupService, $childProcess) {
|
|
21
17
|
super($fs, $platformCommandHelper, $platformsDataService, $packageInstallationManager, $packageManager, $pacoteService);
|
|
22
18
|
this.$fs = $fs;
|
|
23
19
|
this.$platformCommandHelper = $platformCommandHelper;
|
|
@@ -155,18 +151,15 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
155
151
|
{
|
|
156
152
|
packageName: "node-sass",
|
|
157
153
|
replaceWith: "sass",
|
|
158
|
-
minVersion: "0.0.0",
|
|
154
|
+
minVersion: "0.0.0",
|
|
159
155
|
isDev: true,
|
|
160
|
-
// shouldRemove: true,
|
|
161
156
|
},
|
|
162
157
|
{
|
|
163
158
|
packageName: "sass",
|
|
164
|
-
minVersion: "0.0.0",
|
|
159
|
+
minVersion: "0.0.0",
|
|
165
160
|
desiredVersion: "^1.49.9",
|
|
166
161
|
isDev: true,
|
|
167
|
-
// shouldRemove: true,
|
|
168
162
|
},
|
|
169
|
-
// runtimes
|
|
170
163
|
{
|
|
171
164
|
packageName: "tns-ios",
|
|
172
165
|
minVersion: "6.5.3",
|
|
@@ -209,10 +202,8 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
209
202
|
remainingPlatforms.push(platform);
|
|
210
203
|
continue;
|
|
211
204
|
}
|
|
212
|
-
// should only run in loose mode...
|
|
213
205
|
const cachedResult = await this.getCachedShouldMigrate(projectDir, platform);
|
|
214
206
|
this.$logger.trace(`Got cached result for shouldMigrate for platform: ${platform}: ${cachedResult}`);
|
|
215
|
-
// the cached result is only used if it's false, otherwise we need to check again
|
|
216
207
|
if (cachedResult !== false) {
|
|
217
208
|
remainingPlatforms.push(platform);
|
|
218
209
|
}
|
|
@@ -224,7 +215,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
224
215
|
loose,
|
|
225
216
|
});
|
|
226
217
|
this.$logger.trace(`Executed shouldMigrate for platforms: ${remainingPlatforms}. Result is: ${shouldMigrate}`);
|
|
227
|
-
// only cache results if running in loose mode
|
|
228
218
|
if (!shouldMigrate && loose) {
|
|
229
219
|
for (const remainingPlatform of remainingPlatforms) {
|
|
230
220
|
await this.setCachedShouldMigrate(projectDir, remainingPlatform);
|
|
@@ -251,46 +241,37 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
251
241
|
platforms,
|
|
252
242
|
loose: loose,
|
|
253
243
|
});
|
|
254
|
-
// ensure in git repo and require --force if not (for safety)
|
|
255
|
-
// ensure git branch is clean
|
|
256
244
|
const canMigrate = await this.ensureGitCleanOrForce(projectDir);
|
|
257
245
|
if (!canMigrate) {
|
|
258
246
|
this.spinner.fail("Pre-Migration verification failed");
|
|
259
247
|
return;
|
|
260
248
|
}
|
|
261
249
|
this.spinner.succeed("Pre-Migration verification complete");
|
|
262
|
-
// back up project files and folders
|
|
263
250
|
this.spinner.info("Backing up project files before migration");
|
|
264
251
|
const backup = await this.backupProject(projectDir);
|
|
265
252
|
this.spinner.succeed("Project files have been backed up");
|
|
266
|
-
// clean up project files
|
|
267
253
|
this.spinner.info("Cleaning up project files before migration");
|
|
268
254
|
await this.cleanUpProject(projectData);
|
|
269
255
|
this.spinner.succeed("Project files have been cleaned up");
|
|
270
|
-
// clean up artifacts
|
|
271
256
|
this.spinner.info("Cleaning up old artifacts");
|
|
272
257
|
await this.handleAutoGeneratedFiles(backup, projectData);
|
|
273
258
|
this.spinner.succeed("Cleaned old artifacts");
|
|
274
259
|
const newConfigPath = path.resolve(projectDir, "nativescript.config.ts");
|
|
275
260
|
if (!this.$fs.exists(newConfigPath)) {
|
|
276
|
-
// migrate configs
|
|
277
261
|
this.spinner.info(`Migrating project to use ${color_1.color.green("nativescript.config.ts")}`);
|
|
278
262
|
await this.migrateConfigs(projectDir);
|
|
279
263
|
this.spinner.succeed(`Project has been migrated to use ${color_1.color.green("nativescript.config.ts")}`);
|
|
280
264
|
}
|
|
281
|
-
// update dependencies
|
|
282
265
|
this.spinner.info("Updating project dependencies");
|
|
283
266
|
await this.migrateDependencies(projectData, platforms, loose);
|
|
284
267
|
this.spinner.succeed("Project dependencies have been updated");
|
|
285
268
|
const isAngular = this.hasDependency({
|
|
286
269
|
packageName: "@nativescript/angular",
|
|
287
270
|
}, projectData);
|
|
288
|
-
// ensure polyfills.ts exists in angular projects
|
|
289
271
|
let polyfillsPath;
|
|
290
272
|
if (isAngular) {
|
|
291
273
|
polyfillsPath = await this.checkOrCreatePolyfillsTS(projectData);
|
|
292
274
|
}
|
|
293
|
-
// update tsconfig
|
|
294
275
|
const tsConfigPath = path.resolve(projectDir, "tsconfig.json");
|
|
295
276
|
if (this.$fs.exists(tsConfigPath)) {
|
|
296
277
|
this.spinner.info(`Updating ${color_1.color.yellow("tsconfig.json")}`);
|
|
@@ -302,19 +283,11 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
302
283
|
this.spinner.succeed(`Updated ${color_1.color.yellow("tsconfig.json")}`);
|
|
303
284
|
}
|
|
304
285
|
await this.migrateWebpack5(projectDir, projectData);
|
|
305
|
-
// run @nativescript/eslint over codebase
|
|
306
286
|
await this.runESLint(projectDir);
|
|
307
287
|
this.spinner.succeed("Migration complete.");
|
|
308
288
|
this.$logger.info("");
|
|
309
289
|
this.$logger.printMarkdown("Project has been successfully migrated. The next step is to run `ns run <platform>` to ensure everything is working properly." +
|
|
310
290
|
"\n\nPlease note that you may need additional changes to complete the migration.");
|
|
311
|
-
// print markdown for next steps:
|
|
312
|
-
// if no runtime has been added, print a message that it will be added when they run ns run <platform>
|
|
313
|
-
// if all is good, run ns migrate clean to clean up backup folders
|
|
314
|
-
// in case of failure, print diagnostic data: what failed and why
|
|
315
|
-
// restore all files - or perhaps let the user sort it out
|
|
316
|
-
// or ns migrate restore - to restore from pre-migration backup
|
|
317
|
-
// for some known cases, print suggestions perhaps
|
|
318
291
|
}
|
|
319
292
|
async _shouldMigrate({ projectDir, platforms, loose, }) {
|
|
320
293
|
const isMigrate = _.get(this.$options, "argv._[0]") === "migrate";
|
|
@@ -331,7 +304,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
331
304
|
if (dependency.shouldAddIfMissing) {
|
|
332
305
|
this.$logger.trace(`${shouldMigrateCommonMessage}'${dependency.packageName}' is missing.`);
|
|
333
306
|
if (loose) {
|
|
334
|
-
// in loose mode we ignore missing dependencies
|
|
335
307
|
continue;
|
|
336
308
|
}
|
|
337
309
|
return true;
|
|
@@ -347,7 +319,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
347
319
|
}
|
|
348
320
|
if (dependency.replaceWith || dependency.shouldRemove) {
|
|
349
321
|
this.$logger.trace(`${shouldMigrateCommonMessage}'${dependency.packageName}' is deprecated.`);
|
|
350
|
-
// in loose mode we ignore deprecated dependencies
|
|
351
322
|
if (loose) {
|
|
352
323
|
continue;
|
|
353
324
|
}
|
|
@@ -390,32 +361,11 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
390
361
|
const projectPackageJsonFilePath = path.join(projectDir, constants.PACKAGE_JSON_FILE_NAME);
|
|
391
362
|
return await this.$fs.getFileShasum(projectPackageJsonFilePath);
|
|
392
363
|
}
|
|
393
|
-
// private async migrateOldAndroidAppResources(
|
|
394
|
-
// projectData: IProjectData,
|
|
395
|
-
// backupDir: string
|
|
396
|
-
// ) {
|
|
397
|
-
// const appResourcesPath = projectData.getAppResourcesDirectoryPath();
|
|
398
|
-
// if (!this.$androidResourcesMigrationService.hasMigrated(appResourcesPath)) {
|
|
399
|
-
// this.spinner.info("Migrate old Android App_Resources structure.");
|
|
400
|
-
// try {
|
|
401
|
-
// await this.$androidResourcesMigrationService.migrate(
|
|
402
|
-
// appResourcesPath,
|
|
403
|
-
// backupDir
|
|
404
|
-
// );
|
|
405
|
-
// } catch (error) {
|
|
406
|
-
// this.$logger.warn(
|
|
407
|
-
// "Migrate old Android App_Resources structure failed: ",
|
|
408
|
-
// error.message
|
|
409
|
-
// );
|
|
410
|
-
// }
|
|
411
|
-
// }
|
|
412
|
-
// }
|
|
413
364
|
async ensureGitCleanOrForce(projectDir) {
|
|
414
365
|
const git = (0, simple_git_1.default)(projectDir);
|
|
415
366
|
const isGit = await git.checkIsRepo();
|
|
416
367
|
const isForce = this.$options.force;
|
|
417
368
|
if (!isGit) {
|
|
418
|
-
// not a git repo and no --force
|
|
419
369
|
if (!isForce) {
|
|
420
370
|
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\`.`);
|
|
421
371
|
this.$errors.fail("Not in Git repo.");
|
|
@@ -462,7 +412,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
462
412
|
const { dependencies, devDependencies } = await this.$pluginsService.getDependenciesFromPackageJson(projectData.projectDir);
|
|
463
413
|
const hasSchematics = [...dependencies, ...devDependencies].find((p) => p.name === "@nativescript/schematics");
|
|
464
414
|
if (!hasSchematics) {
|
|
465
|
-
// clean tsconfig.tns.json if not in a shared project
|
|
466
415
|
await this.$projectCleanupService.clean([
|
|
467
416
|
constants.TSCCONFIG_TNS_JSON_NAME,
|
|
468
417
|
]);
|
|
@@ -509,14 +458,12 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
509
458
|
});
|
|
510
459
|
}
|
|
511
460
|
isOutdatedVersion(current, target, loose) {
|
|
512
|
-
// in loose mode, a falsy version is not considered outdated
|
|
513
461
|
if (!current && loose) {
|
|
514
462
|
return false;
|
|
515
463
|
}
|
|
516
464
|
const installed = semver.coerce(current);
|
|
517
465
|
const min = semver.coerce(target.minVersion);
|
|
518
466
|
const desired = semver.coerce(target.desiredVersion);
|
|
519
|
-
// in loose mode we check if we satisfy the min version
|
|
520
467
|
if (loose) {
|
|
521
468
|
if (!installed || !min) {
|
|
522
469
|
return false;
|
|
@@ -526,7 +473,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
526
473
|
if (!installed || !desired) {
|
|
527
474
|
return true;
|
|
528
475
|
}
|
|
529
|
-
// otherwise we compare with the desired version
|
|
530
476
|
return semver.lt(installed, desired);
|
|
531
477
|
}
|
|
532
478
|
detectAppPath(projectDir, configData) {
|
|
@@ -589,7 +535,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
589
535
|
async migrateDependency(dependency, projectData, loose) {
|
|
590
536
|
var _a, _b, _c, _d, _e;
|
|
591
537
|
const hasDependency = this.hasDependency(dependency, projectData);
|
|
592
|
-
// show warning if needed
|
|
593
538
|
if (hasDependency && dependency.warning) {
|
|
594
539
|
this.$logger.warn(dependency.warning);
|
|
595
540
|
}
|
|
@@ -605,9 +550,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
605
550
|
return;
|
|
606
551
|
}
|
|
607
552
|
if (dependency.replaceWith || dependency.shouldRemove) {
|
|
608
|
-
// remove
|
|
609
553
|
this.$pluginsService.removeFromPackageJson(dependency.packageName, projectData.projectDir);
|
|
610
|
-
// no replacement required - we're done
|
|
611
554
|
if (!dependency.replaceWith) {
|
|
612
555
|
return;
|
|
613
556
|
}
|
|
@@ -616,7 +559,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
616
559
|
this.$errors.fail("Failed to find replacement dependency.");
|
|
617
560
|
}
|
|
618
561
|
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;
|
|
619
|
-
// add replacement dependency
|
|
620
562
|
this.$pluginsService.addToPackageJson(replacementDep.packageName, version, replacementDep.isDev, projectData.projectDir);
|
|
621
563
|
this.spinner.clear();
|
|
622
564
|
this.$logger.info(` - ${color_1.color.yellow(dependency.packageName)} has been replaced with ${color_1.color.cyan(replacementDep.packageName)} ${color_1.color.green(version)}`);
|
|
@@ -636,57 +578,40 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
636
578
|
}
|
|
637
579
|
async migrateConfigs(projectDir) {
|
|
638
580
|
const projectData = this.$projectDataService.getProjectData(projectDir);
|
|
639
|
-
// package.json
|
|
640
581
|
const rootPackageJsonPath = path.resolve(projectDir, constants.PACKAGE_JSON_FILE_NAME);
|
|
641
|
-
// nested package.json
|
|
642
582
|
const embeddedPackageJsonPath = path.resolve(projectData.projectDir, projectData.getAppDirectoryRelativePath(), constants.PACKAGE_JSON_FILE_NAME);
|
|
643
|
-
// nsconfig.json
|
|
644
583
|
const legacyNsConfigPath = path.resolve(projectData.projectDir, constants.CONFIG_NS_FILE_NAME);
|
|
645
584
|
let rootPackageJsonData = {};
|
|
646
585
|
if (this.$fs.exists(rootPackageJsonPath)) {
|
|
647
586
|
rootPackageJsonData = this.$fs.readJson(rootPackageJsonPath);
|
|
648
587
|
}
|
|
649
|
-
// write the default config unless it already exists
|
|
650
588
|
const newConfigPath = this.$projectConfigService.writeDefaultConfig(projectData.projectDir);
|
|
651
|
-
// force legacy config mode
|
|
652
589
|
this.$projectConfigService.setForceUsingLegacyConfig(true);
|
|
653
|
-
// all different sources are combined into configData (nested package.json, nsconfig and root package.json[nativescript])
|
|
654
590
|
const configData = this.$projectConfigService.readConfig(projectData.projectDir);
|
|
655
|
-
// we no longer want to force legacy config mode
|
|
656
591
|
this.$projectConfigService.setForceUsingLegacyConfig(false);
|
|
657
|
-
// move main key into root package.json
|
|
658
592
|
if (configData.main) {
|
|
659
593
|
rootPackageJsonData.main = configData.main;
|
|
660
594
|
delete configData.main;
|
|
661
595
|
}
|
|
662
|
-
// detect appPath and App_Resources path
|
|
663
596
|
configData.appPath = this.detectAppPath(projectDir, configData);
|
|
664
597
|
configData.appResourcesPath = this.detectAppResourcesPath(projectDir, configData);
|
|
665
|
-
// delete nativescript key from root package.json
|
|
666
598
|
if (rootPackageJsonData.nativescript) {
|
|
667
599
|
delete rootPackageJsonData.nativescript;
|
|
668
600
|
}
|
|
669
|
-
// force the config service to use nativescript.config.ts
|
|
670
601
|
this.$projectConfigService.setForceUsingNewConfig(true);
|
|
671
|
-
|
|
672
|
-
const hasUpdatedConfigSuccessfully = await this.$projectConfigService.setValue("", // root
|
|
673
|
-
configData);
|
|
602
|
+
const hasUpdatedConfigSuccessfully = await this.$projectConfigService.setValue("", configData);
|
|
674
603
|
if (!hasUpdatedConfigSuccessfully) {
|
|
675
604
|
if (typeof newConfigPath === "string") {
|
|
676
|
-
// only clean the config if it was created by the migration script
|
|
677
605
|
await this.$projectCleanupService.cleanPath(newConfigPath);
|
|
678
606
|
}
|
|
679
607
|
this.$errors.fail(`Failed to migrate project to use ${constants.CONFIG_FILE_NAME_TS}. One or more values could not be updated.`);
|
|
680
608
|
}
|
|
681
|
-
// save root package.json
|
|
682
609
|
this.$fs.writeJson(rootPackageJsonPath, rootPackageJsonData);
|
|
683
|
-
// delete migrated files
|
|
684
610
|
await this.$projectCleanupService.cleanPath(embeddedPackageJsonPath);
|
|
685
611
|
await this.$projectCleanupService.cleanPath(legacyNsConfigPath);
|
|
686
612
|
return true;
|
|
687
613
|
}
|
|
688
614
|
async migrateUnitTestRunner(projectData, migrationBackupDirPath) {
|
|
689
|
-
// Migrate karma.conf.js
|
|
690
615
|
const pathToKarmaConfig = path.join(migrationBackupDirPath, constants.KARMA_CONFIG_NAME);
|
|
691
616
|
if (this.$fs.exists(pathToKarmaConfig)) {
|
|
692
617
|
const oldKarmaContent = this.$fs.readText(pathToKarmaConfig);
|
|
@@ -704,7 +629,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
704
629
|
});
|
|
705
630
|
this.$fs.writeFile(path.join(projectData.projectDir, constants.KARMA_CONFIG_NAME), karmaConf);
|
|
706
631
|
}
|
|
707
|
-
// Dependencies to migrate
|
|
708
632
|
const dependencies = [
|
|
709
633
|
{
|
|
710
634
|
packageName: "karma-webpack",
|
|
@@ -746,7 +670,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
746
670
|
async migrateTSConfig({ tsConfigPath, isAngular, polyfillsPath, }) {
|
|
747
671
|
try {
|
|
748
672
|
const configContents = this.$fs.readJson(tsConfigPath);
|
|
749
|
-
// update
|
|
750
673
|
configContents.compilerOptions = configContents.compilerOptions || {};
|
|
751
674
|
configContents.compilerOptions.target = "es2020";
|
|
752
675
|
configContents.compilerOptions.module = "esnext";
|
|
@@ -757,7 +680,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
757
680
|
...new Set([...(configContents.compilerOptions.lib || []), "ESNext"]),
|
|
758
681
|
];
|
|
759
682
|
if (isAngular) {
|
|
760
|
-
// make sure polyfills.ts is in files
|
|
761
683
|
if (configContents.files) {
|
|
762
684
|
configContents.files = [
|
|
763
685
|
...new Set([
|
|
@@ -791,10 +713,8 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
791
713
|
const tempDir = temp.mkdirSync({
|
|
792
714
|
prefix: "migrate-angular-polyfills",
|
|
793
715
|
});
|
|
794
|
-
// get from default angular template
|
|
795
716
|
await this.$pacoteService.extractPackage(constants.RESERVED_TEMPLATE_NAMES["angular"], tempDir);
|
|
796
717
|
this.$fs.copyFile(path.resolve(tempDir, "src/polyfills.ts"), possiblePaths[0]);
|
|
797
|
-
// clean up temp project
|
|
798
718
|
this.$fs.deleteDirectory(tempDir);
|
|
799
719
|
this.spinner.succeed(`Created fresh ${color_1.color.cyan("polyfills.ts")}`);
|
|
800
720
|
return "./" + path.relative(projectDir, possiblePaths[0]);
|
|
@@ -863,7 +783,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
863
783
|
desiredVersion: "~0.15.0",
|
|
864
784
|
shouldAddIfMissing: true,
|
|
865
785
|
},
|
|
866
|
-
// devDependencies
|
|
867
786
|
{
|
|
868
787
|
packageName: "@angular/cli",
|
|
869
788
|
minVersion,
|
|
@@ -934,12 +853,10 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
934
853
|
packageName: "@babel/preset-env",
|
|
935
854
|
shouldRemove: true,
|
|
936
855
|
},
|
|
937
|
-
// remove any version of vue
|
|
938
856
|
{
|
|
939
857
|
packageName: "vue",
|
|
940
858
|
shouldRemove: true,
|
|
941
859
|
},
|
|
942
|
-
// add latest
|
|
943
860
|
{
|
|
944
861
|
packageName: "vue",
|
|
945
862
|
desiredVersion: "2.6.12",
|
|
@@ -1035,7 +952,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
1035
952
|
return;
|
|
1036
953
|
}
|
|
1037
954
|
}
|
|
1038
|
-
// clean old config before generating new one
|
|
1039
955
|
await this.$projectCleanupService.clean(["webpack.config.js"]);
|
|
1040
956
|
this.spinner.info(`Initializing new ${color_1.color.yellow("webpack.config.js")}`);
|
|
1041
957
|
const { desiredVersion: webpackVersion } = this.migrationDependencies.find((dep) => dep.packageName === constants.WEBPACK_PLUGIN_NAME);
|
|
@@ -1110,7 +1026,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
1110
1026
|
}
|
|
1111
1027
|
}
|
|
1112
1028
|
exports.MigrateController = MigrateController;
|
|
1113
|
-
// static readonly typescriptPackageName: string = "typescript";
|
|
1114
1029
|
MigrateController.backupFolderName = ".migration_backup";
|
|
1115
1030
|
MigrateController.pathsToBackup = [
|
|
1116
1031
|
constants.LIB_DIR_NAME,
|
|
@@ -1123,4 +1038,3 @@ MigrateController.pathsToBackup = [
|
|
|
1123
1038
|
constants.CONFIG_NS_FILE_NAME,
|
|
1124
1039
|
];
|
|
1125
1040
|
yok_1.injector.register("migrateController", MigrateController);
|
|
1126
|
-
//# sourceMappingURL=migrate-controller.js.map
|
|
@@ -84,13 +84,9 @@ 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
|
|
88
87
|
desiredRuntimePackage.version =
|
|
89
88
|
await this.$packageInstallationManager.getLatestCompatibleVersion(desiredRuntimePackage.name);
|
|
90
89
|
}
|
|
91
|
-
// const currentPlatformData = this.$projectDataService.getNSValue(projectData.projectDir, platformData.frameworkPackageName);
|
|
92
|
-
// version = (currentPlatformData && currentPlatformData.version) ||
|
|
93
|
-
// await this.$packageInstallationManager.getLatestCompatibleVersion(platformData.frameworkPackageName);
|
|
94
90
|
result = `${desiredRuntimePackage.name}@${desiredRuntimePackage.version}`;
|
|
95
91
|
}
|
|
96
92
|
return result;
|
|
@@ -102,14 +98,11 @@ class PlatformController {
|
|
|
102
98
|
const prepareInfo = this.$projectChangesService.getPrepareInfo(platformData);
|
|
103
99
|
const requiresNativePlatformAdd = prepareInfo &&
|
|
104
100
|
prepareInfo.nativePlatformStatus ===
|
|
105
|
-
"1"
|
|
101
|
+
"1";
|
|
106
102
|
const shouldAddPlatform = !hasPlatformDirectory ||
|
|
107
103
|
(shouldAddNativePlatform && requiresNativePlatformAdd);
|
|
108
104
|
if (hasPlatformDirectory && !shouldAddPlatform) {
|
|
109
105
|
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.
|
|
113
106
|
if (platformDirectoryItemCount <= 2) {
|
|
114
107
|
this.$logger.warn(`The platforms/${platformName} folder appears to be invalid. If the build fails, run 'ns clean' and rebuild the app.`, { wrapMessageWithBorders: true });
|
|
115
108
|
}
|
|
@@ -119,4 +112,3 @@ class PlatformController {
|
|
|
119
112
|
}
|
|
120
113
|
exports.PlatformController = PlatformController;
|
|
121
114
|
yok_1.injector.register("platformController", PlatformController);
|
|
122
|
-
//# sourceMappingURL=platform-controller.js.map
|
|
@@ -76,10 +76,6 @@ 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
|
|
83
79
|
prepareData.env = prepareData.env || {};
|
|
84
80
|
prepareData.env.externals = prepareData.env.externals || [];
|
|
85
81
|
prepareData.env.externals.push("~/package.json");
|
|
@@ -120,8 +116,8 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
120
116
|
},
|
|
121
117
|
};
|
|
122
118
|
}
|
|
123
|
-
await this.startJSWatcherWithPrepare(platformData, projectData, prepareData);
|
|
124
|
-
const hasNativeChanges = await this.startNativeWatcherWithPrepare(platformData, projectData, prepareData);
|
|
119
|
+
await this.startJSWatcherWithPrepare(platformData, projectData, prepareData);
|
|
120
|
+
const hasNativeChanges = await this.startNativeWatcherWithPrepare(platformData, projectData, prepareData);
|
|
125
121
|
const result = {
|
|
126
122
|
platform: platformData.platformNameLowerCase,
|
|
127
123
|
hasNativeChanges,
|
|
@@ -130,7 +126,6 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
130
126
|
if (hasPersistedDataWithNativeChanges) {
|
|
131
127
|
result.hasNativeChanges = true;
|
|
132
128
|
}
|
|
133
|
-
// TODO: Do not persist this in `this` context. Also it should be per platform.
|
|
134
129
|
this.isInitialPrepareReady = true;
|
|
135
130
|
if (this.persistedData && this.persistedData.length) {
|
|
136
131
|
this.emitPrepareEvent({
|
|
@@ -183,7 +178,7 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
183
178
|
pollInterval: 100,
|
|
184
179
|
stabilityThreshold: 500,
|
|
185
180
|
},
|
|
186
|
-
ignored: ["**/.*", ".*"],
|
|
181
|
+
ignored: ["**/.*", ".*"],
|
|
187
182
|
};
|
|
188
183
|
const watcher = (0, chokidar_1.watch)(patterns, watcherOptions).on("all", async (event, filePath) => {
|
|
189
184
|
if (this.isFileWatcherPaused())
|
|
@@ -225,9 +220,6 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
225
220
|
.concat(pluginsPackageJsonFiles);
|
|
226
221
|
return patterns;
|
|
227
222
|
}
|
|
228
|
-
/**
|
|
229
|
-
* TODO: move this logic to the webpack side of things - WIP and deprecate here with a webpack version check...
|
|
230
|
-
*/
|
|
231
223
|
async writeRuntimePackageJson(projectData, platformData, prepareData = null) {
|
|
232
224
|
const configInfo = this.$projectConfigService.detectProjectConfigs(projectData.projectDir);
|
|
233
225
|
if (configInfo.usingNSConfig) {
|
|
@@ -260,11 +252,7 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
260
252
|
packagePath = path.join(platformData.projectRoot, this.$options.hostProjectModuleName, "src", this.$options.hostProjectPath ? "nativescript" : "main", "assets", "app", "package.json");
|
|
261
253
|
}
|
|
262
254
|
try {
|
|
263
|
-
// this will read the package.json that is already emitted by
|
|
264
|
-
// the GenerateNativeScriptEntryPointsPlugin webpack plugin
|
|
265
255
|
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.
|
|
268
256
|
if (emittedPackageData === null || emittedPackageData === void 0 ? void 0 : emittedPackageData.main) {
|
|
269
257
|
packageData.main = emittedPackageData.main;
|
|
270
258
|
}
|
|
@@ -292,7 +280,7 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
292
280
|
return;
|
|
293
281
|
}
|
|
294
282
|
await this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
295
|
-
action: "Using Runtime Version"
|
|
283
|
+
action: "Using Runtime Version",
|
|
296
284
|
additionalData: `${platform.toLowerCase()}${constants_1.AnalyticsEventLabelDelimiter}${version}`,
|
|
297
285
|
});
|
|
298
286
|
}
|
|
@@ -337,4 +325,3 @@ __decorate([
|
|
|
337
325
|
(0, decorators_1.cache)()
|
|
338
326
|
], PrepareController.prototype, "trackRuntimeVersion", null);
|
|
339
327
|
yok_1.injector.register("prepareController", PrepareController);
|
|
340
|
-
//# sourceMappingURL=prepare-controller.js.map
|
|
@@ -78,14 +78,11 @@ class RunController extends events_1.EventEmitter {
|
|
|
78
78
|
const { projectDir, deviceIdentifiers, stopOptions } = data;
|
|
79
79
|
const liveSyncProcessInfo = this.$liveSyncProcessDataService.getPersistedData(projectDir);
|
|
80
80
|
if (liveSyncProcessInfo && !liveSyncProcessInfo.isStopped) {
|
|
81
|
-
// In case we are coming from error during livesync, the current action is the one that erred (but we are still executing it),
|
|
82
|
-
// so we cannot await it as this will cause infinite loop.
|
|
83
81
|
const shouldAwaitPendingOperation = !stopOptions || stopOptions.shouldAwaitAllActions;
|
|
84
82
|
const deviceIdentifiersToRemove = deviceIdentifiers && deviceIdentifiers.length
|
|
85
83
|
? deviceIdentifiers
|
|
86
84
|
: _.map(liveSyncProcessInfo.deviceDescriptors, (d) => d.identifier);
|
|
87
85
|
const removedDeviceIdentifiers = _.remove(liveSyncProcessInfo.deviceDescriptors, (descriptor) => _.includes(deviceIdentifiersToRemove, descriptor.identifier)).map((descriptor) => descriptor.identifier);
|
|
88
|
-
// Handle the case when no more devices left for any of the persisted platforms
|
|
89
86
|
for (let i = 0; i < liveSyncProcessInfo.platforms.length; i++) {
|
|
90
87
|
const platform = liveSyncProcessInfo.platforms[i];
|
|
91
88
|
const devices = this.$devicesService.getDevicesForPlatform(platform);
|
|
@@ -93,7 +90,6 @@ class RunController extends events_1.EventEmitter {
|
|
|
93
90
|
await this.$prepareController.stopWatchers(projectDir, platform);
|
|
94
91
|
}
|
|
95
92
|
}
|
|
96
|
-
// In case deviceIdentifiers are not passed, we should stop the whole LiveSync.
|
|
97
93
|
if (!deviceIdentifiers ||
|
|
98
94
|
!deviceIdentifiers.length ||
|
|
99
95
|
!liveSyncProcessInfo.deviceDescriptors ||
|
|
@@ -124,7 +120,6 @@ class RunController extends events_1.EventEmitter {
|
|
|
124
120
|
shouldAwaitPendingOperation) {
|
|
125
121
|
await liveSyncProcessInfo.currentSyncAction;
|
|
126
122
|
}
|
|
127
|
-
// Emit RunOnDevice stopped when we've really stopped.
|
|
128
123
|
_.each(removedDeviceIdentifiers, (deviceIdentifier) => {
|
|
129
124
|
this.emitCore(constants_2.RunOnDeviceEvents.runOnDeviceStopped, {
|
|
130
125
|
projectDir,
|
|
@@ -162,8 +157,6 @@ class RunController extends events_1.EventEmitter {
|
|
|
162
157
|
shouldSkipEmitLiveSyncNotification: true,
|
|
163
158
|
shouldCheckDeveloperDiscImage: true,
|
|
164
159
|
});
|
|
165
|
-
// we do not stop the application when debugBrk is false, so we need to attach, instead of launch
|
|
166
|
-
// if we try to send the launch request, the debugger port will not be printed and the command will timeout
|
|
167
160
|
debugOptions.start = !debugOptions.debugBrk;
|
|
168
161
|
debugOptions.forceDebuggerAttachedEvent = refreshInfo.didRestart;
|
|
169
162
|
await this.$debugController.enableDebuggingCoreWithoutWaitingCurrentAction(projectData.projectDir, deviceDescriptor.identifier, debugOptions);
|
|
@@ -231,7 +224,6 @@ class RunController extends events_1.EventEmitter {
|
|
|
231
224
|
getDeviceDescriptorsForInitialSync(projectDir, deviceDescriptors) {
|
|
232
225
|
const currentRunData = this.$liveSyncProcessDataService.getPersistedData(projectDir);
|
|
233
226
|
const isAlreadyLiveSyncing = currentRunData && !currentRunData.isStopped;
|
|
234
|
-
// 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.
|
|
235
227
|
const deviceDescriptorsForInitialSync = isAlreadyLiveSyncing
|
|
236
228
|
? _.differenceBy(deviceDescriptors, currentRunData.deviceDescriptors, "identifier")
|
|
237
229
|
: deviceDescriptors;
|
|
@@ -285,8 +277,6 @@ class RunController extends events_1.EventEmitter {
|
|
|
285
277
|
const platformData = this.$platformsDataService.getPlatformData(device.deviceInfo.platform, projectData);
|
|
286
278
|
try {
|
|
287
279
|
let packageFilePath = null;
|
|
288
|
-
// Case where we have three devices attached, a change that requires build is found,
|
|
289
|
-
// we'll rebuild the app only for the first device, but we should install new package on all three devices.
|
|
290
280
|
if (rebuiltInformation[platformData.platformNameLowerCase] &&
|
|
291
281
|
(this.$mobileHelper.isAndroidPlatform(platformData.platformNameLowerCase) ||
|
|
292
282
|
rebuiltInformation[platformData.platformNameLowerCase]
|
|
@@ -310,7 +300,7 @@ class RunController extends events_1.EventEmitter {
|
|
|
310
300
|
}
|
|
311
301
|
else {
|
|
312
302
|
await this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
313
|
-
action: "LiveSync"
|
|
303
|
+
action: "LiveSync",
|
|
314
304
|
device,
|
|
315
305
|
projectDir: projectData.projectDir,
|
|
316
306
|
});
|
|
@@ -380,9 +370,6 @@ class RunController extends events_1.EventEmitter {
|
|
|
380
370
|
const watchInfo = {
|
|
381
371
|
liveSyncDeviceData: deviceDescriptor,
|
|
382
372
|
projectData,
|
|
383
|
-
// todo: remove stale files once everything is stable
|
|
384
|
-
// currently, watcher fires multiple times & may clean up unsynced files
|
|
385
|
-
// filesToRemove: data.staleFiles ?? [],
|
|
386
373
|
filesToRemove: [],
|
|
387
374
|
filesToSync,
|
|
388
375
|
hmrData: data.hmrData,
|
|
@@ -428,7 +415,6 @@ class RunController extends events_1.EventEmitter {
|
|
|
428
415
|
const fullSyncAction = async () => {
|
|
429
416
|
watchInfo.filesToSync = allAppFiles;
|
|
430
417
|
const fullLiveSyncResultInfo = await platformLiveSyncService.liveSyncWatchAction(device, watchInfo);
|
|
431
|
-
// IMPORTANT: keep the same instance as we rely on side effects
|
|
432
418
|
_.assign(liveSyncResultInfo, fullLiveSyncResultInfo);
|
|
433
419
|
};
|
|
434
420
|
await this.$hooksService.executeBeforeHooks("watchAction", {
|
|
@@ -443,7 +429,6 @@ class RunController extends events_1.EventEmitter {
|
|
|
443
429
|
await this.refreshApplication(projectData, liveSyncResultInfo, data, deviceDescriptor, fullSyncAction);
|
|
444
430
|
if (!liveSyncResultInfo.didRecover && isInHMRMode) {
|
|
445
431
|
const status = await this.$hmrStatusService.getHmrStatus(device.deviceInfo.identifier, data.hmrData.hash);
|
|
446
|
-
// the timeout is assumed OK as the app could be blocked on a breakpoint
|
|
447
432
|
if (status === constants_1.HmrConstants.HMR_ERROR_STATUS) {
|
|
448
433
|
await fullSyncAction();
|
|
449
434
|
liveSyncResultInfo.isFullSync = true;
|
|
@@ -525,4 +510,3 @@ __decorate([
|
|
|
525
510
|
(0, decorators_1.cache)()
|
|
526
511
|
], RunController.prototype, "attachDeviceLostHandler", null);
|
|
527
512
|
yok_1.injector.register("runController", RunController);
|
|
528
|
-
//# sourceMappingURL=run-controller.js.map
|
|
@@ -28,15 +28,12 @@ class UpdateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
28
28
|
this.spinner = this.$terminalSpinnerService.createSpinner();
|
|
29
29
|
const projectData = this.$projectDataService.getProjectData(updateOptions.projectDir);
|
|
30
30
|
updateOptions.version = updateOptions.version || constants_1.PackageVersion.LATEST;
|
|
31
|
-
// back up project files and folders
|
|
32
31
|
this.spinner.info("Backing up project files before update");
|
|
33
32
|
await this.backupProject();
|
|
34
33
|
this.spinner.succeed("Project files have been backed up");
|
|
35
|
-
// clean up project files
|
|
36
34
|
this.spinner.info("Cleaning up project files before update");
|
|
37
35
|
await this.cleanUpProject();
|
|
38
36
|
this.spinner.succeed("Project files have been cleaned up");
|
|
39
|
-
// update dependencies
|
|
40
37
|
this.spinner.info("Updating project dependencies");
|
|
41
38
|
await this.updateDependencies(projectData, updateOptions.version);
|
|
42
39
|
this.spinner.succeed("Project dependencies have been updated");
|
|
@@ -82,10 +79,6 @@ class UpdateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
82
79
|
if (!shouldUpdate) {
|
|
83
80
|
return;
|
|
84
81
|
}
|
|
85
|
-
// check if the coerced version is the same as desired and prefix it with a ~
|
|
86
|
-
// for example:
|
|
87
|
-
// 8.0.0 -> ~8.0.0
|
|
88
|
-
// 8.0.8-next-XXX -> 8.0.8-next-XXX
|
|
89
82
|
const updatedVersion = (() => {
|
|
90
83
|
if (desiredVersion === version) {
|
|
91
84
|
return desiredVersion;
|
|
@@ -138,11 +131,9 @@ class UpdateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
138
131
|
}
|
|
139
132
|
exports.UpdateController = UpdateController;
|
|
140
133
|
UpdateController.updatableDependencies = [
|
|
141
|
-
// dependencies
|
|
142
134
|
{
|
|
143
135
|
packageName: "@nativescript/core",
|
|
144
136
|
},
|
|
145
|
-
// devDependencies
|
|
146
137
|
{
|
|
147
138
|
packageName: "@nativescript/webpack",
|
|
148
139
|
isDev: true,
|
|
@@ -151,7 +142,6 @@ UpdateController.updatableDependencies = [
|
|
|
151
142
|
packageName: "@nativescript/types",
|
|
152
143
|
isDev: true,
|
|
153
144
|
},
|
|
154
|
-
// runtimes
|
|
155
145
|
{
|
|
156
146
|
packageName: "@nativescript/ios",
|
|
157
147
|
isDev: true,
|
|
@@ -171,4 +161,3 @@ UpdateController.pathsToBackup = [
|
|
|
171
161
|
constants.CONFIG_NS_FILE_NAME,
|
|
172
162
|
];
|
|
173
163
|
yok_1.injector.register("updateController", UpdateController);
|
|
174
|
-
//# 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
package/lib/data/run-data.js
CHANGED