@akylas/nativescript-cli 8.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +385 -0
- package/bin/nativescript +3 -0
- package/bin/nativescript.js +3 -0
- package/bin/ns +3 -0
- package/bin/nsc +3 -0
- package/bin/nsc.js +3 -0
- package/bin/tns +12 -0
- package/bin/tns.cmd +1 -0
- package/config/config.json +8 -0
- package/config/test-dependencies.json +58 -0
- package/config/test-deps-versions-generated.json +1 -0
- package/docs/build-jekyll-md.sh +7 -0
- package/docs/helpers/favicon.ico +0 -0
- package/docs/helpers/logo.png +0 -0
- package/docs/man_pages/cloud/cloud-setup.md +29 -0
- package/docs/man_pages/device/device-android.md +32 -0
- package/docs/man_pages/device/device-ios.md +40 -0
- package/docs/man_pages/device/device-list-applications.md +37 -0
- package/docs/man_pages/device/device-log.md +37 -0
- package/docs/man_pages/device/device-run.md +55 -0
- package/docs/man_pages/device/device.md +46 -0
- package/docs/man_pages/env-configuration/setup.md +22 -0
- package/docs/man_pages/general/autocomplete-disable.md +37 -0
- package/docs/man_pages/general/autocomplete-enable.md +37 -0
- package/docs/man_pages/general/autocomplete-status.md +35 -0
- package/docs/man_pages/general/autocomplete.md +46 -0
- package/docs/man_pages/general/clean.md +22 -0
- package/docs/man_pages/general/doctor.md +33 -0
- package/docs/man_pages/general/error-reporting.md +41 -0
- package/docs/man_pages/general/extension-install.md +45 -0
- package/docs/man_pages/general/extension-uninstall.md +41 -0
- package/docs/man_pages/general/extension.md +35 -0
- package/docs/man_pages/general/help.md +39 -0
- package/docs/man_pages/general/info.md +33 -0
- package/docs/man_pages/general/migrate.md +79 -0
- package/docs/man_pages/general/package-manager-get.md +26 -0
- package/docs/man_pages/general/package-manager-set.md +29 -0
- package/docs/man_pages/general/package-manager.md +25 -0
- package/docs/man_pages/general/proxy-clear.md +26 -0
- package/docs/man_pages/general/proxy-set.md +45 -0
- package/docs/man_pages/general/proxy.md +31 -0
- package/docs/man_pages/general/update.md +40 -0
- package/docs/man_pages/general/usage-reporting.md +41 -0
- package/docs/man_pages/index.html +3 -0
- package/docs/man_pages/lib-management/plugin-add.md +42 -0
- package/docs/man_pages/lib-management/plugin-build.md +32 -0
- package/docs/man_pages/lib-management/plugin-create.md +48 -0
- package/docs/man_pages/lib-management/plugin-install.md +42 -0
- package/docs/man_pages/lib-management/plugin-remove.md +31 -0
- package/docs/man_pages/lib-management/plugin-update.md +41 -0
- package/docs/man_pages/lib-management/plugin.md +39 -0
- package/docs/man_pages/project/configuration/generate.md +36 -0
- package/docs/man_pages/project/configuration/install.md +43 -0
- package/docs/man_pages/project/configuration/open-android.md +27 -0
- package/docs/man_pages/project/configuration/open-ios.md +31 -0
- package/docs/man_pages/project/configuration/open.md +36 -0
- package/docs/man_pages/project/configuration/platform-add.md +46 -0
- package/docs/man_pages/project/configuration/platform-clean.md +41 -0
- package/docs/man_pages/project/configuration/platform-remove.md +41 -0
- package/docs/man_pages/project/configuration/platform-update.md +45 -0
- package/docs/man_pages/project/configuration/platform.md +29 -0
- package/docs/man_pages/project/configuration/prepare.md +49 -0
- package/docs/man_pages/project/configuration/resources/resources-generate-icons.md +39 -0
- package/docs/man_pages/project/configuration/resources/resources-generate-splashes.md +39 -0
- package/docs/man_pages/project/configuration/resources/resources-update.md +35 -0
- package/docs/man_pages/project/configuration/resources/resources.md +14 -0
- package/docs/man_pages/project/creation/create.md +64 -0
- package/docs/man_pages/project/testing/build-android.md +62 -0
- package/docs/man_pages/project/testing/build-ios.md +65 -0
- package/docs/man_pages/project/testing/build.md +66 -0
- package/docs/man_pages/project/testing/debug-android.md +64 -0
- package/docs/man_pages/project/testing/debug-ios.md +65 -0
- package/docs/man_pages/project/testing/debug.md +67 -0
- package/docs/man_pages/project/testing/deploy.md +72 -0
- package/docs/man_pages/project/testing/dev-test-android.md +31 -0
- package/docs/man_pages/project/testing/dev-test-ios.md +36 -0
- package/docs/man_pages/project/testing/preview.md +35 -0
- package/docs/man_pages/project/testing/run-android.md +79 -0
- package/docs/man_pages/project/testing/run-ios.md +83 -0
- package/docs/man_pages/project/testing/run.md +92 -0
- package/docs/man_pages/project/testing/test-android.md +46 -0
- package/docs/man_pages/project/testing/test-init.md +34 -0
- package/docs/man_pages/project/testing/test-ios.md +48 -0
- package/docs/man_pages/project/testing/test.md +48 -0
- package/docs/man_pages/project/testing/typings.md +52 -0
- package/docs/man_pages/publishing/apple-login.md +35 -0
- package/docs/man_pages/publishing/appstore-upload.md +52 -0
- package/docs/man_pages/publishing/appstore.md +42 -0
- package/docs/man_pages/publishing/publish-ios.md +55 -0
- package/docs/man_pages/publishing/publish.md +38 -0
- package/docs/man_pages/start.md +81 -0
- package/lib/.d.ts +494 -0
- package/lib/android-tools-info.js +135 -0
- package/lib/base-package-manager.js +129 -0
- package/lib/bash-scripts/terminateProcess.sh +12 -0
- package/lib/bootstrap.js +203 -0
- package/lib/bun-package-manager.js +135 -0
- package/lib/color.js +10 -0
- package/lib/commands/add-platform.js +49 -0
- package/lib/commands/apple-login.js +52 -0
- package/lib/commands/appstore-list.js +75 -0
- package/lib/commands/appstore-upload.js +106 -0
- package/lib/commands/build.js +161 -0
- package/lib/commands/clean.js +253 -0
- package/lib/commands/command-base.js +46 -0
- package/lib/commands/config.js +135 -0
- package/lib/commands/create-project.js +431 -0
- package/lib/commands/debug.js +191 -0
- package/lib/commands/deploy.js +78 -0
- package/lib/commands/extensibility/install-extension.js +33 -0
- package/lib/commands/extensibility/list-extensions.js +40 -0
- package/lib/commands/extensibility/uninstall-extension.js +32 -0
- package/lib/commands/fonts.js +64 -0
- package/lib/commands/generate-assets.js +71 -0
- package/lib/commands/generate-help.js +26 -0
- package/lib/commands/generate.js +78 -0
- package/lib/commands/info.js +26 -0
- package/lib/commands/install.js +80 -0
- package/lib/commands/list-platforms.js +45 -0
- package/lib/commands/migrate.js +44 -0
- package/lib/commands/platform-clean.js +54 -0
- package/lib/commands/plugin/add-plugin.js +43 -0
- package/lib/commands/plugin/build-plugin.js +70 -0
- package/lib/commands/plugin/create-plugin.js +175 -0
- package/lib/commands/plugin/list-plugins.js +54 -0
- package/lib/commands/plugin/remove-plugin.js +52 -0
- package/lib/commands/plugin/update-plugin.js +52 -0
- package/lib/commands/post-install.js +57 -0
- package/lib/commands/prepare.js +63 -0
- package/lib/commands/preview.js +93 -0
- package/lib/commands/remove-platform.js +40 -0
- package/lib/commands/resources/resources-update.js +45 -0
- package/lib/commands/run.js +177 -0
- package/lib/commands/setup.js +15 -0
- package/lib/commands/start.js +33 -0
- package/lib/commands/test-init.js +167 -0
- package/lib/commands/test.js +146 -0
- package/lib/commands/typings.js +180 -0
- package/lib/commands/update-platform.js +57 -0
- package/lib/commands/update.js +70 -0
- package/lib/common/LICENSE +201 -0
- package/lib/common/README.md +1084 -0
- package/lib/common/bin/common-lib.js +5 -0
- package/lib/common/bootstrap.js +97 -0
- package/lib/common/child-process.js +217 -0
- package/lib/common/codeGeneration/code-entity.js +47 -0
- package/lib/common/codeGeneration/code-generation.d.ts +47 -0
- package/lib/common/codeGeneration/code-printer.js +48 -0
- package/lib/common/command-params.js +45 -0
- package/lib/common/commands/analytics.js +81 -0
- package/lib/common/commands/autocompletion.js +110 -0
- package/lib/common/commands/device/device-log-stream.js +44 -0
- package/lib/common/commands/device/get-file.js +54 -0
- package/lib/common/commands/device/list-applications.js +42 -0
- package/lib/common/commands/device/list-devices.js +150 -0
- package/lib/common/commands/device/list-files.js +55 -0
- package/lib/common/commands/device/put-file.js +55 -0
- package/lib/common/commands/device/run-application.js +46 -0
- package/lib/common/commands/device/stop-application.js +42 -0
- package/lib/common/commands/device/uninstall-application.js +33 -0
- package/lib/common/commands/doctor.js +54 -0
- package/lib/common/commands/generate-messages.js +45 -0
- package/lib/common/commands/help.js +51 -0
- package/lib/common/commands/package-manager-get.js +32 -0
- package/lib/common/commands/package-manager-set.js +37 -0
- package/lib/common/commands/post-install.js +27 -0
- package/lib/common/commands/preuninstall.js +61 -0
- package/lib/common/commands/proxy/proxy-base.js +34 -0
- package/lib/common/commands/proxy/proxy-clear.js +32 -0
- package/lib/common/commands/proxy/proxy-get.js +31 -0
- package/lib/common/commands/proxy/proxy-set.js +150 -0
- package/lib/common/common-lib.js +5 -0
- package/lib/common/constants.js +122 -0
- package/lib/common/declarations.d.ts +1713 -0
- package/lib/common/decorators.js +201 -0
- package/lib/common/definitions/cli-global.d.ts +22 -0
- package/lib/common/definitions/commands-service.d.ts +27 -0
- package/lib/common/definitions/commands.d.ts +51 -0
- package/lib/common/definitions/config.d.ts +33 -0
- package/lib/common/definitions/extensibility.d.ts +147 -0
- package/lib/common/definitions/google-analytics.d.ts +109 -0
- package/lib/common/definitions/json-file-settings-service.d.ts +24 -0
- package/lib/common/definitions/key-commands.d.ts +62 -0
- package/lib/common/definitions/logger.d.ts +41 -0
- package/lib/common/definitions/mobile.d.ts +1499 -0
- package/lib/common/definitions/validator.d.ts +8 -0
- package/lib/common/definitions/yok.d.ts +56 -0
- package/lib/common/dispatchers.js +151 -0
- package/lib/common/docs/helpers/basic-extensions-page.html +15 -0
- package/lib/common/docs/helpers/basic-page.html +14 -0
- package/lib/common/docs/helpers/styles.css +365 -0
- package/lib/common/doctor.d.ts +6 -0
- package/lib/common/errors.js +206 -0
- package/lib/common/file-system.js +441 -0
- package/lib/common/header.js +30 -0
- package/lib/common/helpers.js +658 -0
- package/lib/common/host-info.js +133 -0
- package/lib/common/http-client.js +173 -0
- package/lib/common/logger/appenders/cli-appender.js +24 -0
- package/lib/common/logger/appenders/emit-appender.js +30 -0
- package/lib/common/logger/layouts/cli-layout.js +33 -0
- package/lib/common/logger/logger.js +199 -0
- package/lib/common/messages/messages.interface.d.ts +10 -0
- package/lib/common/messages/messages.js +15 -0
- package/lib/common/mobile/android/android-application-manager.js +228 -0
- package/lib/common/mobile/android/android-debug-bridge-result-handler.js +332 -0
- package/lib/common/mobile/android/android-debug-bridge.js +167 -0
- package/lib/common/mobile/android/android-device-file-system.js +176 -0
- package/lib/common/mobile/android/android-device-hash-service.js +133 -0
- package/lib/common/mobile/android/android-device.js +164 -0
- package/lib/common/mobile/android/android-emulator-services.js +205 -0
- package/lib/common/mobile/android/android-ini-file-parser.js +77 -0
- package/lib/common/mobile/android/android-log-filter.js +42 -0
- package/lib/common/mobile/android/android-virtual-device-service.js +360 -0
- package/lib/common/mobile/android/device-android-debug-bridge.js +48 -0
- package/lib/common/mobile/android/genymotion/genymotion-service.js +211 -0
- package/lib/common/mobile/android/genymotion/virtualbox-service.js +121 -0
- package/lib/common/mobile/android/logcat-helper.js +165 -0
- package/lib/common/mobile/application-manager-base.js +136 -0
- package/lib/common/mobile/device-emitter.js +61 -0
- package/lib/common/mobile/device-log-emitter.js +40 -0
- package/lib/common/mobile/device-log-provider-base.js +76 -0
- package/lib/common/mobile/device-log-provider.js +126 -0
- package/lib/common/mobile/device-platforms-constants.js +22 -0
- package/lib/common/mobile/emulator-helper.js +84 -0
- package/lib/common/mobile/ios/device/ios-application-manager.js +159 -0
- package/lib/common/mobile/ios/device/ios-device-file-system.js +133 -0
- package/lib/common/mobile/ios/device/ios-device-operations.js +234 -0
- package/lib/common/mobile/ios/device/ios-device.js +153 -0
- package/lib/common/mobile/ios/ios-device-base.js +108 -0
- package/lib/common/mobile/ios/ios-device-product-name-mapper.js +65 -0
- package/lib/common/mobile/ios/ios-log-filter.js +24 -0
- package/lib/common/mobile/ios/simulator/ios-emulator-services.js +139 -0
- package/lib/common/mobile/ios/simulator/ios-sim-resolver.js +23 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-application-manager.js +147 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-device.js +106 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-file-system.js +81 -0
- package/lib/common/mobile/ios/simulator/ios-simulator-log-provider.js +69 -0
- package/lib/common/mobile/local-to-device-path-data-factory.js +37 -0
- package/lib/common/mobile/log-filter.js +51 -0
- package/lib/common/mobile/logging-levels.js +12 -0
- package/lib/common/mobile/mobile-core/android-device-discovery.js +91 -0
- package/lib/common/mobile/mobile-core/android-emulator-discovery.js +65 -0
- package/lib/common/mobile/mobile-core/android-process-service.js +259 -0
- package/lib/common/mobile/mobile-core/device-discovery.js +64 -0
- package/lib/common/mobile/mobile-core/devices-service.js +854 -0
- package/lib/common/mobile/mobile-core/ios-device-discovery.js +63 -0
- package/lib/common/mobile/mobile-core/ios-simulator-discovery.js +109 -0
- package/lib/common/mobile/mobile-helper.js +102 -0
- package/lib/common/mobile/wp8/wp8-emulator-services.js +82 -0
- package/lib/common/old.npmignore +12 -0
- package/lib/common/opener.js +16 -0
- package/lib/common/os-info.js +21 -0
- package/lib/common/plist-parser.js +24 -0
- package/lib/common/project-helper.js +70 -0
- package/lib/common/prompter.js +191 -0
- package/lib/common/queue.js +37 -0
- package/lib/common/resource-loader.js +25 -0
- package/lib/common/resources/messages/errorMessages.json +7 -0
- package/lib/common/resources/platform-tools/android/darwin/NOTICE.txt +3407 -0
- package/lib/common/resources/platform-tools/android/darwin/adb +0 -0
- package/lib/common/resources/platform-tools/android/linux/NOTICE.txt +4451 -0
- package/lib/common/resources/platform-tools/android/linux/adb +0 -0
- package/lib/common/resources/platform-tools/android/win32/AdbWinApi.dll +0 -0
- package/lib/common/resources/platform-tools/android/win32/AdbWinUsbApi.dll +0 -0
- package/lib/common/resources/platform-tools/android/win32/NOTICE.txt +4451 -0
- package/lib/common/resources/platform-tools/android/win32/adb.exe +0 -0
- package/lib/common/resources/platform-tools/android/win32/fastboot.exe +0 -0
- package/lib/common/resources/platform-tools/unzip/win32/unzip.exe +0 -0
- package/lib/common/services/analytics/google-analytics-custom-dimensions.d.ts +16 -0
- package/lib/common/services/auto-completion-service.js +265 -0
- package/lib/common/services/cancellation.js +67 -0
- package/lib/common/services/commands-service.js +268 -0
- package/lib/common/services/help-service.js +252 -0
- package/lib/common/services/hooks-service.js +318 -0
- package/lib/common/services/ios-notification-service.js +49 -0
- package/lib/common/services/json-file-settings-service.js +133 -0
- package/lib/common/services/lock-service.js +129 -0
- package/lib/common/services/message-contract-generator.js +83 -0
- package/lib/common/services/messages-service.js +77 -0
- package/lib/common/services/micro-templating-service.js +49 -0
- package/lib/common/services/net-service.js +137 -0
- package/lib/common/services/project-files-manager.js +100 -0
- package/lib/common/services/project-files-provider-base.js +54 -0
- package/lib/common/services/proxy-service.js +64 -0
- package/lib/common/services/qr.js +39 -0
- package/lib/common/services/settings-service.js +42 -0
- package/lib/common/services/xcode-select-service.js +62 -0
- package/lib/common/utils.js +31 -0
- package/lib/common/validators/project-name-validator.js +88 -0
- package/lib/common/validators/validation-result.js +16 -0
- package/lib/common/vendor/License.txt +4 -0
- package/lib/common/vendor/jaro-winkler_distance.js +111 -0
- package/lib/common/verify-node-version.js +78 -0
- package/lib/common/yok.js +426 -0
- package/lib/config.js +137 -0
- package/lib/constants-provider.js +12 -0
- package/lib/constants.js +350 -0
- package/lib/controllers/build-controller.js +133 -0
- package/lib/controllers/debug-controller.js +235 -0
- package/lib/controllers/deploy-controller.js +38 -0
- package/lib/controllers/migrate-controller.js +1114 -0
- package/lib/controllers/platform-controller.js +127 -0
- package/lib/controllers/prepare-controller.js +353 -0
- package/lib/controllers/run-controller.js +525 -0
- package/lib/controllers/update-controller-base.js +84 -0
- package/lib/controllers/update-controller.js +188 -0
- package/lib/data/build-data.js +44 -0
- package/lib/data/controller-data-base.js +11 -0
- package/lib/data/debug-data.js +6 -0
- package/lib/data/platform-data.js +13 -0
- package/lib/data/prepare-data.js +46 -0
- package/lib/data/run-data.js +11 -0
- package/lib/declarations.d.ts +1256 -0
- package/lib/definitions/android-bundle-tool-service.d.ts +17 -0
- package/lib/definitions/android-plugin-migrator.d.ts +52 -0
- package/lib/definitions/build.d.ts +92 -0
- package/lib/definitions/cleanup-service.d.ts +79 -0
- package/lib/definitions/data.d.ts +7 -0
- package/lib/definitions/debug.d.ts +166 -0
- package/lib/definitions/deploy.d.ts +3 -0
- package/lib/definitions/file-log-service.d.ts +19 -0
- package/lib/definitions/files-hash-service.d.ts +35 -0
- package/lib/definitions/gradle.d.ts +33 -0
- package/lib/definitions/hmr-status-service.d.ts +5 -0
- package/lib/definitions/initialize-service.d.ts +11 -0
- package/lib/definitions/ios-debugger-port-service.d.ts +29 -0
- package/lib/definitions/ios.d.ts +97 -0
- package/lib/definitions/ip-service.d.ts +10 -0
- package/lib/definitions/livesync-global.d.ts +7 -0
- package/lib/definitions/livesync.d.ts +601 -0
- package/lib/definitions/lock-service.d.ts +43 -0
- package/lib/definitions/log-parser-service.d.ts +14 -0
- package/lib/definitions/marking-mode-service.d.ts +11 -0
- package/lib/definitions/metadata-filtering-service.d.ts +48 -0
- package/lib/definitions/migrate.d.ts +46 -0
- package/lib/definitions/nativescript-dev-xcode.d.ts +87 -0
- package/lib/definitions/pacote-service.d.ts +50 -0
- package/lib/definitions/platform.d.ts +146 -0
- package/lib/definitions/plugins.d.ts +75 -0
- package/lib/definitions/prepare.d.ts +51 -0
- package/lib/definitions/project-changes.d.ts +34 -0
- package/lib/definitions/project.d.ts +858 -0
- package/lib/definitions/prompter.d.ts +27 -0
- package/lib/definitions/qr-code.d.ts +3 -0
- package/lib/definitions/require.d.ts +11 -0
- package/lib/definitions/run.d.ts +45 -0
- package/lib/definitions/start-service.d.ts +15 -0
- package/lib/definitions/subscription-service.d.ts +11 -0
- package/lib/definitions/system-warnings.d.ts +4 -0
- package/lib/definitions/temp-service.d.ts +9 -0
- package/lib/definitions/terminal-spinner-service.d.ts +12 -0
- package/lib/definitions/update.d.ts +16 -0
- package/lib/definitions/xcode.d.ts +12 -0
- package/lib/detached-processes/cleanup-js-subprocess.js +62 -0
- package/lib/detached-processes/cleanup-process-definitions.d.ts +70 -0
- package/lib/detached-processes/cleanup-process.js +281 -0
- package/lib/detached-processes/detached-process-enums.d.ts +70 -0
- package/lib/detached-processes/file-log-service.js +20 -0
- package/lib/device-path-provider.js +60 -0
- package/lib/device-sockets/ios/app-debug-socket-proxy-factory.js +217 -0
- package/lib/device-sockets/ios/notification.js +30 -0
- package/lib/device-sockets/ios/socket-request-executor.js +56 -0
- package/lib/helpers/android-bundle-validator-helper.js +52 -0
- package/lib/helpers/deploy-command-helper.js +70 -0
- package/lib/helpers/key-command-helper.js +124 -0
- package/lib/helpers/livesync-command-helper.js +220 -0
- package/lib/helpers/network-connectivity-validator.js +47 -0
- package/lib/helpers/options-track-helper.js +88 -0
- package/lib/helpers/package-path-helper.js +6 -0
- package/lib/helpers/platform-command-helper.js +192 -0
- package/lib/helpers/version-validator-helper.js +25 -0
- package/lib/key-commands/bootstrap.js +21 -0
- package/lib/key-commands/index.js +456 -0
- package/lib/nativescript-cli-lib-bootstrap.js +8 -0
- package/lib/nativescript-cli-lib.js +5 -0
- package/lib/nativescript-cli.js +55 -0
- package/lib/node/pbxproj-dom-xcode.js +5 -0
- package/lib/node/xcode.js +7 -0
- package/lib/node-package-manager.js +156 -0
- package/lib/options.js +393 -0
- package/lib/package-installation-manager.js +221 -0
- package/lib/package-manager.js +184 -0
- package/lib/platform-command-param.js +29 -0
- package/lib/pnpm-package-manager.js +136 -0
- package/lib/project-data.js +237 -0
- package/lib/providers/project-files-provider.js +46 -0
- package/lib/resolvers/livesync-service-resolver.js +22 -0
- package/lib/services/analytics/analytics-broker-process.js +77 -0
- package/lib/services/analytics/analytics-broker.js +53 -0
- package/lib/services/analytics/analytics-service.js +366 -0
- package/lib/services/analytics/analytics.d.ts +55 -0
- package/lib/services/analytics/google-analytics-cross-client-custom-dimensions.d.ts +6 -0
- package/lib/services/analytics/google-analytics-provider.js +152 -0
- package/lib/services/analytics-settings-service.js +104 -0
- package/lib/services/android/android-bundle-tool-service.js +81 -0
- package/lib/services/android/gradle-build-args-service.js +87 -0
- package/lib/services/android/gradle-build-service.js +68 -0
- package/lib/services/android/gradle-command-service.js +49 -0
- package/lib/services/android-device-debug-service.js +173 -0
- package/lib/services/android-plugin-build-service.js +527 -0
- package/lib/services/android-project-service.js +600 -0
- package/lib/services/android-resources-migration-service.js +104 -0
- package/lib/services/apple-portal/apple-portal-application-service.js +82 -0
- package/lib/services/apple-portal/apple-portal-cookie-service.js +53 -0
- package/lib/services/apple-portal/apple-portal-session-service.js +277 -0
- package/lib/services/apple-portal/definitions.d.ts +87 -0
- package/lib/services/assets-generation/assets-generation-service.js +178 -0
- package/lib/services/build-artifacts-service.js +113 -0
- package/lib/services/build-data-service.js +20 -0
- package/lib/services/build-info-file-service.js +79 -0
- package/lib/services/cleanup-service.js +194 -0
- package/lib/services/cocoapods-platform-manager.js +137 -0
- package/lib/services/cocoapods-service.js +354 -0
- package/lib/services/debug-data-service.js +21 -0
- package/lib/services/debug-service-base.js +44 -0
- package/lib/services/device/device-install-app-service.js +118 -0
- package/lib/services/doctor-service.js +294 -0
- package/lib/services/extensibility-service.js +220 -0
- package/lib/services/files-hash-service.js +79 -0
- package/lib/services/hmr-status-service.js +128 -0
- package/lib/services/info-service.js +14 -0
- package/lib/services/initialize-service.js +70 -0
- package/lib/services/ios/export-options-plist-service.js +131 -0
- package/lib/services/ios/ios-signing-service.js +265 -0
- package/lib/services/ios/spm-service.js +78 -0
- package/lib/services/ios/xcodebuild-args-service.js +163 -0
- package/lib/services/ios/xcodebuild-command-service.js +40 -0
- package/lib/services/ios/xcodebuild-service.js +93 -0
- package/lib/services/ios-debugger-port-service.js +140 -0
- package/lib/services/ios-device-debug-service.js +167 -0
- package/lib/services/ios-entitlements-service.js +78 -0
- package/lib/services/ios-extensions-service.js +63 -0
- package/lib/services/ios-log-filter.js +70 -0
- package/lib/services/ios-native-target-service.js +108 -0
- package/lib/services/ios-project-service.js +851 -0
- package/lib/services/ios-provision-service.js +173 -0
- package/lib/services/ios-watch-app-service.js +76 -0
- package/lib/services/ip-service.js +78 -0
- package/lib/services/itmstransporter-service.js +216 -0
- package/lib/services/karma-execution.js +16 -0
- package/lib/services/livesync/android-device-livesync-service-base.js +68 -0
- package/lib/services/livesync/android-device-livesync-service.js +203 -0
- package/lib/services/livesync/android-device-livesync-sockets-service.js +198 -0
- package/lib/services/livesync/android-livesync-service.js +76 -0
- package/lib/services/livesync/android-livesync-tool.js +427 -0
- package/lib/services/livesync/android-livesync-tool.md +211 -0
- package/lib/services/livesync/device-livesync-service-base.js +69 -0
- package/lib/services/livesync/ios-device-livesync-service.js +218 -0
- package/lib/services/livesync/ios-livesync-service.js +95 -0
- package/lib/services/livesync/livesync-socket.js +14 -0
- package/lib/services/livesync/platform-livesync-service-base.js +180 -0
- package/lib/services/livesync-process-data-service.js +43 -0
- package/lib/services/log-parser-service.js +52 -0
- package/lib/services/log-source-map-service.js +235 -0
- package/lib/services/marking-mode-service.js +56 -0
- package/lib/services/metadata-filtering-service.js +105 -0
- package/lib/services/npm-config-service.js +39 -0
- package/lib/services/pacote-service.js +109 -0
- package/lib/services/performance-service.js +92 -0
- package/lib/services/platform/add-platform-service.js +119 -0
- package/lib/services/platform/platform-validation-service.js +85 -0
- package/lib/services/platform/prepare-native-platform-service.js +87 -0
- package/lib/services/platform-environment-requirements.js +87 -0
- package/lib/services/platform-project-service-base.js +32 -0
- package/lib/services/platforms-data-service.js +31 -0
- package/lib/services/plugins-service.js +477 -0
- package/lib/services/prepare-data-service.js +21 -0
- package/lib/services/project-backup-service.js +114 -0
- package/lib/services/project-changes-service.js +274 -0
- package/lib/services/project-cleanup-service.js +102 -0
- package/lib/services/project-config-service.js +335 -0
- package/lib/services/project-data-service.js +478 -0
- package/lib/services/project-name-service.js +67 -0
- package/lib/services/project-service.js +204 -0
- package/lib/services/project-templates-service.js +114 -0
- package/lib/services/qr-code-terminal-service.js +20 -0
- package/lib/services/require-service.js +11 -0
- package/lib/services/start-service.js +116 -0
- package/lib/services/temp-service.js +36 -0
- package/lib/services/terminal-spinner-service.js +38 -0
- package/lib/services/test-execution-service.js +154 -0
- package/lib/services/test-initialization-service.js +54 -0
- package/lib/services/timeline-profiler-service.js +108 -0
- package/lib/services/user-settings-service.js +34 -0
- package/lib/services/versions-service.js +196 -0
- package/lib/services/watch-ignore-list-service.js +20 -0
- package/lib/services/webpack/webpack-compiler-service.js +405 -0
- package/lib/services/webpack/webpack.d.ts +227 -0
- package/lib/services/xcconfig-service.js +76 -0
- package/lib/services/xcproj-service.js +11 -0
- package/lib/shared-event-bus.js +7 -0
- package/lib/sys-info.js +120 -0
- package/lib/tools/config-manipulation/config-transformer.js +201 -0
- package/lib/tools/node-modules/node-modules-builder.js +42 -0
- package/lib/tools/node-modules/node-modules-dependencies-builder.js +100 -0
- package/lib/yarn-package-manager.js +134 -0
- package/lib/yarn2-package-manager.js +143 -0
- package/package.json +192 -0
- package/postinstall.js +10 -0
- package/preuninstall.js +14 -0
- package/resources/assets/image-definitions.json +655 -0
- package/resources/test/example.jasmine.js +6 -0
- package/resources/test/example.jasmine.ts +6 -0
- package/resources/test/example.mocha.js +9 -0
- package/resources/test/example.mocha.ts +9 -0
- package/resources/test/example.qunit.js +7 -0
- package/resources/test/example.qunit.ts +7 -0
- package/resources/test/karma.conf.js +93 -0
- package/resources/test/test-main.js +9 -0
- package/resources/test/test-main.ts +11 -0
- package/resources/test/tsconfig.spec.json +9 -0
- package/setup/mac-startup-shell-script.sh +2 -0
- package/vendor/aab-tool/LICENSE +202 -0
- package/vendor/aab-tool/README.txt +1 -0
- package/vendor/aab-tool/bundletool.jar +0 -0
- package/vendor/gradle-app/app/build.gradle +1054 -0
- package/vendor/gradle-app/app/gradle-helpers/AnalyticsCollector.gradle +48 -0
- package/vendor/gradle-app/app/gradle-helpers/BuildToolTask.gradle +50 -0
- package/vendor/gradle-app/app/gradle-helpers/CustomExecutionLogger.gradle +52 -0
- package/vendor/gradle-app/build.gradle +170 -0
- package/vendor/gradle-app/settings.gradle +78 -0
- package/vendor/gradle-plugin/LICENSE +995 -0
- package/vendor/gradle-plugin/build.gradle +363 -0
- package/vendor/gradle-plugin/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/vendor/gradle-plugin/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/vendor/gradle-plugin/gradle.properties +6 -0
- package/vendor/gradle-plugin/gradlew +172 -0
- package/vendor/gradle-plugin/gradlew.bat +84 -0
- package/vendor/gradle-plugin/settings.gradle +45 -0
|
@@ -0,0 +1,1114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.MigrateController = void 0;
|
|
13
|
+
const path = require("path");
|
|
14
|
+
const semver = require("semver");
|
|
15
|
+
const constants = require("../constants");
|
|
16
|
+
const glob_1 = require("glob");
|
|
17
|
+
const _ = require("lodash");
|
|
18
|
+
const simple_git_1 = require("simple-git");
|
|
19
|
+
const update_controller_base_1 = require("./update-controller-base");
|
|
20
|
+
const helpers_1 = require("../common/helpers");
|
|
21
|
+
const yok_1 = require("../common/yok");
|
|
22
|
+
const temp = require("temp");
|
|
23
|
+
const color_1 = require("../color");
|
|
24
|
+
class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
25
|
+
constructor($fs, $platformCommandHelper, $platformsDataService, $packageInstallationManager, $packageManager, $pacoteService, $logger, $errors, $pluginsService, $projectDataService, $projectConfigService, $projectData, $options, $resources, $injector, $settingsService, $staticConfig, $terminalSpinnerService, $projectCleanupService, $projectBackupService, $childProcess) {
|
|
26
|
+
super($fs, $platformCommandHelper, $platformsDataService, $packageInstallationManager, $packageManager, $pacoteService);
|
|
27
|
+
this.$fs = $fs;
|
|
28
|
+
this.$platformCommandHelper = $platformCommandHelper;
|
|
29
|
+
this.$platformsDataService = $platformsDataService;
|
|
30
|
+
this.$packageInstallationManager = $packageInstallationManager;
|
|
31
|
+
this.$packageManager = $packageManager;
|
|
32
|
+
this.$pacoteService = $pacoteService;
|
|
33
|
+
this.$logger = $logger;
|
|
34
|
+
this.$errors = $errors;
|
|
35
|
+
this.$pluginsService = $pluginsService;
|
|
36
|
+
this.$projectDataService = $projectDataService;
|
|
37
|
+
this.$projectConfigService = $projectConfigService;
|
|
38
|
+
this.$projectData = $projectData;
|
|
39
|
+
this.$options = $options;
|
|
40
|
+
this.$resources = $resources;
|
|
41
|
+
this.$injector = $injector;
|
|
42
|
+
this.$settingsService = $settingsService;
|
|
43
|
+
this.$staticConfig = $staticConfig;
|
|
44
|
+
this.$terminalSpinnerService = $terminalSpinnerService;
|
|
45
|
+
this.$projectCleanupService = $projectCleanupService;
|
|
46
|
+
this.$projectBackupService = $projectBackupService;
|
|
47
|
+
this.$childProcess = $childProcess;
|
|
48
|
+
this.migrationDependencies = [
|
|
49
|
+
{
|
|
50
|
+
packageName: "@nativescript/core",
|
|
51
|
+
minVersion: "6.5.0",
|
|
52
|
+
desiredVersion: "~8.7.0",
|
|
53
|
+
shouldAddIfMissing: true,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
packageName: "tns-core-modules",
|
|
57
|
+
shouldRemove: true,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
packageName: "@nativescript/types",
|
|
61
|
+
minVersion: "7.0.0",
|
|
62
|
+
desiredVersion: "~8.7.0",
|
|
63
|
+
isDev: true,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
packageName: "tns-platform-declarations",
|
|
67
|
+
replaceWith: "@nativescript/types",
|
|
68
|
+
minVersion: "6.5.0",
|
|
69
|
+
isDev: true,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
packageName: "tns-core-modules-widgets",
|
|
73
|
+
shouldRemove: true,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
packageName: "nativescript-dev-webpack",
|
|
77
|
+
replaceWith: constants.WEBPACK_PLUGIN_NAME,
|
|
78
|
+
shouldRemove: true,
|
|
79
|
+
isDev: true,
|
|
80
|
+
shouldMigrateAction() {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
return true;
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
migrateAction: this.migrateWebpack.bind(this),
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
packageName: constants.WEBPACK_PLUGIN_NAME,
|
|
89
|
+
minVersion: "3.0.0",
|
|
90
|
+
desiredVersion: "~5.0.0",
|
|
91
|
+
shouldAddIfMissing: true,
|
|
92
|
+
isDev: true,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
packageName: "nativescript-vue",
|
|
96
|
+
minVersion: "2.7.0",
|
|
97
|
+
desiredVersion: "~2.9.3",
|
|
98
|
+
shouldMigrateAction(dependency, projectData, loose) {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
if (!this.hasDependency(dependency, projectData)) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
return yield this.shouldMigrateDependencyVersion(dependency, projectData, loose);
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
migrateAction: this.migrateNativeScriptVue.bind(this),
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
packageName: "nativescript-angular",
|
|
110
|
+
replaceWith: "@nativescript/angular",
|
|
111
|
+
minVersion: "10.0.0",
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
packageName: "@nativescript/angular",
|
|
115
|
+
minVersion: "10.0.0",
|
|
116
|
+
desiredVersion: "^17.0.0",
|
|
117
|
+
shouldMigrateAction(dependency, projectData, loose) {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
if (!this.hasDependency(dependency, projectData)) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
return yield this.shouldMigrateDependencyVersion(dependency, projectData, loose);
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
migrateAction: this.migrateNativeScriptAngular.bind(this),
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
packageName: "svelte-native",
|
|
129
|
+
minVersion: "0.9.0",
|
|
130
|
+
desiredVersion: "~0.9.4",
|
|
131
|
+
shouldMigrateAction(dependency, projectData, loose) {
|
|
132
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
if (!this.hasDependency(dependency, projectData)) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
return yield this.shouldMigrateDependencyVersion(dependency, projectData, loose);
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
migrateAction: this.migrateNativeScriptSvelte.bind(this),
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
packageName: "nativescript-unit-test-runner",
|
|
143
|
+
replaceWith: "@nativescript/unit-test-runner",
|
|
144
|
+
shouldRemove: true,
|
|
145
|
+
isDev: true,
|
|
146
|
+
shouldMigrateAction() {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
return true;
|
|
149
|
+
});
|
|
150
|
+
},
|
|
151
|
+
migrateAction: this.migrateUnitTestRunner.bind(this),
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
packageName: "@nativescript/unit-test-runner",
|
|
155
|
+
minVersion: "1.0.0",
|
|
156
|
+
desiredVersion: "~3.0.0",
|
|
157
|
+
shouldMigrateAction(dependency, projectData, loose) {
|
|
158
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
+
if (!this.hasDependency(dependency, projectData)) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
return yield this.shouldMigrateDependencyVersion(dependency, projectData, loose);
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
migrateAction: this.migrateUnitTestRunner.bind(this),
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
packageName: "typescript",
|
|
169
|
+
isDev: true,
|
|
170
|
+
minVersion: "3.7.0",
|
|
171
|
+
desiredVersion: "~5.4.0",
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
packageName: "node-sass",
|
|
175
|
+
replaceWith: "sass",
|
|
176
|
+
minVersion: "0.0.0",
|
|
177
|
+
isDev: true,
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
packageName: "sass",
|
|
181
|
+
minVersion: "0.0.0",
|
|
182
|
+
desiredVersion: "^1.49.9",
|
|
183
|
+
isDev: true,
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
packageName: "tns-ios",
|
|
187
|
+
minVersion: "6.5.3",
|
|
188
|
+
replaceWith: "@nativescript/ios",
|
|
189
|
+
isDev: true,
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
packageName: "tns-android",
|
|
193
|
+
minVersion: "6.5.4",
|
|
194
|
+
replaceWith: "@nativescript/android",
|
|
195
|
+
isDev: true,
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
packageName: "@nativescript/ios",
|
|
199
|
+
minVersion: "6.5.3",
|
|
200
|
+
desiredVersion: "~8.7.0",
|
|
201
|
+
isDev: true,
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
packageName: "@nativescript/android",
|
|
205
|
+
minVersion: "7.0.0",
|
|
206
|
+
desiredVersion: "~8.7.0",
|
|
207
|
+
isDev: true,
|
|
208
|
+
},
|
|
209
|
+
];
|
|
210
|
+
}
|
|
211
|
+
get $jsonFileSettingsService() {
|
|
212
|
+
const cliVersion = semver.coerce(this.$staticConfig.version);
|
|
213
|
+
const shouldMigrateCacheFilePath = path.join(this.$settingsService.getProfileDir(), `should-migrate-cache-${cliVersion}.json`);
|
|
214
|
+
this.$logger.trace(`Migration cache path is: ${shouldMigrateCacheFilePath}`);
|
|
215
|
+
return this.$injector.resolve("jsonFileSettingsService", {
|
|
216
|
+
jsonFileSettingsPath: shouldMigrateCacheFilePath,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
shouldMigrate({ projectDir, platforms, loose = false, }) {
|
|
220
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
221
|
+
const remainingPlatforms = [];
|
|
222
|
+
let shouldMigrate = false;
|
|
223
|
+
for (const platform of platforms) {
|
|
224
|
+
if (!loose) {
|
|
225
|
+
remainingPlatforms.push(platform);
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
const cachedResult = yield this.getCachedShouldMigrate(projectDir, platform);
|
|
229
|
+
this.$logger.trace(`Got cached result for shouldMigrate for platform: ${platform}: ${cachedResult}`);
|
|
230
|
+
if (cachedResult !== false) {
|
|
231
|
+
remainingPlatforms.push(platform);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (remainingPlatforms.length > 0) {
|
|
235
|
+
shouldMigrate = yield this._shouldMigrate({
|
|
236
|
+
projectDir,
|
|
237
|
+
platforms: remainingPlatforms,
|
|
238
|
+
loose,
|
|
239
|
+
});
|
|
240
|
+
this.$logger.trace(`Executed shouldMigrate for platforms: ${remainingPlatforms}. Result is: ${shouldMigrate}`);
|
|
241
|
+
if (!shouldMigrate && loose) {
|
|
242
|
+
for (const remainingPlatform of remainingPlatforms) {
|
|
243
|
+
yield this.setCachedShouldMigrate(projectDir, remainingPlatform);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return shouldMigrate;
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
validate({ projectDir, platforms, loose = true, }) {
|
|
251
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
252
|
+
const shouldMigrate = yield this.shouldMigrate({
|
|
253
|
+
projectDir,
|
|
254
|
+
platforms,
|
|
255
|
+
loose,
|
|
256
|
+
});
|
|
257
|
+
if (shouldMigrate) {
|
|
258
|
+
this.$errors.fail(`The current application is not compatible with NativeScript CLI ${this.$staticConfig.version}.\n\nRun 'ns migrate' to migrate your project to the latest NativeScript version.\n\nAlternatively you may try running it with '--force' to skip this check.`);
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
migrate({ projectDir, platforms, loose = false, }) {
|
|
263
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
264
|
+
this.spinner = this.$terminalSpinnerService.createSpinner();
|
|
265
|
+
const projectData = this.$projectDataService.getProjectData(projectDir);
|
|
266
|
+
this.$logger.trace("MigrationController.migrate called with", {
|
|
267
|
+
projectDir,
|
|
268
|
+
platforms,
|
|
269
|
+
loose: loose,
|
|
270
|
+
});
|
|
271
|
+
const canMigrate = yield this.ensureGitCleanOrForce(projectDir);
|
|
272
|
+
if (!canMigrate) {
|
|
273
|
+
this.spinner.fail("Pre-Migration verification failed");
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
this.spinner.succeed("Pre-Migration verification complete");
|
|
277
|
+
this.spinner.info("Backing up project files before migration");
|
|
278
|
+
const backup = yield this.backupProject(projectDir);
|
|
279
|
+
this.spinner.succeed("Project files have been backed up");
|
|
280
|
+
this.spinner.info("Cleaning up project files before migration");
|
|
281
|
+
yield this.cleanUpProject(projectData);
|
|
282
|
+
this.spinner.succeed("Project files have been cleaned up");
|
|
283
|
+
this.spinner.info("Cleaning up old artifacts");
|
|
284
|
+
yield this.handleAutoGeneratedFiles(backup, projectData);
|
|
285
|
+
this.spinner.succeed("Cleaned old artifacts");
|
|
286
|
+
const newConfigPath = path.resolve(projectDir, "nativescript.config.ts");
|
|
287
|
+
if (!this.$fs.exists(newConfigPath)) {
|
|
288
|
+
this.spinner.info(`Migrating project to use ${color_1.color.green("nativescript.config.ts")}`);
|
|
289
|
+
yield this.migrateConfigs(projectDir);
|
|
290
|
+
this.spinner.succeed(`Project has been migrated to use ${color_1.color.green("nativescript.config.ts")}`);
|
|
291
|
+
}
|
|
292
|
+
this.spinner.info("Updating project dependencies");
|
|
293
|
+
yield this.migrateDependencies(projectData, platforms, loose);
|
|
294
|
+
this.spinner.succeed("Project dependencies have been updated");
|
|
295
|
+
const isAngular = this.hasDependency({
|
|
296
|
+
packageName: "@nativescript/angular",
|
|
297
|
+
}, projectData);
|
|
298
|
+
let polyfillsPath;
|
|
299
|
+
if (isAngular) {
|
|
300
|
+
polyfillsPath = yield this.checkOrCreatePolyfillsTS(projectData);
|
|
301
|
+
}
|
|
302
|
+
const tsConfigPath = path.resolve(projectDir, "tsconfig.json");
|
|
303
|
+
if (this.$fs.exists(tsConfigPath)) {
|
|
304
|
+
this.spinner.info(`Updating ${color_1.color.yellow("tsconfig.json")}`);
|
|
305
|
+
yield this.migrateTSConfig({
|
|
306
|
+
tsConfigPath,
|
|
307
|
+
isAngular,
|
|
308
|
+
polyfillsPath,
|
|
309
|
+
});
|
|
310
|
+
this.spinner.succeed(`Updated ${color_1.color.yellow("tsconfig.json")}`);
|
|
311
|
+
}
|
|
312
|
+
yield this.migrateWebpack5(projectDir, projectData);
|
|
313
|
+
yield this.runESLint(projectDir);
|
|
314
|
+
this.spinner.succeed("Migration complete.");
|
|
315
|
+
this.$logger.info("");
|
|
316
|
+
this.$logger.printMarkdown("Project has been successfully migrated. The next step is to run `ns run <platform>` to ensure everything is working properly." +
|
|
317
|
+
"\n\nPlease note that you may need additional changes to complete the migration.");
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
_shouldMigrate({ projectDir, platforms, loose, }) {
|
|
321
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
322
|
+
const isMigrate = _.get(this.$options, "argv._[0]") === "migrate";
|
|
323
|
+
const projectData = this.$projectDataService.getProjectData(projectDir);
|
|
324
|
+
const projectInfo = this.$projectConfigService.detectProjectConfigs(projectData.projectDir);
|
|
325
|
+
if (!isMigrate && projectInfo.hasNSConfig) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
const shouldMigrateCommonMessage = "The app is not compatible with this CLI version and it should be migrated. Reason: ";
|
|
329
|
+
for (let i = 0; i < this.migrationDependencies.length; i++) {
|
|
330
|
+
const dependency = this.migrationDependencies[i];
|
|
331
|
+
const hasDependency = this.hasDependency(dependency, projectData);
|
|
332
|
+
if (!hasDependency) {
|
|
333
|
+
if (dependency.shouldAddIfMissing) {
|
|
334
|
+
this.$logger.trace(`${shouldMigrateCommonMessage}'${dependency.packageName}' is missing.`);
|
|
335
|
+
if (loose) {
|
|
336
|
+
continue;
|
|
337
|
+
}
|
|
338
|
+
return true;
|
|
339
|
+
}
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
342
|
+
if (dependency.shouldMigrateAction) {
|
|
343
|
+
const shouldMigrate = yield dependency.shouldMigrateAction.bind(this)(dependency, projectData, loose);
|
|
344
|
+
if (shouldMigrate) {
|
|
345
|
+
this.$logger.trace(`${shouldMigrateCommonMessage}'${dependency.packageName}' requires an update.`);
|
|
346
|
+
return true;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (dependency.replaceWith || dependency.shouldRemove) {
|
|
350
|
+
this.$logger.trace(`${shouldMigrateCommonMessage}'${dependency.packageName}' is deprecated.`);
|
|
351
|
+
if (loose) {
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
return true;
|
|
355
|
+
}
|
|
356
|
+
const shouldUpdate = yield this.shouldMigrateDependencyVersion(dependency, projectData, loose);
|
|
357
|
+
if (shouldUpdate) {
|
|
358
|
+
this.$logger.trace(`${shouldMigrateCommonMessage}'${dependency.packageName}' should be updated.`);
|
|
359
|
+
return true;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
return false;
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
shouldMigrateDependencyVersion(dependency, projectData, loose) {
|
|
366
|
+
var _a, _b;
|
|
367
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
368
|
+
const installedVersion = yield this.$packageInstallationManager.getInstalledDependencyVersion(dependency.packageName, projectData.projectDir);
|
|
369
|
+
const desiredVersion = (_a = dependency.desiredVersion) !== null && _a !== void 0 ? _a : dependency.minVersion;
|
|
370
|
+
const minVersion = (_b = dependency.minVersion) !== null && _b !== void 0 ? _b : dependency.desiredVersion;
|
|
371
|
+
if (dependency.shouldUseExactVersion &&
|
|
372
|
+
installedVersion !== desiredVersion) {
|
|
373
|
+
return true;
|
|
374
|
+
}
|
|
375
|
+
return this.isOutdatedVersion(installedVersion, { minVersion, desiredVersion }, loose);
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
getCachedShouldMigrate(projectDir, platform) {
|
|
379
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
380
|
+
let cachedShouldMigrateValue = null;
|
|
381
|
+
const cachedHash = yield this.$jsonFileSettingsService.getSettingValue((0, helpers_1.getHash)(`${projectDir}${platform.toLowerCase()}`));
|
|
382
|
+
const packageJsonHash = yield this.getPackageJsonHash(projectDir);
|
|
383
|
+
if (cachedHash === packageJsonHash) {
|
|
384
|
+
cachedShouldMigrateValue = false;
|
|
385
|
+
}
|
|
386
|
+
return cachedShouldMigrateValue;
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
setCachedShouldMigrate(projectDir, platform) {
|
|
390
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
391
|
+
this.$logger.trace(`Caching shouldMigrate result for platform ${platform}.`);
|
|
392
|
+
const packageJsonHash = yield this.getPackageJsonHash(projectDir);
|
|
393
|
+
yield this.$jsonFileSettingsService.saveSetting((0, helpers_1.getHash)(`${projectDir}${platform.toLowerCase()}`), packageJsonHash);
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
getPackageJsonHash(projectDir) {
|
|
397
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
398
|
+
const projectPackageJsonFilePath = path.join(projectDir, constants.PACKAGE_JSON_FILE_NAME);
|
|
399
|
+
return yield this.$fs.getFileShasum(projectPackageJsonFilePath);
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
ensureGitCleanOrForce(projectDir) {
|
|
403
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
404
|
+
const git = (0, simple_git_1.default)(projectDir);
|
|
405
|
+
const isGit = yield git.checkIsRepo();
|
|
406
|
+
const isForce = this.$options.force;
|
|
407
|
+
if (!isGit) {
|
|
408
|
+
if (!isForce) {
|
|
409
|
+
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\`.`);
|
|
410
|
+
this.$errors.fail("Not in Git repo.");
|
|
411
|
+
return false;
|
|
412
|
+
}
|
|
413
|
+
this.spinner.warn(`Not in Git repo, but using ${color_1.color.red("--force")}`);
|
|
414
|
+
return true;
|
|
415
|
+
}
|
|
416
|
+
const isClean = (yield git.status()).isClean();
|
|
417
|
+
if (!isClean) {
|
|
418
|
+
if (!isForce) {
|
|
419
|
+
this.$logger.printMarkdown(`Current git branch has uncommitted changes. Please commit the changes and try again. Alternatively run \`ns migrate --force\` to skip this check.`);
|
|
420
|
+
this.$errors.fail("Git branch not clean.");
|
|
421
|
+
return false;
|
|
422
|
+
}
|
|
423
|
+
this.spinner.warn(`Git branch not clean, but using ${color_1.color.red("--force")}`);
|
|
424
|
+
return true;
|
|
425
|
+
}
|
|
426
|
+
return true;
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
backupProject(projectDir) {
|
|
430
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
431
|
+
const projectData = this.$projectDataService.getProjectData(projectDir);
|
|
432
|
+
const backup = this.$projectBackupService.getBackup("migration");
|
|
433
|
+
backup.addPaths([
|
|
434
|
+
...MigrateController.pathsToBackup,
|
|
435
|
+
path.join(projectData.getAppDirectoryRelativePath(), "package.json"),
|
|
436
|
+
]);
|
|
437
|
+
try {
|
|
438
|
+
return backup.create();
|
|
439
|
+
}
|
|
440
|
+
catch (error) {
|
|
441
|
+
this.spinner.fail(`Project backup failed.`);
|
|
442
|
+
backup.remove();
|
|
443
|
+
this.$errors.fail(`Project backup failed. Error is: ${error.message}`);
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
cleanUpProject(projectData) {
|
|
448
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
449
|
+
yield this.$projectCleanupService.clean([
|
|
450
|
+
constants.HOOKS_DIR_NAME,
|
|
451
|
+
this.$projectData.getBuildRelativeDirectoryPath(),
|
|
452
|
+
constants.NODE_MODULES_FOLDER_NAME,
|
|
453
|
+
constants.PACKAGE_LOCK_JSON_FILE_NAME,
|
|
454
|
+
]);
|
|
455
|
+
const { dependencies, devDependencies } = yield this.$pluginsService.getDependenciesFromPackageJson(projectData.projectDir);
|
|
456
|
+
const hasSchematics = [...dependencies, ...devDependencies].find((p) => p.name === "@nativescript/schematics");
|
|
457
|
+
if (!hasSchematics) {
|
|
458
|
+
yield this.$projectCleanupService.clean([
|
|
459
|
+
constants.TSCCONFIG_TNS_JSON_NAME,
|
|
460
|
+
]);
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
handleAutoGeneratedFiles(backup, projectData) {
|
|
465
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
466
|
+
const globOptions = {
|
|
467
|
+
nocase: true,
|
|
468
|
+
matchBase: true,
|
|
469
|
+
nodir: true,
|
|
470
|
+
absolute: false,
|
|
471
|
+
cwd: projectData.appDirectoryPath,
|
|
472
|
+
withFileTypes: false,
|
|
473
|
+
};
|
|
474
|
+
const jsFiles = (0, glob_1.globSync)("*.@(js|ts|js.map)", globOptions);
|
|
475
|
+
const autoGeneratedJsFiles = this.getGeneratedFiles(jsFiles, [".js"], [".ts"]);
|
|
476
|
+
const autoGeneratedJsMapFiles = this.getGeneratedFiles(jsFiles, [".map"], [""]);
|
|
477
|
+
const cssFiles = (0, glob_1.globSync)("*.@(less|sass|scss|css)", globOptions);
|
|
478
|
+
const autoGeneratedCssFiles = this.getGeneratedFiles(cssFiles, [".css"], [".scss", ".sass", ".less"]);
|
|
479
|
+
const allGeneratedFiles = autoGeneratedJsFiles
|
|
480
|
+
.concat(autoGeneratedJsMapFiles)
|
|
481
|
+
.concat(autoGeneratedCssFiles);
|
|
482
|
+
const pathsToBackup = allGeneratedFiles.map((generatedFile) => path.join(projectData.appDirectoryPath, generatedFile));
|
|
483
|
+
backup.addPaths(pathsToBackup);
|
|
484
|
+
backup.create();
|
|
485
|
+
if (backup.isUpToDate()) {
|
|
486
|
+
yield this.$projectCleanupService.clean(pathsToBackup);
|
|
487
|
+
}
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
getGeneratedFiles(allFiles, generatedFileExts, sourceFileExts) {
|
|
491
|
+
return allFiles.filter((file) => {
|
|
492
|
+
let isGenerated = false;
|
|
493
|
+
const { dir, name, ext } = path.parse(file);
|
|
494
|
+
if (generatedFileExts.indexOf(ext) > -1) {
|
|
495
|
+
for (const sourceExt of sourceFileExts) {
|
|
496
|
+
const possibleSourceFile = path.format({ dir, name, ext: sourceExt });
|
|
497
|
+
isGenerated = allFiles.indexOf(possibleSourceFile) > -1;
|
|
498
|
+
if (isGenerated) {
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
return isGenerated;
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
isOutdatedVersion(current, target, loose) {
|
|
507
|
+
if (!current && loose) {
|
|
508
|
+
return false;
|
|
509
|
+
}
|
|
510
|
+
const installed = semver.coerce(current);
|
|
511
|
+
const min = semver.coerce(target.minVersion);
|
|
512
|
+
const desired = semver.coerce(target.desiredVersion);
|
|
513
|
+
if (loose) {
|
|
514
|
+
if (!installed || !min) {
|
|
515
|
+
return false;
|
|
516
|
+
}
|
|
517
|
+
return semver.lt(installed, min);
|
|
518
|
+
}
|
|
519
|
+
if (!installed || !desired) {
|
|
520
|
+
return true;
|
|
521
|
+
}
|
|
522
|
+
return semver.lt(installed, desired);
|
|
523
|
+
}
|
|
524
|
+
detectAppPath(projectDir, configData) {
|
|
525
|
+
if (configData.appPath) {
|
|
526
|
+
return configData.appPath;
|
|
527
|
+
}
|
|
528
|
+
const possibleAppPaths = [
|
|
529
|
+
path.resolve(projectDir, constants.SRC_DIR),
|
|
530
|
+
path.resolve(projectDir, constants.APP_FOLDER_NAME),
|
|
531
|
+
];
|
|
532
|
+
const appPath = possibleAppPaths.find((possiblePath) => this.$fs.exists(possiblePath));
|
|
533
|
+
if (appPath) {
|
|
534
|
+
const relativeAppPath = path
|
|
535
|
+
.relative(projectDir, appPath)
|
|
536
|
+
.replace(path.sep, "/");
|
|
537
|
+
this.$logger.trace(`Found app source at '${appPath}'.`);
|
|
538
|
+
return relativeAppPath.toString();
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
detectAppResourcesPath(projectDir, configData) {
|
|
542
|
+
if (configData.appResourcesPath) {
|
|
543
|
+
return configData.appResourcesPath;
|
|
544
|
+
}
|
|
545
|
+
const possibleAppResourcesPaths = [
|
|
546
|
+
path.resolve(projectDir, configData.appPath, constants.APP_RESOURCES_FOLDER_NAME),
|
|
547
|
+
path.resolve(projectDir, constants.APP_RESOURCES_FOLDER_NAME),
|
|
548
|
+
];
|
|
549
|
+
const appResourcesPath = possibleAppResourcesPaths.find((possiblePath) => this.$fs.exists(possiblePath));
|
|
550
|
+
if (appResourcesPath) {
|
|
551
|
+
const relativeAppResourcesPath = path
|
|
552
|
+
.relative(projectDir, appResourcesPath)
|
|
553
|
+
.replace(path.sep, "/");
|
|
554
|
+
this.$logger.trace(`Found App_Resources at '${appResourcesPath}'.`);
|
|
555
|
+
return relativeAppResourcesPath.toString();
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
runMigrateActionIfAny(dependency, projectData, loose, force = false) {
|
|
559
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
560
|
+
if (dependency.migrateAction) {
|
|
561
|
+
const shouldMigrate = force ||
|
|
562
|
+
(yield dependency.shouldMigrateAction.bind(this)(dependency, projectData, loose));
|
|
563
|
+
if (shouldMigrate) {
|
|
564
|
+
const newDependencies = yield dependency.migrateAction(projectData, path.join(projectData.projectDir, MigrateController.backupFolderName));
|
|
565
|
+
for (const newDependency of newDependencies) {
|
|
566
|
+
yield this.migrateDependency(newDependency, projectData, loose);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
migrateDependencies(projectData, platforms, loose) {
|
|
573
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
574
|
+
for (let i = 0; i < this.migrationDependencies.length; i++) {
|
|
575
|
+
const dependency = this.migrationDependencies[i];
|
|
576
|
+
const hasDependency = this.hasDependency(dependency, projectData);
|
|
577
|
+
if (!hasDependency && !dependency.shouldAddIfMissing) {
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
yield this.runMigrateActionIfAny(dependency, projectData, loose);
|
|
581
|
+
yield this.migrateDependency(dependency, projectData, loose);
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
migrateDependency(dependency, projectData, loose) {
|
|
586
|
+
var _a, _b, _c, _d, _e;
|
|
587
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
588
|
+
const hasDependency = this.hasDependency(dependency, projectData);
|
|
589
|
+
if (hasDependency && dependency.warning) {
|
|
590
|
+
this.$logger.warn(dependency.warning);
|
|
591
|
+
}
|
|
592
|
+
if (!hasDependency) {
|
|
593
|
+
if (!dependency.shouldAddIfMissing) {
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
const version = (_a = dependency.desiredVersion) !== null && _a !== void 0 ? _a : dependency.minVersion;
|
|
597
|
+
this.$pluginsService.addToPackageJson(dependency.packageName, version, dependency.isDev, projectData.projectDir);
|
|
598
|
+
this.spinner.clear();
|
|
599
|
+
this.$logger.info(` - ${color_1.color.yellow(dependency.packageName)} ${color_1.color.green(version)} has been added`);
|
|
600
|
+
this.spinner.render();
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
if (dependency.replaceWith || dependency.shouldRemove) {
|
|
604
|
+
this.$pluginsService.removeFromPackageJson(dependency.packageName, projectData.projectDir);
|
|
605
|
+
if (!dependency.replaceWith) {
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
const replacementDep = _.find(this.migrationDependencies, (migrationPackage) => migrationPackage.packageName === dependency.replaceWith);
|
|
609
|
+
if (!replacementDep) {
|
|
610
|
+
this.$errors.fail("Failed to find replacement dependency.");
|
|
611
|
+
}
|
|
612
|
+
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;
|
|
613
|
+
this.$pluginsService.addToPackageJson(replacementDep.packageName, version, replacementDep.isDev, projectData.projectDir);
|
|
614
|
+
this.spinner.clear();
|
|
615
|
+
this.$logger.info(` - ${color_1.color.yellow(dependency.packageName)} has been replaced with ${color_1.color.cyan(replacementDep.packageName)} ${color_1.color.green(version)}`);
|
|
616
|
+
this.spinner.render();
|
|
617
|
+
yield this.runMigrateActionIfAny(replacementDep, projectData, loose, true);
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
const shouldMigrateVersion = yield this.shouldMigrateDependencyVersion(dependency, projectData, loose);
|
|
621
|
+
if (!shouldMigrateVersion) {
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
const version = (_e = dependency.desiredVersion) !== null && _e !== void 0 ? _e : dependency.minVersion;
|
|
625
|
+
this.$pluginsService.addToPackageJson(dependency.packageName, version, dependency.isDev, projectData.projectDir);
|
|
626
|
+
this.spinner.clear();
|
|
627
|
+
this.$logger.info(` - ${color_1.color.yellow(dependency.packageName)} has been updated to ${color_1.color.green(version)}`);
|
|
628
|
+
this.spinner.render();
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
migrateConfigs(projectDir) {
|
|
632
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
633
|
+
const projectData = this.$projectDataService.getProjectData(projectDir);
|
|
634
|
+
const rootPackageJsonPath = path.resolve(projectDir, constants.PACKAGE_JSON_FILE_NAME);
|
|
635
|
+
const embeddedPackageJsonPath = path.resolve(projectData.projectDir, projectData.getAppDirectoryRelativePath(), constants.PACKAGE_JSON_FILE_NAME);
|
|
636
|
+
const legacyNsConfigPath = path.resolve(projectData.projectDir, constants.CONFIG_NS_FILE_NAME);
|
|
637
|
+
let rootPackageJsonData = {};
|
|
638
|
+
if (this.$fs.exists(rootPackageJsonPath)) {
|
|
639
|
+
rootPackageJsonData = this.$fs.readJson(rootPackageJsonPath);
|
|
640
|
+
}
|
|
641
|
+
const newConfigPath = this.$projectConfigService.writeDefaultConfig(projectData.projectDir);
|
|
642
|
+
this.$projectConfigService.setForceUsingLegacyConfig(true);
|
|
643
|
+
const configData = this.$projectConfigService.readConfig(projectData.projectDir);
|
|
644
|
+
this.$projectConfigService.setForceUsingLegacyConfig(false);
|
|
645
|
+
if (configData.main) {
|
|
646
|
+
rootPackageJsonData.main = configData.main;
|
|
647
|
+
delete configData.main;
|
|
648
|
+
}
|
|
649
|
+
configData.appPath = this.detectAppPath(projectDir, configData);
|
|
650
|
+
configData.appResourcesPath = this.detectAppResourcesPath(projectDir, configData);
|
|
651
|
+
if (rootPackageJsonData.nativescript) {
|
|
652
|
+
delete rootPackageJsonData.nativescript;
|
|
653
|
+
}
|
|
654
|
+
this.$projectConfigService.setForceUsingNewConfig(true);
|
|
655
|
+
const hasUpdatedConfigSuccessfully = yield this.$projectConfigService.setValue("", configData);
|
|
656
|
+
if (!hasUpdatedConfigSuccessfully) {
|
|
657
|
+
if (typeof newConfigPath === "string") {
|
|
658
|
+
yield this.$projectCleanupService.cleanPath(newConfigPath);
|
|
659
|
+
}
|
|
660
|
+
this.$errors.fail(`Failed to migrate project to use ${constants.CONFIG_FILE_NAME_TS}. One or more values could not be updated.`);
|
|
661
|
+
}
|
|
662
|
+
this.$fs.writeJson(rootPackageJsonPath, rootPackageJsonData);
|
|
663
|
+
yield this.$projectCleanupService.cleanPath(embeddedPackageJsonPath);
|
|
664
|
+
yield this.$projectCleanupService.cleanPath(legacyNsConfigPath);
|
|
665
|
+
return true;
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
migrateUnitTestRunner(projectData, migrationBackupDirPath) {
|
|
669
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
670
|
+
const pathToKarmaConfig = path.join(migrationBackupDirPath, constants.KARMA_CONFIG_NAME);
|
|
671
|
+
if (this.$fs.exists(pathToKarmaConfig)) {
|
|
672
|
+
const oldKarmaContent = this.$fs.readText(pathToKarmaConfig);
|
|
673
|
+
const regExp = /frameworks:\s+\[([\S\s]*?)\]/g;
|
|
674
|
+
const matches = regExp.exec(oldKarmaContent);
|
|
675
|
+
const frameworks = (matches && matches[1] && matches[1].trim()) || '["jasmine"]';
|
|
676
|
+
const testsDir = path.join(projectData.appDirectoryPath, "tests");
|
|
677
|
+
const relativeTestsDir = path.relative(projectData.projectDir, testsDir);
|
|
678
|
+
const testFiles = `'${(0, helpers_1.fromWindowsRelativePathToUnix)(relativeTestsDir)}/**/*.*'`;
|
|
679
|
+
const karmaConfTemplate = this.$resources.readText("test/karma.conf.js");
|
|
680
|
+
const karmaConf = _.template(karmaConfTemplate)({
|
|
681
|
+
frameworks,
|
|
682
|
+
testFiles,
|
|
683
|
+
basePath: projectData.getAppDirectoryRelativePath(),
|
|
684
|
+
});
|
|
685
|
+
this.$fs.writeFile(path.join(projectData.projectDir, constants.KARMA_CONFIG_NAME), karmaConf);
|
|
686
|
+
}
|
|
687
|
+
const dependencies = [
|
|
688
|
+
{
|
|
689
|
+
packageName: "karma-webpack",
|
|
690
|
+
shouldRemove: true,
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
packageName: "karma-jasmine",
|
|
694
|
+
minVersion: "2.0.1",
|
|
695
|
+
desiredVersion: "~4.0.1",
|
|
696
|
+
isDev: true,
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
packageName: "karma-mocha",
|
|
700
|
+
minVersion: "1.3.0",
|
|
701
|
+
desiredVersion: "~2.0.1",
|
|
702
|
+
isDev: true,
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
packageName: "karma-chai",
|
|
706
|
+
minVersion: "0.1.0",
|
|
707
|
+
desiredVersion: "~0.1.0",
|
|
708
|
+
isDev: true,
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
packageName: "karma-qunit",
|
|
712
|
+
minVersion: "3.1.2",
|
|
713
|
+
desiredVersion: "~4.1.2",
|
|
714
|
+
isDev: true,
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
packageName: "karma",
|
|
718
|
+
minVersion: "4.1.0",
|
|
719
|
+
desiredVersion: "~6.3.4",
|
|
720
|
+
isDev: true,
|
|
721
|
+
},
|
|
722
|
+
];
|
|
723
|
+
return dependencies;
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
migrateTSConfig({ tsConfigPath, isAngular, polyfillsPath, }) {
|
|
727
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
728
|
+
try {
|
|
729
|
+
const configContents = this.$fs.readJson(tsConfigPath);
|
|
730
|
+
configContents.compilerOptions = configContents.compilerOptions || {};
|
|
731
|
+
configContents.compilerOptions.target = "es2020";
|
|
732
|
+
configContents.compilerOptions.module = "esnext";
|
|
733
|
+
configContents.compilerOptions.moduleResolution = "node";
|
|
734
|
+
configContents.compilerOptions.experimentalDecorators = true;
|
|
735
|
+
configContents.compilerOptions.removeComments = false;
|
|
736
|
+
configContents.compilerOptions.lib = [
|
|
737
|
+
...new Set([...(configContents.compilerOptions.lib || []), "ESNext"]),
|
|
738
|
+
];
|
|
739
|
+
if (isAngular) {
|
|
740
|
+
if (configContents.files) {
|
|
741
|
+
configContents.files = [
|
|
742
|
+
...new Set([
|
|
743
|
+
...(configContents.files || []),
|
|
744
|
+
polyfillsPath !== null && polyfillsPath !== void 0 ? polyfillsPath : "./src/polyfills.ts",
|
|
745
|
+
]),
|
|
746
|
+
];
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
this.$fs.writeJson(tsConfigPath, configContents);
|
|
750
|
+
return true;
|
|
751
|
+
}
|
|
752
|
+
catch (error) {
|
|
753
|
+
this.$logger.trace("Failed to migrate tsconfig.json. Error is: ", error);
|
|
754
|
+
return false;
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
checkOrCreatePolyfillsTS(projectData) {
|
|
759
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
760
|
+
const { projectDir, appDirectoryPath } = projectData;
|
|
761
|
+
const possiblePaths = [
|
|
762
|
+
`${appDirectoryPath}/polyfills.ts`,
|
|
763
|
+
`./src/polyfills.ts`,
|
|
764
|
+
`./app/polyfills.ts`,
|
|
765
|
+
].map((possiblePath) => path.resolve(projectDir, possiblePath));
|
|
766
|
+
let polyfillsPath = possiblePaths.find((possiblePath) => {
|
|
767
|
+
return this.$fs.exists(possiblePath);
|
|
768
|
+
});
|
|
769
|
+
if (polyfillsPath) {
|
|
770
|
+
return "./" + path.relative(projectDir, polyfillsPath);
|
|
771
|
+
}
|
|
772
|
+
const tempDir = temp.mkdirSync({
|
|
773
|
+
prefix: "migrate-angular-polyfills",
|
|
774
|
+
});
|
|
775
|
+
yield this.$pacoteService.extractPackage(constants.RESERVED_TEMPLATE_NAMES["angular"], tempDir);
|
|
776
|
+
this.$fs.copyFile(path.resolve(tempDir, "src/polyfills.ts"), possiblePaths[0]);
|
|
777
|
+
this.$fs.deleteDirectory(tempDir);
|
|
778
|
+
this.spinner.succeed(`Created fresh ${color_1.color.cyan("polyfills.ts")}`);
|
|
779
|
+
return "./" + path.relative(projectDir, possiblePaths[0]);
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
migrateNativeScriptAngular() {
|
|
783
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
784
|
+
const minVersion = "10.0.0";
|
|
785
|
+
const desiredVersion = "~17.3.0";
|
|
786
|
+
const dependencies = [
|
|
787
|
+
{
|
|
788
|
+
packageName: "@angular/animations",
|
|
789
|
+
minVersion,
|
|
790
|
+
desiredVersion,
|
|
791
|
+
shouldAddIfMissing: true,
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
packageName: "@angular/common",
|
|
795
|
+
minVersion,
|
|
796
|
+
desiredVersion,
|
|
797
|
+
shouldAddIfMissing: true,
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
packageName: "@angular/compiler",
|
|
801
|
+
minVersion,
|
|
802
|
+
desiredVersion,
|
|
803
|
+
shouldAddIfMissing: true,
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
packageName: "@angular/core",
|
|
807
|
+
minVersion,
|
|
808
|
+
desiredVersion,
|
|
809
|
+
shouldAddIfMissing: true,
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
packageName: "@angular/forms",
|
|
813
|
+
minVersion,
|
|
814
|
+
desiredVersion,
|
|
815
|
+
shouldAddIfMissing: true,
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
packageName: "@angular/platform-browser",
|
|
819
|
+
minVersion,
|
|
820
|
+
desiredVersion,
|
|
821
|
+
shouldAddIfMissing: true,
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
packageName: "@angular/platform-browser-dynamic",
|
|
825
|
+
minVersion,
|
|
826
|
+
desiredVersion,
|
|
827
|
+
shouldAddIfMissing: true,
|
|
828
|
+
},
|
|
829
|
+
{
|
|
830
|
+
packageName: "@angular/router",
|
|
831
|
+
minVersion,
|
|
832
|
+
desiredVersion,
|
|
833
|
+
shouldAddIfMissing: true,
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
packageName: "rxjs",
|
|
837
|
+
minVersion: "6.6.0",
|
|
838
|
+
desiredVersion: "~7.8.0",
|
|
839
|
+
shouldAddIfMissing: true,
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
packageName: "zone.js",
|
|
843
|
+
minVersion: "0.11.1",
|
|
844
|
+
desiredVersion: "~0.14.0",
|
|
845
|
+
shouldAddIfMissing: true,
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
packageName: "@angular/cli",
|
|
849
|
+
minVersion,
|
|
850
|
+
desiredVersion,
|
|
851
|
+
isDev: true,
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
packageName: "@angular/compiler-cli",
|
|
855
|
+
minVersion,
|
|
856
|
+
desiredVersion,
|
|
857
|
+
isDev: true,
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
packageName: "@ngtools/webpack",
|
|
861
|
+
minVersion,
|
|
862
|
+
desiredVersion,
|
|
863
|
+
isDev: true,
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
packageName: "@angular-devkit/build-angular",
|
|
867
|
+
minVersion,
|
|
868
|
+
desiredVersion,
|
|
869
|
+
isDev: true,
|
|
870
|
+
},
|
|
871
|
+
];
|
|
872
|
+
return dependencies;
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
migrateNativeScriptVue() {
|
|
876
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
877
|
+
const dependencies = [
|
|
878
|
+
{
|
|
879
|
+
packageName: "nativescript-vue-template-compiler",
|
|
880
|
+
minVersion: "2.7.0",
|
|
881
|
+
desiredVersion: "~2.9.3",
|
|
882
|
+
isDev: true,
|
|
883
|
+
shouldAddIfMissing: true,
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
packageName: "nativescript-vue-devtools",
|
|
887
|
+
minVersion: "1.4.0",
|
|
888
|
+
desiredVersion: "~1.5.1",
|
|
889
|
+
isDev: true,
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
packageName: "vue-loader",
|
|
893
|
+
shouldRemove: true,
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
packageName: "babel-loader",
|
|
897
|
+
shouldRemove: true,
|
|
898
|
+
},
|
|
899
|
+
{
|
|
900
|
+
packageName: "babel-traverse",
|
|
901
|
+
shouldRemove: true,
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
packageName: "babel-types",
|
|
905
|
+
shouldRemove: true,
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
packageName: "babylon",
|
|
909
|
+
shouldRemove: true,
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
packageName: "@babel/core",
|
|
913
|
+
shouldRemove: true,
|
|
914
|
+
},
|
|
915
|
+
{
|
|
916
|
+
packageName: "@babel/preset-env",
|
|
917
|
+
shouldRemove: true,
|
|
918
|
+
},
|
|
919
|
+
{
|
|
920
|
+
packageName: "vue",
|
|
921
|
+
shouldRemove: true,
|
|
922
|
+
},
|
|
923
|
+
{
|
|
924
|
+
packageName: "vue",
|
|
925
|
+
desiredVersion: "2.6.12",
|
|
926
|
+
isDev: true,
|
|
927
|
+
},
|
|
928
|
+
];
|
|
929
|
+
return dependencies;
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
migrateNativeScriptSvelte() {
|
|
933
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
934
|
+
const dependencies = [
|
|
935
|
+
{
|
|
936
|
+
packageName: "svelte-native-nativescript-ui",
|
|
937
|
+
minVersion: "0.9.0",
|
|
938
|
+
desiredVersion: "~0.9.0",
|
|
939
|
+
isDev: true,
|
|
940
|
+
shouldAddIfMissing: true,
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
packageName: "svelte-native-preprocessor",
|
|
944
|
+
minVersion: "0.2.0",
|
|
945
|
+
desiredVersion: "~0.2.0",
|
|
946
|
+
isDev: true,
|
|
947
|
+
shouldAddIfMissing: true,
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
packageName: "svelte-loader",
|
|
951
|
+
shouldRemove: true,
|
|
952
|
+
},
|
|
953
|
+
{
|
|
954
|
+
packageName: "svelte-loader-hot",
|
|
955
|
+
shouldRemove: true,
|
|
956
|
+
},
|
|
957
|
+
{
|
|
958
|
+
packageName: "svelte",
|
|
959
|
+
shouldRemove: true,
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
packageName: "svelte",
|
|
963
|
+
minVersion: "3.24.1",
|
|
964
|
+
desiredVersion: "3.24.1",
|
|
965
|
+
shouldUseExactVersion: true,
|
|
966
|
+
isDev: true,
|
|
967
|
+
},
|
|
968
|
+
];
|
|
969
|
+
return dependencies;
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
migrateWebpack() {
|
|
973
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
974
|
+
const webpackDependencies = [
|
|
975
|
+
"@angular-devkit/core",
|
|
976
|
+
"clean-webpack-plugin",
|
|
977
|
+
"copy-webpack-plugin",
|
|
978
|
+
"css",
|
|
979
|
+
"css-loader",
|
|
980
|
+
"escape-string-regexp",
|
|
981
|
+
"fork-ts-checker-webpack-plugin",
|
|
982
|
+
"global-modules-path",
|
|
983
|
+
"loader-utils",
|
|
984
|
+
"minimatch",
|
|
985
|
+
"@nativescript/hook",
|
|
986
|
+
"nativescript-worker-loader",
|
|
987
|
+
"properties-reader",
|
|
988
|
+
"proxy-lib",
|
|
989
|
+
"raw-loader",
|
|
990
|
+
"resolve-url-loader",
|
|
991
|
+
"sass-loader",
|
|
992
|
+
"sax",
|
|
993
|
+
"schema-utils",
|
|
994
|
+
"semver",
|
|
995
|
+
"shelljs",
|
|
996
|
+
"tapable",
|
|
997
|
+
"terser",
|
|
998
|
+
"terser-webpack-plugin",
|
|
999
|
+
"ts-loader",
|
|
1000
|
+
"webpack",
|
|
1001
|
+
"webpack-bundle-analyzer",
|
|
1002
|
+
"webpack-cli",
|
|
1003
|
+
"webpack-sources",
|
|
1004
|
+
];
|
|
1005
|
+
return webpackDependencies.map((dep) => {
|
|
1006
|
+
return {
|
|
1007
|
+
packageName: dep,
|
|
1008
|
+
shouldRemove: true,
|
|
1009
|
+
};
|
|
1010
|
+
});
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
migrateWebpack5(projectDir, projectData) {
|
|
1014
|
+
var _a;
|
|
1015
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1016
|
+
const webpackConfigPath = path.resolve(projectDir, "webpack.config.js");
|
|
1017
|
+
if (this.$fs.exists(webpackConfigPath)) {
|
|
1018
|
+
const webpackConfigContent = this.$fs.readText(webpackConfigPath);
|
|
1019
|
+
if (webpackConfigContent.includes("webpack.init(")) {
|
|
1020
|
+
this.spinner.succeed(`Project already using new ${color_1.color.yellow("webpack.config.js")}`);
|
|
1021
|
+
return;
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
yield this.$projectCleanupService.clean(["webpack.config.js"]);
|
|
1025
|
+
this.spinner.info(`Initializing new ${color_1.color.yellow("webpack.config.js")}`);
|
|
1026
|
+
const { desiredVersion: webpackVersion } = this.migrationDependencies.find((dep) => dep.packageName === constants.WEBPACK_PLUGIN_NAME);
|
|
1027
|
+
try {
|
|
1028
|
+
const scopedWebpackPackage = constants.WEBPACK_PLUGIN_NAME;
|
|
1029
|
+
const resolvedVersion = yield this.$packageInstallationManager.getMaxSatisfyingVersion(scopedWebpackPackage, webpackVersion);
|
|
1030
|
+
yield this.runNPX([
|
|
1031
|
+
"--package",
|
|
1032
|
+
`${scopedWebpackPackage}@${resolvedVersion}`,
|
|
1033
|
+
"nativescript-webpack",
|
|
1034
|
+
"init",
|
|
1035
|
+
]);
|
|
1036
|
+
this.spinner.succeed(`Initialized new ${color_1.color.yellow("webpack.config.js")}`);
|
|
1037
|
+
}
|
|
1038
|
+
catch (err) {
|
|
1039
|
+
this.spinner.fail(`Failed to initialize ${color_1.color.yellow("webpack.config.js")}`);
|
|
1040
|
+
this.$logger.trace("Failed to initialize webpack.config.js. Error is: ", err);
|
|
1041
|
+
this.$logger.printMarkdown(`You can try again by running \`npm install\` (or yarn, pnpm) and then \`npx @nativescript/webpack init\`.`);
|
|
1042
|
+
}
|
|
1043
|
+
const packageJSON = this.$fs.readJson(projectData.projectFilePath);
|
|
1044
|
+
const currentMain = (_a = packageJSON.main) !== null && _a !== void 0 ? _a : "app.js";
|
|
1045
|
+
const currentMainTS = currentMain.replace(/.js$/, ".ts");
|
|
1046
|
+
const appPath = projectData.appDirectoryPath;
|
|
1047
|
+
const possibleMains = [
|
|
1048
|
+
`./${appPath}/${currentMain}`,
|
|
1049
|
+
`./${appPath}/${currentMainTS}`,
|
|
1050
|
+
`./${appPath}/main.js`,
|
|
1051
|
+
`./${appPath}/main.ts`,
|
|
1052
|
+
`./app/${currentMain}`,
|
|
1053
|
+
`./app/${currentMainTS}`,
|
|
1054
|
+
`./src/${currentMain}`,
|
|
1055
|
+
`./src/${currentMainTS}`,
|
|
1056
|
+
`./app/main.js`,
|
|
1057
|
+
`./app/main.ts`,
|
|
1058
|
+
`./src/main.js`,
|
|
1059
|
+
`./src/main.ts`,
|
|
1060
|
+
].map((possibleMain) => path.resolve(projectDir, possibleMain));
|
|
1061
|
+
let replacedMain = possibleMains.find((possibleMain) => {
|
|
1062
|
+
return this.$fs.exists(possibleMain);
|
|
1063
|
+
});
|
|
1064
|
+
if (replacedMain) {
|
|
1065
|
+
replacedMain = `./${path.relative(projectDir, replacedMain)}`.replace(/\\/g, "/");
|
|
1066
|
+
packageJSON.main = replacedMain;
|
|
1067
|
+
this.$fs.writeJson(projectData.projectFilePath, packageJSON);
|
|
1068
|
+
this.spinner.info(`Updated ${color_1.color.yellow("package.json")} main field to ${color_1.color.green(replacedMain)}`);
|
|
1069
|
+
}
|
|
1070
|
+
else {
|
|
1071
|
+
this.$logger.warn();
|
|
1072
|
+
this.$logger.warn("Note:\n-----");
|
|
1073
|
+
this.$logger.printMarkdown(`Could not determine the correct \`main\` field for \`package.json\`. Make sure to update it manually, pointing to the actual entry file relative to the \`package.json\`.\n`);
|
|
1074
|
+
}
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
runESLint(projectDir) {
|
|
1078
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1079
|
+
this.spinner.start(`Running ESLint fixes`);
|
|
1080
|
+
try {
|
|
1081
|
+
yield this.runNPX(["@nativescript/eslint-plugin", projectDir]);
|
|
1082
|
+
this.spinner.succeed(`Applied ESLint fixes`);
|
|
1083
|
+
}
|
|
1084
|
+
catch (err) {
|
|
1085
|
+
this.spinner.fail(`Failed to apply ESLint fixes`);
|
|
1086
|
+
this.$logger.trace("Failed to apply ESLint fixes. Error is:", err);
|
|
1087
|
+
}
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
runNPX(args = []) {
|
|
1091
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1092
|
+
const npxVersion = yield this.$childProcess.exec("npx -v");
|
|
1093
|
+
const npxFlags = [];
|
|
1094
|
+
if (semver.gt(semver.coerce(npxVersion), "7.0.0")) {
|
|
1095
|
+
npxFlags.push("-y");
|
|
1096
|
+
}
|
|
1097
|
+
const args_ = ["npx", ...npxFlags, ...args];
|
|
1098
|
+
yield this.$childProcess.exec(args_.join(" "));
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
MigrateController.backupFolderName = ".migration_backup";
|
|
1103
|
+
MigrateController.pathsToBackup = [
|
|
1104
|
+
constants.LIB_DIR_NAME,
|
|
1105
|
+
constants.HOOKS_DIR_NAME,
|
|
1106
|
+
constants.WEBPACK_CONFIG_NAME,
|
|
1107
|
+
constants.PACKAGE_JSON_FILE_NAME,
|
|
1108
|
+
constants.PACKAGE_LOCK_JSON_FILE_NAME,
|
|
1109
|
+
constants.TSCCONFIG_TNS_JSON_NAME,
|
|
1110
|
+
constants.KARMA_CONFIG_NAME,
|
|
1111
|
+
constants.CONFIG_NS_FILE_NAME,
|
|
1112
|
+
];
|
|
1113
|
+
exports.MigrateController = MigrateController;
|
|
1114
|
+
yok_1.injector.register("migrateController", MigrateController);
|