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