nativescript 8.7.2 → 8.8.0-embed.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/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 +1 -2
- package/lib/commands/apple-login.js +0 -1
- package/lib/commands/appstore-list.js +0 -1
- package/lib/commands/appstore-upload.js +0 -4
- 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 -3
- 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/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 +2 -12
- 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/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 +2 -3
- 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/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 +0 -5
- package/lib/common/mobile/android/genymotion/virtualbox-service.js +0 -11
- package/lib/common/mobile/android/logcat-helper.js +1 -20
- 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 +3 -91
- package/lib/controllers/platform-controller.js +1 -9
- package/lib/controllers/prepare-controller.js +10 -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 +2 -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 +1 -1
- package/lib/data/run-data.js +0 -1
- package/lib/declarations.d.ts +12 -2
- package/lib/definitions/platform.d.ts +1 -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 +17 -10
- 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 +123 -141
- 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 +0 -12
- package/lib/providers/project-files-provider.js +1 -2
- 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 +12 -34
- package/lib/services/android-project-service.js +22 -86
- 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/assets-generation/assets-generation-service.js +13 -17
- 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 +3 -3
- 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 -9
- 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 +0 -1
- 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 +24 -26
- 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 +3 -7
- package/lib/services/livesync/android-livesync-service.js +2 -3
- 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 +2 -4
- package/lib/services/livesync/livesync-socket.js +0 -1
- package/lib/services/livesync/platform-livesync-service-base.js +4 -8
- 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 +3 -17
- 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 +9 -48
- package/lib/services/platform/platform-validation-service.js +0 -1
- package/lib/services/platform/prepare-native-platform-service.js +8 -8
- package/lib/services/platform-environment-requirements.js +6 -9
- 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 +9 -19
- 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 +11 -13
- package/lib/services/project-cleanup-service.js +0 -2
- package/lib/services/project-config-service.js +1 -18
- 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 +15 -48
- package/lib/services/xcconfig-service.js +0 -2
- package/lib/services/xcproj-service.js +12 -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 +2 -2
- package/vendor/gradle-plugin/build.gradle +21 -6
- package/vendor/gradle-plugin/settings.gradle +13 -3
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/CHANGELOG.md +0 -15
- package/node_modules/rimraf/CHANGELOG.md +0 -65
- package/node_modules/stringify-package/CHANGELOG.md +0 -16
|
@@ -21,12 +21,8 @@ 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));
|
|
26
24
|
class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
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) {
|
|
25
|
+
constructor($fs, $platformCommandHelper, $platformsDataService, $packageInstallationManager, $packageManager, $pacoteService, $logger, $errors, $pluginsService, $projectDataService, $projectConfigService, $options, $resources, $injector, $settingsService, $staticConfig, $terminalSpinnerService, $projectCleanupService, $projectBackupService, $childProcess) {
|
|
30
26
|
super($fs, $platformCommandHelper, $platformsDataService, $packageInstallationManager, $packageManager, $pacoteService);
|
|
31
27
|
this.$fs = $fs;
|
|
32
28
|
this.$platformCommandHelper = $platformCommandHelper;
|
|
@@ -178,16 +174,13 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
178
174
|
replaceWith: "sass",
|
|
179
175
|
minVersion: "0.0.0",
|
|
180
176
|
isDev: true,
|
|
181
|
-
// shouldRemove: true,
|
|
182
177
|
},
|
|
183
178
|
{
|
|
184
179
|
packageName: "sass",
|
|
185
180
|
minVersion: "0.0.0",
|
|
186
181
|
desiredVersion: "^1.49.9",
|
|
187
182
|
isDev: true,
|
|
188
|
-
// shouldRemove: true,
|
|
189
183
|
},
|
|
190
|
-
// runtimes
|
|
191
184
|
{
|
|
192
185
|
packageName: "tns-ios",
|
|
193
186
|
minVersion: "6.5.3",
|
|
@@ -231,10 +224,8 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
231
224
|
remainingPlatforms.push(platform);
|
|
232
225
|
continue;
|
|
233
226
|
}
|
|
234
|
-
// should only run in loose mode...
|
|
235
227
|
const cachedResult = yield this.getCachedShouldMigrate(projectDir, platform);
|
|
236
228
|
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
|
|
238
229
|
if (cachedResult !== false) {
|
|
239
230
|
remainingPlatforms.push(platform);
|
|
240
231
|
}
|
|
@@ -246,7 +237,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
246
237
|
loose,
|
|
247
238
|
});
|
|
248
239
|
this.$logger.trace(`Executed shouldMigrate for platforms: ${remainingPlatforms}. Result is: ${shouldMigrate}`);
|
|
249
|
-
// only cache results if running in loose mode
|
|
250
240
|
if (!shouldMigrate && loose) {
|
|
251
241
|
for (const remainingPlatform of remainingPlatforms) {
|
|
252
242
|
yield this.setCachedShouldMigrate(projectDir, remainingPlatform);
|
|
@@ -277,46 +267,37 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
277
267
|
platforms,
|
|
278
268
|
loose: loose,
|
|
279
269
|
});
|
|
280
|
-
// ensure in git repo and require --force if not (for safety)
|
|
281
|
-
// ensure git branch is clean
|
|
282
270
|
const canMigrate = yield this.ensureGitCleanOrForce(projectDir);
|
|
283
271
|
if (!canMigrate) {
|
|
284
272
|
this.spinner.fail("Pre-Migration verification failed");
|
|
285
273
|
return;
|
|
286
274
|
}
|
|
287
275
|
this.spinner.succeed("Pre-Migration verification complete");
|
|
288
|
-
// back up project files and folders
|
|
289
276
|
this.spinner.info("Backing up project files before migration");
|
|
290
277
|
const backup = yield this.backupProject(projectDir);
|
|
291
278
|
this.spinner.succeed("Project files have been backed up");
|
|
292
|
-
// clean up project files
|
|
293
279
|
this.spinner.info("Cleaning up project files before migration");
|
|
294
280
|
yield this.cleanUpProject(projectData);
|
|
295
281
|
this.spinner.succeed("Project files have been cleaned up");
|
|
296
|
-
// clean up artifacts
|
|
297
282
|
this.spinner.info("Cleaning up old artifacts");
|
|
298
283
|
yield this.handleAutoGeneratedFiles(backup, projectData);
|
|
299
284
|
this.spinner.succeed("Cleaned old artifacts");
|
|
300
285
|
const newConfigPath = path.resolve(projectDir, "nativescript.config.ts");
|
|
301
286
|
if (!this.$fs.exists(newConfigPath)) {
|
|
302
|
-
// migrate configs
|
|
303
287
|
this.spinner.info(`Migrating project to use ${color_1.color.green("nativescript.config.ts")}`);
|
|
304
288
|
yield this.migrateConfigs(projectDir);
|
|
305
289
|
this.spinner.succeed(`Project has been migrated to use ${color_1.color.green("nativescript.config.ts")}`);
|
|
306
290
|
}
|
|
307
|
-
// update dependencies
|
|
308
291
|
this.spinner.info("Updating project dependencies");
|
|
309
292
|
yield this.migrateDependencies(projectData, platforms, loose);
|
|
310
293
|
this.spinner.succeed("Project dependencies have been updated");
|
|
311
294
|
const isAngular = this.hasDependency({
|
|
312
295
|
packageName: "@nativescript/angular",
|
|
313
296
|
}, projectData);
|
|
314
|
-
// ensure polyfills.ts exists in angular projects
|
|
315
297
|
let polyfillsPath;
|
|
316
298
|
if (isAngular) {
|
|
317
299
|
polyfillsPath = yield this.checkOrCreatePolyfillsTS(projectData);
|
|
318
300
|
}
|
|
319
|
-
// update tsconfig
|
|
320
301
|
const tsConfigPath = path.resolve(projectDir, "tsconfig.json");
|
|
321
302
|
if (this.$fs.exists(tsConfigPath)) {
|
|
322
303
|
this.spinner.info(`Updating ${color_1.color.yellow("tsconfig.json")}`);
|
|
@@ -328,21 +309,11 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
328
309
|
this.spinner.succeed(`Updated ${color_1.color.yellow("tsconfig.json")}`);
|
|
329
310
|
}
|
|
330
311
|
yield this.migrateWebpack5(projectDir, projectData);
|
|
331
|
-
// run @nativescript/eslint over codebase
|
|
332
312
|
yield this.runESLint(projectDir);
|
|
333
313
|
this.spinner.succeed("Migration complete.");
|
|
334
314
|
this.$logger.info("");
|
|
335
315
|
this.$logger.printMarkdown("Project has been successfully migrated. The next step is to run `ns run <platform>` to ensure everything is working properly." +
|
|
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
|
|
316
|
+
"\n\nPlease note that you may need additional changes to complete the migration.");
|
|
346
317
|
});
|
|
347
318
|
}
|
|
348
319
|
_shouldMigrate({ projectDir, platforms, loose, }) {
|
|
@@ -361,7 +332,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
361
332
|
if (dependency.shouldAddIfMissing) {
|
|
362
333
|
this.$logger.trace(`${shouldMigrateCommonMessage}'${dependency.packageName}' is missing.`);
|
|
363
334
|
if (loose) {
|
|
364
|
-
// in loose mode we ignore missing dependencies
|
|
365
335
|
continue;
|
|
366
336
|
}
|
|
367
337
|
return true;
|
|
@@ -377,7 +347,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
377
347
|
}
|
|
378
348
|
if (dependency.replaceWith || dependency.shouldRemove) {
|
|
379
349
|
this.$logger.trace(`${shouldMigrateCommonMessage}'${dependency.packageName}' is deprecated.`);
|
|
380
|
-
// in loose mode we ignore deprecated dependencies
|
|
381
350
|
if (loose) {
|
|
382
351
|
continue;
|
|
383
352
|
}
|
|
@@ -429,33 +398,12 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
429
398
|
return yield this.$fs.getFileShasum(projectPackageJsonFilePath);
|
|
430
399
|
});
|
|
431
400
|
}
|
|
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
|
-
// }
|
|
452
401
|
ensureGitCleanOrForce(projectDir) {
|
|
453
402
|
return __awaiter(this, void 0, void 0, function* () {
|
|
454
403
|
const git = (0, simple_git_1.default)(projectDir);
|
|
455
404
|
const isGit = yield git.checkIsRepo();
|
|
456
405
|
const isForce = this.$options.force;
|
|
457
406
|
if (!isGit) {
|
|
458
|
-
// not a git repo and no --force
|
|
459
407
|
if (!isForce) {
|
|
460
408
|
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\`.`);
|
|
461
409
|
this.$errors.fail("Not in Git repo.");
|
|
@@ -506,7 +454,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
506
454
|
const { dependencies, devDependencies } = yield this.$pluginsService.getDependenciesFromPackageJson(projectData.projectDir);
|
|
507
455
|
const hasSchematics = [...dependencies, ...devDependencies].find((p) => p.name === "@nativescript/schematics");
|
|
508
456
|
if (!hasSchematics) {
|
|
509
|
-
// clean tsconfig.tns.json if not in a shared project
|
|
510
457
|
yield this.$projectCleanupService.clean([
|
|
511
458
|
constants.TSCCONFIG_TNS_JSON_NAME,
|
|
512
459
|
]);
|
|
@@ -556,14 +503,12 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
556
503
|
});
|
|
557
504
|
}
|
|
558
505
|
isOutdatedVersion(current, target, loose) {
|
|
559
|
-
// in loose mode, a falsy version is not considered outdated
|
|
560
506
|
if (!current && loose) {
|
|
561
507
|
return false;
|
|
562
508
|
}
|
|
563
509
|
const installed = semver.coerce(current);
|
|
564
510
|
const min = semver.coerce(target.minVersion);
|
|
565
511
|
const desired = semver.coerce(target.desiredVersion);
|
|
566
|
-
// in loose mode we check if we satisfy the min version
|
|
567
512
|
if (loose) {
|
|
568
513
|
if (!installed || !min) {
|
|
569
514
|
return false;
|
|
@@ -573,7 +518,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
573
518
|
if (!installed || !desired) {
|
|
574
519
|
return true;
|
|
575
520
|
}
|
|
576
|
-
// otherwise we compare with the desired version
|
|
577
521
|
return semver.lt(installed, desired);
|
|
578
522
|
}
|
|
579
523
|
detectAppPath(projectDir, configData) {
|
|
@@ -641,7 +585,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
641
585
|
var _a, _b, _c, _d, _e;
|
|
642
586
|
return __awaiter(this, void 0, void 0, function* () {
|
|
643
587
|
const hasDependency = this.hasDependency(dependency, projectData);
|
|
644
|
-
// show warning if needed
|
|
645
588
|
if (hasDependency && dependency.warning) {
|
|
646
589
|
this.$logger.warn(dependency.warning);
|
|
647
590
|
}
|
|
@@ -657,9 +600,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
657
600
|
return;
|
|
658
601
|
}
|
|
659
602
|
if (dependency.replaceWith || dependency.shouldRemove) {
|
|
660
|
-
// remove
|
|
661
603
|
this.$pluginsService.removeFromPackageJson(dependency.packageName, projectData.projectDir);
|
|
662
|
-
// no replacement required - we're done
|
|
663
604
|
if (!dependency.replaceWith) {
|
|
664
605
|
return;
|
|
665
606
|
}
|
|
@@ -668,7 +609,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
668
609
|
this.$errors.fail("Failed to find replacement dependency.");
|
|
669
610
|
}
|
|
670
611
|
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
|
|
672
612
|
this.$pluginsService.addToPackageJson(replacementDep.packageName, version, replacementDep.isDev, projectData.projectDir);
|
|
673
613
|
this.spinner.clear();
|
|
674
614
|
this.$logger.info(` - ${color_1.color.yellow(dependency.packageName)} has been replaced with ${color_1.color.cyan(replacementDep.packageName)} ${color_1.color.green(version)}`);
|
|
@@ -690,51 +630,35 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
690
630
|
migrateConfigs(projectDir) {
|
|
691
631
|
return __awaiter(this, void 0, void 0, function* () {
|
|
692
632
|
const projectData = this.$projectDataService.getProjectData(projectDir);
|
|
693
|
-
// package.json
|
|
694
633
|
const rootPackageJsonPath = path.resolve(projectDir, constants.PACKAGE_JSON_FILE_NAME);
|
|
695
|
-
// nested package.json
|
|
696
634
|
const embeddedPackageJsonPath = path.resolve(projectData.projectDir, projectData.getAppDirectoryRelativePath(), constants.PACKAGE_JSON_FILE_NAME);
|
|
697
|
-
// nsconfig.json
|
|
698
635
|
const legacyNsConfigPath = path.resolve(projectData.projectDir, constants.CONFIG_NS_FILE_NAME);
|
|
699
636
|
let rootPackageJsonData = {};
|
|
700
637
|
if (this.$fs.exists(rootPackageJsonPath)) {
|
|
701
638
|
rootPackageJsonData = this.$fs.readJson(rootPackageJsonPath);
|
|
702
639
|
}
|
|
703
|
-
// write the default config unless it already exists
|
|
704
640
|
const newConfigPath = this.$projectConfigService.writeDefaultConfig(projectData.projectDir);
|
|
705
|
-
// force legacy config mode
|
|
706
641
|
this.$projectConfigService.setForceUsingLegacyConfig(true);
|
|
707
|
-
// all different sources are combined into configData (nested package.json, nsconfig and root package.json[nativescript])
|
|
708
642
|
const configData = this.$projectConfigService.readConfig(projectData.projectDir);
|
|
709
|
-
// we no longer want to force legacy config mode
|
|
710
643
|
this.$projectConfigService.setForceUsingLegacyConfig(false);
|
|
711
|
-
// move main key into root package.json
|
|
712
644
|
if (configData.main) {
|
|
713
645
|
rootPackageJsonData.main = configData.main;
|
|
714
646
|
delete configData.main;
|
|
715
647
|
}
|
|
716
|
-
// detect appPath and App_Resources path
|
|
717
648
|
configData.appPath = this.detectAppPath(projectDir, configData);
|
|
718
649
|
configData.appResourcesPath = this.detectAppResourcesPath(projectDir, configData);
|
|
719
|
-
// delete nativescript key from root package.json
|
|
720
650
|
if (rootPackageJsonData.nativescript) {
|
|
721
651
|
delete rootPackageJsonData.nativescript;
|
|
722
652
|
}
|
|
723
|
-
// force the config service to use nativescript.config.ts
|
|
724
653
|
this.$projectConfigService.setForceUsingNewConfig(true);
|
|
725
|
-
|
|
726
|
-
const hasUpdatedConfigSuccessfully = yield this.$projectConfigService.setValue("", // root
|
|
727
|
-
configData);
|
|
654
|
+
const hasUpdatedConfigSuccessfully = yield this.$projectConfigService.setValue("", configData);
|
|
728
655
|
if (!hasUpdatedConfigSuccessfully) {
|
|
729
656
|
if (typeof newConfigPath === "string") {
|
|
730
|
-
// only clean the config if it was created by the migration script
|
|
731
657
|
yield this.$projectCleanupService.cleanPath(newConfigPath);
|
|
732
658
|
}
|
|
733
659
|
this.$errors.fail(`Failed to migrate project to use ${constants.CONFIG_FILE_NAME_TS}. One or more values could not be updated.`);
|
|
734
660
|
}
|
|
735
|
-
// save root package.json
|
|
736
661
|
this.$fs.writeJson(rootPackageJsonPath, rootPackageJsonData);
|
|
737
|
-
// delete migrated files
|
|
738
662
|
yield this.$projectCleanupService.cleanPath(embeddedPackageJsonPath);
|
|
739
663
|
yield this.$projectCleanupService.cleanPath(legacyNsConfigPath);
|
|
740
664
|
return true;
|
|
@@ -742,7 +666,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
742
666
|
}
|
|
743
667
|
migrateUnitTestRunner(projectData, migrationBackupDirPath) {
|
|
744
668
|
return __awaiter(this, void 0, void 0, function* () {
|
|
745
|
-
// Migrate karma.conf.js
|
|
746
669
|
const pathToKarmaConfig = path.join(migrationBackupDirPath, constants.KARMA_CONFIG_NAME);
|
|
747
670
|
if (this.$fs.exists(pathToKarmaConfig)) {
|
|
748
671
|
const oldKarmaContent = this.$fs.readText(pathToKarmaConfig);
|
|
@@ -760,7 +683,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
760
683
|
});
|
|
761
684
|
this.$fs.writeFile(path.join(projectData.projectDir, constants.KARMA_CONFIG_NAME), karmaConf);
|
|
762
685
|
}
|
|
763
|
-
// Dependencies to migrate
|
|
764
686
|
const dependencies = [
|
|
765
687
|
{
|
|
766
688
|
packageName: "karma-webpack",
|
|
@@ -804,7 +726,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
804
726
|
return __awaiter(this, void 0, void 0, function* () {
|
|
805
727
|
try {
|
|
806
728
|
const configContents = this.$fs.readJson(tsConfigPath);
|
|
807
|
-
// update
|
|
808
729
|
configContents.compilerOptions = configContents.compilerOptions || {};
|
|
809
730
|
configContents.compilerOptions.target = "es2020";
|
|
810
731
|
configContents.compilerOptions.module = "esnext";
|
|
@@ -815,7 +736,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
815
736
|
...new Set([...(configContents.compilerOptions.lib || []), "ESNext"]),
|
|
816
737
|
];
|
|
817
738
|
if (isAngular) {
|
|
818
|
-
// make sure polyfills.ts is in files
|
|
819
739
|
if (configContents.files) {
|
|
820
740
|
configContents.files = [
|
|
821
741
|
...new Set([
|
|
@@ -851,10 +771,8 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
851
771
|
const tempDir = temp.mkdirSync({
|
|
852
772
|
prefix: "migrate-angular-polyfills",
|
|
853
773
|
});
|
|
854
|
-
// get from default angular template
|
|
855
774
|
yield this.$pacoteService.extractPackage(constants.RESERVED_TEMPLATE_NAMES["angular"], tempDir);
|
|
856
775
|
this.$fs.copyFile(path.resolve(tempDir, "src/polyfills.ts"), possiblePaths[0]);
|
|
857
|
-
// clean up temp project
|
|
858
776
|
this.$fs.deleteDirectory(tempDir);
|
|
859
777
|
this.spinner.succeed(`Created fresh ${color_1.color.cyan("polyfills.ts")}`);
|
|
860
778
|
return "./" + path.relative(projectDir, possiblePaths[0]);
|
|
@@ -925,7 +843,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
925
843
|
desiredVersion: "~0.14.0",
|
|
926
844
|
shouldAddIfMissing: true,
|
|
927
845
|
},
|
|
928
|
-
// devDependencies
|
|
929
846
|
{
|
|
930
847
|
packageName: "@angular/cli",
|
|
931
848
|
minVersion,
|
|
@@ -998,12 +915,10 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
998
915
|
packageName: "@babel/preset-env",
|
|
999
916
|
shouldRemove: true,
|
|
1000
917
|
},
|
|
1001
|
-
// remove any version of vue
|
|
1002
918
|
{
|
|
1003
919
|
packageName: "vue",
|
|
1004
920
|
shouldRemove: true,
|
|
1005
921
|
},
|
|
1006
|
-
// add latest
|
|
1007
922
|
{
|
|
1008
923
|
packageName: "vue",
|
|
1009
924
|
desiredVersion: "2.6.12",
|
|
@@ -1105,7 +1020,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
1105
1020
|
return;
|
|
1106
1021
|
}
|
|
1107
1022
|
}
|
|
1108
|
-
// clean old config before generating new one
|
|
1109
1023
|
yield this.$projectCleanupService.clean(["webpack.config.js"]);
|
|
1110
1024
|
this.spinner.info(`Initializing new ${color_1.color.yellow("webpack.config.js")}`);
|
|
1111
1025
|
const { desiredVersion: webpackVersion } = this.migrationDependencies.find((dep) => dep.packageName === constants.WEBPACK_PLUGIN_NAME);
|
|
@@ -1184,7 +1098,6 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
1184
1098
|
});
|
|
1185
1099
|
}
|
|
1186
1100
|
}
|
|
1187
|
-
// static readonly typescriptPackageName: string = "typescript";
|
|
1188
1101
|
MigrateController.backupFolderName = ".migration_backup";
|
|
1189
1102
|
MigrateController.pathsToBackup = [
|
|
1190
1103
|
constants.LIB_DIR_NAME,
|
|
@@ -1198,4 +1111,3 @@ MigrateController.pathsToBackup = [
|
|
|
1198
1111
|
];
|
|
1199
1112
|
exports.MigrateController = MigrateController;
|
|
1200
1113
|
yok_1.injector.register("migrateController", MigrateController);
|
|
1201
|
-
//# sourceMappingURL=migrate-controller.js.map
|
|
@@ -94,12 +94,8 @@ class PlatformController {
|
|
|
94
94
|
desiredRuntimePackage.version = version;
|
|
95
95
|
}
|
|
96
96
|
if (!desiredRuntimePackage.version) {
|
|
97
|
-
// if no version is explicitly added, then we use the latest
|
|
98
97
|
desiredRuntimePackage.version = yield this.$packageInstallationManager.getLatestCompatibleVersion(desiredRuntimePackage.name);
|
|
99
98
|
}
|
|
100
|
-
// const currentPlatformData = this.$projectDataService.getNSValue(projectData.projectDir, platformData.frameworkPackageName);
|
|
101
|
-
// version = (currentPlatformData && currentPlatformData.version) ||
|
|
102
|
-
// await this.$packageInstallationManager.getLatestCompatibleVersion(platformData.frameworkPackageName);
|
|
103
99
|
result = `${desiredRuntimePackage.name}@${desiredRuntimePackage.version}`;
|
|
104
100
|
}
|
|
105
101
|
return result;
|
|
@@ -112,14 +108,11 @@ class PlatformController {
|
|
|
112
108
|
const prepareInfo = this.$projectChangesService.getPrepareInfo(platformData);
|
|
113
109
|
const requiresNativePlatformAdd = prepareInfo &&
|
|
114
110
|
prepareInfo.nativePlatformStatus ===
|
|
115
|
-
"1"
|
|
111
|
+
"1";
|
|
116
112
|
const shouldAddPlatform = !hasPlatformDirectory ||
|
|
117
113
|
(shouldAddNativePlatform && requiresNativePlatformAdd);
|
|
118
114
|
if (hasPlatformDirectory && !shouldAddPlatform) {
|
|
119
115
|
const platformDirectoryItemCount = this.$fs.readDirectory(path.join(projectData.platformsDir, platformName)).length;
|
|
120
|
-
// 2 is a magic number to approximate a valid platform folder
|
|
121
|
-
// any valid platform should contain at least 2 files/folders
|
|
122
|
-
// we choose 2 to avoid false-positives due to system files like .DS_Store etc.
|
|
123
116
|
if (platformDirectoryItemCount <= 2) {
|
|
124
117
|
this.$logger.warn(`The platforms/${platformName} folder appears to be invalid. If the build fails, run 'ns clean' and rebuild the app.`, { wrapMessageWithBorders: true });
|
|
125
118
|
}
|
|
@@ -129,4 +122,3 @@ class PlatformController {
|
|
|
129
122
|
}
|
|
130
123
|
exports.PlatformController = PlatformController;
|
|
131
124
|
yok_1.injector.register("platformController", PlatformController);
|
|
132
|
-
//# sourceMappingURL=platform-controller.js.map
|
|
@@ -25,12 +25,13 @@ const helpers_1 = require("../common/helpers");
|
|
|
25
25
|
const yok_1 = require("../common/yok");
|
|
26
26
|
const constants_1 = require("../constants");
|
|
27
27
|
class PrepareController extends events_1.EventEmitter {
|
|
28
|
-
constructor($platformController, $hooksService, $fs, $logger, $mobileHelper, $nodeModulesDependenciesBuilder, $platformsDataService, $pluginsService, $prepareNativePlatformService, $projectChangesService, $projectDataService, $webpackCompilerService, $watchIgnoreListService, $analyticsService, $markingModeService, $projectConfigService, $projectService) {
|
|
28
|
+
constructor($platformController, $hooksService, $fs, $logger, $options, $mobileHelper, $nodeModulesDependenciesBuilder, $platformsDataService, $pluginsService, $prepareNativePlatformService, $projectChangesService, $projectDataService, $webpackCompilerService, $watchIgnoreListService, $analyticsService, $markingModeService, $projectConfigService, $projectService) {
|
|
29
29
|
super();
|
|
30
30
|
this.$platformController = $platformController;
|
|
31
31
|
this.$hooksService = $hooksService;
|
|
32
32
|
this.$fs = $fs;
|
|
33
33
|
this.$logger = $logger;
|
|
34
|
+
this.$options = $options;
|
|
34
35
|
this.$mobileHelper = $mobileHelper;
|
|
35
36
|
this.$nodeModulesDependenciesBuilder = $nodeModulesDependenciesBuilder;
|
|
36
37
|
this.$platformsDataService = $platformsDataService;
|
|
@@ -86,13 +87,11 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
86
87
|
prepareCore(prepareData, projectData) {
|
|
87
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
88
89
|
yield this.$projectService.ensureAppResourcesExist(projectData.projectDir);
|
|
89
|
-
|
|
90
|
+
if (!this.$options.nativeHost) {
|
|
91
|
+
yield this.$platformController.addPlatformIfNeeded(prepareData, projectData);
|
|
92
|
+
}
|
|
90
93
|
yield this.trackRuntimeVersion(prepareData.platform, projectData);
|
|
91
94
|
this.$logger.info("Preparing project...");
|
|
92
|
-
// we need to mark the ~/package.json (used by core modules)
|
|
93
|
-
// as external for us to be able to write the config to it
|
|
94
|
-
// in writeRuntimePackageJson() below, because otherwise
|
|
95
|
-
// webpack will inline it into the bundle/vendor chunks
|
|
96
95
|
prepareData.env = prepareData.env || {};
|
|
97
96
|
prepareData.env.externals = prepareData.env.externals || [];
|
|
98
97
|
prepareData.env.externals.push("~/package.json");
|
|
@@ -135,8 +134,8 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
135
134
|
},
|
|
136
135
|
};
|
|
137
136
|
}
|
|
138
|
-
yield this.startJSWatcherWithPrepare(platformData, projectData, prepareData);
|
|
139
|
-
const hasNativeChanges = yield this.startNativeWatcherWithPrepare(platformData, projectData, prepareData);
|
|
137
|
+
yield this.startJSWatcherWithPrepare(platformData, projectData, prepareData);
|
|
138
|
+
const hasNativeChanges = yield this.startNativeWatcherWithPrepare(platformData, projectData, prepareData);
|
|
140
139
|
const result = {
|
|
141
140
|
platform: platformData.platformNameLowerCase,
|
|
142
141
|
hasNativeChanges,
|
|
@@ -145,7 +144,6 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
145
144
|
if (hasPersistedDataWithNativeChanges) {
|
|
146
145
|
result.hasNativeChanges = true;
|
|
147
146
|
}
|
|
148
|
-
// TODO: Do not persist this in `this` context. Also it should be per platform.
|
|
149
147
|
this.isInitialPrepareReady = true;
|
|
150
148
|
if (this.persistedData && this.persistedData.length) {
|
|
151
149
|
this.emitPrepareEvent({
|
|
@@ -204,7 +202,7 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
204
202
|
pollInterval: 100,
|
|
205
203
|
stabilityThreshold: 500,
|
|
206
204
|
},
|
|
207
|
-
ignored: ["**/.*", ".*"],
|
|
205
|
+
ignored: ["**/.*", ".*"],
|
|
208
206
|
};
|
|
209
207
|
const watcher = choki
|
|
210
208
|
.watch(patterns, watcherOptions)
|
|
@@ -277,14 +275,10 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
277
275
|
packagePath = path.join(platformData.projectRoot, projectData.projectName, "app", "package.json");
|
|
278
276
|
}
|
|
279
277
|
else {
|
|
280
|
-
packagePath = path.join(platformData.projectRoot,
|
|
278
|
+
packagePath = path.join(platformData.projectRoot, this.$options.nativeHostModule, "src", this.$options.nativeHost ? "nativescript" : "main", "assets", "app", "package.json");
|
|
281
279
|
}
|
|
282
280
|
try {
|
|
283
|
-
// this will read the package.json that is already emitted by
|
|
284
|
-
// the GenerateNativeScriptEntryPointsPlugin webpack plugin
|
|
285
281
|
const emittedPackageData = this.$fs.readJson(packagePath);
|
|
286
|
-
// since ns7 we only care about the main key from the emitted
|
|
287
|
-
// package.json, the rest is coming from the new config.
|
|
288
282
|
if (emittedPackageData === null || emittedPackageData === void 0 ? void 0 : emittedPackageData.main) {
|
|
289
283
|
packageData.main = emittedPackageData.main;
|
|
290
284
|
}
|
|
@@ -311,7 +305,7 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
311
305
|
return;
|
|
312
306
|
}
|
|
313
307
|
yield this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
314
|
-
action: "Using Runtime Version"
|
|
308
|
+
action: "Using Runtime Version",
|
|
315
309
|
additionalData: `${platform.toLowerCase()}${constants_1.AnalyticsEventLabelDelimiter}${version}`,
|
|
316
310
|
});
|
|
317
311
|
});
|
|
@@ -359,4 +353,3 @@ __decorate([
|
|
|
359
353
|
], PrepareController.prototype, "trackRuntimeVersion", null);
|
|
360
354
|
exports.PrepareController = PrepareController;
|
|
361
355
|
yok_1.injector.register("prepareController", PrepareController);
|
|
362
|
-
//# sourceMappingURL=prepare-controller.js.map
|
|
@@ -90,14 +90,11 @@ 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.
|
|
95
93
|
const shouldAwaitPendingOperation = !stopOptions || stopOptions.shouldAwaitAllActions;
|
|
96
94
|
const deviceIdentifiersToRemove = deviceIdentifiers && deviceIdentifiers.length
|
|
97
95
|
? deviceIdentifiers
|
|
98
96
|
: _.map(liveSyncProcessInfo.deviceDescriptors, (d) => d.identifier);
|
|
99
97
|
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
|
|
101
98
|
for (let i = 0; i < liveSyncProcessInfo.platforms.length; i++) {
|
|
102
99
|
const platform = liveSyncProcessInfo.platforms[i];
|
|
103
100
|
const devices = this.$devicesService.getDevicesForPlatform(platform);
|
|
@@ -105,7 +102,6 @@ class RunController extends events_1.EventEmitter {
|
|
|
105
102
|
yield this.$prepareController.stopWatchers(projectDir, platform);
|
|
106
103
|
}
|
|
107
104
|
}
|
|
108
|
-
// In case deviceIdentifiers are not passed, we should stop the whole LiveSync.
|
|
109
105
|
if (!deviceIdentifiers ||
|
|
110
106
|
!deviceIdentifiers.length ||
|
|
111
107
|
!liveSyncProcessInfo.deviceDescriptors ||
|
|
@@ -136,7 +132,6 @@ class RunController extends events_1.EventEmitter {
|
|
|
136
132
|
shouldAwaitPendingOperation) {
|
|
137
133
|
yield liveSyncProcessInfo.currentSyncAction;
|
|
138
134
|
}
|
|
139
|
-
// Emit RunOnDevice stopped when we've really stopped.
|
|
140
135
|
_.each(removedDeviceIdentifiers, (deviceIdentifier) => {
|
|
141
136
|
this.emitCore(constants_2.RunOnDeviceEvents.runOnDeviceStopped, {
|
|
142
137
|
projectDir,
|
|
@@ -178,8 +173,6 @@ class RunController extends events_1.EventEmitter {
|
|
|
178
173
|
shouldSkipEmitLiveSyncNotification: true,
|
|
179
174
|
shouldCheckDeveloperDiscImage: true,
|
|
180
175
|
});
|
|
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
|
|
183
176
|
debugOptions.start = !debugOptions.debugBrk;
|
|
184
177
|
debugOptions.forceDebuggerAttachedEvent = refreshInfo.didRestart;
|
|
185
178
|
yield this.$debugController.enableDebuggingCoreWithoutWaitingCurrentAction(projectData.projectDir, deviceDescriptor.identifier, debugOptions);
|
|
@@ -250,7 +243,6 @@ class RunController extends events_1.EventEmitter {
|
|
|
250
243
|
getDeviceDescriptorsForInitialSync(projectDir, deviceDescriptors) {
|
|
251
244
|
const currentRunData = this.$liveSyncProcessDataService.getPersistedData(projectDir);
|
|
252
245
|
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.
|
|
254
246
|
const deviceDescriptorsForInitialSync = isAlreadyLiveSyncing
|
|
255
247
|
? _.differenceBy(deviceDescriptors, currentRunData.deviceDescriptors, "identifier")
|
|
256
248
|
: deviceDescriptors;
|
|
@@ -299,8 +291,6 @@ class RunController extends events_1.EventEmitter {
|
|
|
299
291
|
const platformData = this.$platformsDataService.getPlatformData(device.deviceInfo.platform, projectData);
|
|
300
292
|
try {
|
|
301
293
|
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.
|
|
304
294
|
if (rebuiltInformation[platformData.platformNameLowerCase] &&
|
|
305
295
|
(this.$mobileHelper.isAndroidPlatform(platformData.platformNameLowerCase) ||
|
|
306
296
|
rebuiltInformation[platformData.platformNameLowerCase]
|
|
@@ -324,7 +314,7 @@ class RunController extends events_1.EventEmitter {
|
|
|
324
314
|
}
|
|
325
315
|
else {
|
|
326
316
|
yield this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
327
|
-
action: "LiveSync"
|
|
317
|
+
action: "LiveSync",
|
|
328
318
|
device,
|
|
329
319
|
projectDir: projectData.projectDir,
|
|
330
320
|
});
|
|
@@ -391,9 +381,6 @@ class RunController extends events_1.EventEmitter {
|
|
|
391
381
|
const watchInfo = {
|
|
392
382
|
liveSyncDeviceData: deviceDescriptor,
|
|
393
383
|
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 ?? [],
|
|
397
384
|
filesToRemove: [],
|
|
398
385
|
filesToSync,
|
|
399
386
|
hmrData: data.hmrData,
|
|
@@ -439,7 +426,6 @@ class RunController extends events_1.EventEmitter {
|
|
|
439
426
|
const fullSyncAction = () => __awaiter(this, void 0, void 0, function* () {
|
|
440
427
|
watchInfo.filesToSync = allAppFiles;
|
|
441
428
|
const fullLiveSyncResultInfo = yield platformLiveSyncService.liveSyncWatchAction(device, watchInfo);
|
|
442
|
-
// IMPORTANT: keep the same instance as we rely on side effects
|
|
443
429
|
_.assign(liveSyncResultInfo, fullLiveSyncResultInfo);
|
|
444
430
|
});
|
|
445
431
|
yield this.$hooksService.executeBeforeHooks("watchAction", {
|
|
@@ -454,7 +440,6 @@ class RunController extends events_1.EventEmitter {
|
|
|
454
440
|
yield this.refreshApplication(projectData, liveSyncResultInfo, data, deviceDescriptor, fullSyncAction);
|
|
455
441
|
if (!liveSyncResultInfo.didRecover && isInHMRMode) {
|
|
456
442
|
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
|
|
458
443
|
if (status === constants_1.HmrConstants.HMR_ERROR_STATUS) {
|
|
459
444
|
yield fullSyncAction();
|
|
460
445
|
liveSyncResultInfo.isFullSync = true;
|
|
@@ -539,4 +524,3 @@ __decorate([
|
|
|
539
524
|
], RunController.prototype, "attachDeviceLostHandler", null);
|
|
540
525
|
exports.RunController = RunController;
|
|
541
526
|
yok_1.injector.register("runController", RunController);
|
|
542
|
-
//# sourceMappingURL=run-controller.js.map
|
|
@@ -38,15 +38,12 @@ 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
|
|
42
41
|
this.spinner.info("Backing up project files before update");
|
|
43
42
|
yield this.backupProject();
|
|
44
43
|
this.spinner.succeed("Project files have been backed up");
|
|
45
|
-
// clean up project files
|
|
46
44
|
this.spinner.info("Cleaning up project files before update");
|
|
47
45
|
yield this.cleanUpProject();
|
|
48
46
|
this.spinner.succeed("Project files have been cleaned up");
|
|
49
|
-
// update dependencies
|
|
50
47
|
this.spinner.info("Updating project dependencies");
|
|
51
48
|
yield this.updateDependencies(projectData, updateOptions.version);
|
|
52
49
|
this.spinner.succeed("Project dependencies have been updated");
|
|
@@ -98,10 +95,6 @@ class UpdateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
98
95
|
if (!shouldUpdate) {
|
|
99
96
|
return;
|
|
100
97
|
}
|
|
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
|
|
105
98
|
const updatedVersion = (() => {
|
|
106
99
|
if (desiredVersion === version) {
|
|
107
100
|
return desiredVersion;
|
|
@@ -162,11 +155,9 @@ class UpdateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
162
155
|
}
|
|
163
156
|
}
|
|
164
157
|
UpdateController.updatableDependencies = [
|
|
165
|
-
// dependencies
|
|
166
158
|
{
|
|
167
159
|
packageName: "@nativescript/core",
|
|
168
160
|
},
|
|
169
|
-
// devDependencies
|
|
170
161
|
{
|
|
171
162
|
packageName: "@nativescript/webpack",
|
|
172
163
|
isDev: true,
|
|
@@ -175,7 +166,6 @@ UpdateController.updatableDependencies = [
|
|
|
175
166
|
packageName: "@nativescript/types",
|
|
176
167
|
isDev: true,
|
|
177
168
|
},
|
|
178
|
-
// runtimes
|
|
179
169
|
{
|
|
180
170
|
packageName: "@nativescript/ios",
|
|
181
171
|
isDev: true,
|
|
@@ -196,4 +186,3 @@ UpdateController.pathsToBackup = [
|
|
|
196
186
|
];
|
|
197
187
|
exports.UpdateController = UpdateController;
|
|
198
188
|
yok_1.injector.register("updateController", UpdateController);
|
|
199
|
-
//# sourceMappingURL=update-controller.js.map
|
package/lib/data/build-data.js
CHANGED
|
@@ -24,6 +24,7 @@ class IOSBuildData extends BuildData {
|
|
|
24
24
|
this.mobileProvisionData = data.mobileProvisionData;
|
|
25
25
|
this.buildForAppStore = data.buildForAppStore;
|
|
26
26
|
this.iCloudContainerEnvironment = data.iCloudContainerEnvironment;
|
|
27
|
+
this.nativeHost = data.nativeHost;
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
exports.IOSBuildData = IOSBuildData;
|
|
@@ -37,7 +38,7 @@ class AndroidBuildData extends BuildData {
|
|
|
37
38
|
this.androidBundle = data.androidBundle || data.aab;
|
|
38
39
|
this.gradlePath = data.gradlePath;
|
|
39
40
|
this.gradleArgs = data.gradleArgs;
|
|
41
|
+
this.nativeHost = data.nativeHost;
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
exports.AndroidBuildData = AndroidBuildData;
|
|
43
|
-
//# sourceMappingURL=build-data.js.map
|