nativescript 9.0.0-alpha.13 → 9.0.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/test-deps-versions-generated.json +2 -2
- package/docs/build-jekyll-md.sh +1 -1
- package/docs/man_pages/config/config-get.md +36 -0
- package/docs/man_pages/config/config-set.md +40 -0
- package/docs/man_pages/config/config.md +39 -0
- package/docs/man_pages/project/hooks/hooks.md +35 -0
- package/docs/man_pages/start.md +1 -0
- package/lib/.d.ts +4 -0
- package/lib/android-tools-info.js +12 -0
- package/lib/base-package-manager.js +7 -0
- package/lib/bootstrap.js +7 -1
- package/lib/bun-package-manager.js +14 -1
- package/lib/color.js +4 -0
- package/lib/commands/add-platform.js +1 -0
- package/lib/commands/apple-login.js +1 -0
- package/lib/commands/appstore-list.js +1 -0
- package/lib/commands/appstore-upload.js +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 +5 -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/hooks/common.js +80 -0
- package/lib/commands/hooks/hooks-lock.js +101 -0
- package/lib/commands/hooks/hooks.js +72 -0
- 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 +20 -1
- 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/definitions/extensibility.d.ts +2 -2
- package/lib/common/definitions/mobile.d.ts +72 -72
- 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 +90 -4
- 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/definitions/hooks.d.ts +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 +11 -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 +10 -5
- package/lib/services/build-artifacts-service.js +2 -1
- package/lib/services/build-data-service.js +1 -0
- package/lib/services/build-info-file-service.js +1 -0
- package/lib/services/bundler/bundler-compiler-service.js +88 -17
- package/lib/services/bundler/bundler.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 +9 -1
- 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 +21 -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 +3 -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/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 +11 -10
- package/vendor/aab-tool/README.txt +1 -1
- package/vendor/aab-tool/bundletool.jar +0 -0
- package/vendor/gradle-plugin/build.gradle +1 -1
|
@@ -12,7 +12,11 @@ const constants_1 = require("../../constants");
|
|
|
12
12
|
const decorators_1 = require("../../common/decorators");
|
|
13
13
|
const yok_1 = require("../../common/yok");
|
|
14
14
|
class AddPlatformService {
|
|
15
|
-
constructor($fs, $logger, $options,
|
|
15
|
+
constructor($fs, $logger, $options,
|
|
16
|
+
// private $pacoteService: IPacoteService,
|
|
17
|
+
// private $projectDataService: IProjectDataService,
|
|
18
|
+
$packageManager, $terminalSpinnerService, $analyticsService // private $tempService: ITempService
|
|
19
|
+
) {
|
|
16
20
|
this.$fs = $fs;
|
|
17
21
|
this.$logger = $logger;
|
|
18
22
|
this.$options = $options;
|
|
@@ -25,9 +29,13 @@ class AddPlatformService {
|
|
|
25
29
|
const spinner = this.$terminalSpinnerService.createSpinner();
|
|
26
30
|
try {
|
|
27
31
|
spinner.start();
|
|
32
|
+
// const frameworkDirPath = addPlatformData.frameworkPath ?
|
|
33
|
+
// await this.extractPackage(packageToInstall)
|
|
34
|
+
// : await this.installPackage(projectData.projectDir, packageToInstall);
|
|
28
35
|
const frameworkDirPath = await this.installPackage(projectData.projectDir, packageToInstall);
|
|
29
36
|
const frameworkPackageJsonContent = this.$fs.readJson(path.join(frameworkDirPath, "..", "package.json"));
|
|
30
37
|
const frameworkVersion = frameworkPackageJsonContent.version;
|
|
38
|
+
// await this.setPlatformVersion(platformData, projectData, frameworkVersion);
|
|
31
39
|
await this.trackPlatformVersion(frameworkVersion, platformData);
|
|
32
40
|
if (!addPlatformData.nativePrepare ||
|
|
33
41
|
!addPlatformData.nativePrepare.skipNativePrepare) {
|
|
@@ -47,9 +55,21 @@ class AddPlatformService {
|
|
|
47
55
|
async setPlatformVersion(platformData, projectData, frameworkVersion) {
|
|
48
56
|
await this.installPackage(projectData.projectDir, `${platformData.frameworkPackageName}@${frameworkVersion}`);
|
|
49
57
|
}
|
|
58
|
+
// private async extractPackage(pkg: string): Promise<string> {
|
|
59
|
+
// const downloadedPackagePath = await this.$tempService.mkdirSync(
|
|
60
|
+
// "runtimeDir"
|
|
61
|
+
// );
|
|
62
|
+
// await this.$pacoteService.extractPackage(pkg, downloadedPackagePath);
|
|
63
|
+
// const frameworkDir = path.join(
|
|
64
|
+
// downloadedPackagePath,
|
|
65
|
+
// PROJECT_FRAMEWORK_FOLDER_NAME
|
|
66
|
+
// );
|
|
67
|
+
// return path.resolve(frameworkDir);
|
|
68
|
+
// }
|
|
50
69
|
async installPackage(projectDir, packageName) {
|
|
51
70
|
const frameworkDir = this.resolveFrameworkDir(projectDir, packageName);
|
|
52
71
|
if (frameworkDir && this.$fs.exists(frameworkDir)) {
|
|
72
|
+
// don't install if it's already installed
|
|
53
73
|
return frameworkDir;
|
|
54
74
|
}
|
|
55
75
|
const installedPackage = await this.$packageManager.install(packageName, projectDir, {
|
|
@@ -65,6 +85,30 @@ class AddPlatformService {
|
|
|
65
85
|
}
|
|
66
86
|
resolveFrameworkDir(projectDir, packageName) {
|
|
67
87
|
try {
|
|
88
|
+
// strip version info if present <package>@1.2.3-rc.0 -> <package>
|
|
89
|
+
// tested cases:
|
|
90
|
+
// @nativescript/ios
|
|
91
|
+
// @nativescript/ios@1
|
|
92
|
+
// @nativescript/ios@1.2
|
|
93
|
+
// @nativescript/ios@1.2.3
|
|
94
|
+
// @nativescript/ios@1.2.3-
|
|
95
|
+
// @nativescript/ios@1.2.3-rc
|
|
96
|
+
// @nativescript/ios@1.2.3-rc.
|
|
97
|
+
// @nativescript/ios@1.2.3-rc.0
|
|
98
|
+
// @nativescript/ios@rc
|
|
99
|
+
// @nativescript/ios@^7.0.0
|
|
100
|
+
// @nativescript/ios@~7.0.0
|
|
101
|
+
// tns-ios
|
|
102
|
+
// tns-ios@1
|
|
103
|
+
// tns-ios@1.2
|
|
104
|
+
// tns-ios@1.2.3
|
|
105
|
+
// tns-ios@1.2.3-
|
|
106
|
+
// tns-ios@1.2.3-rc
|
|
107
|
+
// tns-ios@1.2.3-rc.
|
|
108
|
+
// tns-ios@1.2.3-rc.0
|
|
109
|
+
// tns-ios@rc
|
|
110
|
+
// tns-ios@^7.0.0
|
|
111
|
+
// tns-ios@~7.0.0
|
|
68
112
|
packageName = packageName.replace(/(.+)@.+$/g, "$1");
|
|
69
113
|
const frameworkDir = require
|
|
70
114
|
.resolve(`${packageName}/package.json`, {
|
|
@@ -82,8 +126,10 @@ class AddPlatformService {
|
|
|
82
126
|
}
|
|
83
127
|
async addNativePlatform(platformData, projectData, frameworkDirPath, frameworkVersion) {
|
|
84
128
|
var _a;
|
|
129
|
+
// here we should use ios OR android
|
|
85
130
|
const platformDir = (_a = this.$options.hostProjectPath) !== null && _a !== void 0 ? _a : path.join(projectData.platformsDir, platformData.normalizedPlatformName.toLowerCase());
|
|
86
131
|
this.$fs.deleteDirectory(platformDir);
|
|
132
|
+
//if iosHost - dont create project
|
|
87
133
|
await platformData.platformProjectService.createProject(path.resolve(frameworkDirPath), frameworkVersion, projectData);
|
|
88
134
|
platformData.platformProjectService.ensureConfigurationFileInAppResources(projectData);
|
|
89
135
|
await platformData.platformProjectService.interpolateData(projectData);
|
|
@@ -91,7 +137,7 @@ class AddPlatformService {
|
|
|
91
137
|
}
|
|
92
138
|
async trackPlatformVersion(frameworkVersion, platformData) {
|
|
93
139
|
await this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
94
|
-
action: "Add Platform"
|
|
140
|
+
action: "Add Platform" /* TrackActionNames.AddPlatform */,
|
|
95
141
|
additionalData: `${platformData.platformNameLowerCase}${constants_1.AnalyticsEventLabelDelimiter}${frameworkVersion}`,
|
|
96
142
|
});
|
|
97
143
|
}
|
|
@@ -101,3 +147,4 @@ __decorate([
|
|
|
101
147
|
(0, decorators_1.performanceLog)()
|
|
102
148
|
], AddPlatformService.prototype, "addNativePlatform", null);
|
|
103
149
|
yok_1.injector.register("addPlatformService", AddPlatformService);
|
|
150
|
+
//# sourceMappingURL=add-platform-service.js.map
|
|
@@ -49,17 +49,19 @@ class PrepareNativePlatformService {
|
|
|
49
49
|
this.$metadataFilteringService.generateMetadataFilters(projectData, platformData.platformNameLowerCase);
|
|
50
50
|
}
|
|
51
51
|
platformData.platformProjectService.interpolateConfigurationFile(projectData);
|
|
52
|
-
await this.$projectChangesService.setNativePlatformStatus(platformData, projectData, { nativePlatformStatus: "3" });
|
|
52
|
+
await this.$projectChangesService.setNativePlatformStatus(platformData, projectData, { nativePlatformStatus: "3" /* NativePlatformStatus.alreadyPrepared */ });
|
|
53
53
|
return hasChanges;
|
|
54
54
|
}
|
|
55
55
|
async cleanProject(platformData, options) {
|
|
56
|
+
// android build artifacts need to be cleaned up
|
|
57
|
+
// when switching between debug, release and webpack builds
|
|
56
58
|
if (platformData.platformNameLowerCase !== "android") {
|
|
57
59
|
return;
|
|
58
60
|
}
|
|
59
61
|
const previousPrepareInfo = this.$projectChangesService.getPrepareInfo(platformData);
|
|
60
62
|
if (!previousPrepareInfo ||
|
|
61
63
|
previousPrepareInfo.nativePlatformStatus !==
|
|
62
|
-
"3") {
|
|
64
|
+
"3" /* NativePlatformStatus.alreadyPrepared */) {
|
|
63
65
|
return;
|
|
64
66
|
}
|
|
65
67
|
const { release: previousWasRelease } = previousPrepareInfo;
|
|
@@ -75,3 +77,4 @@ __decorate([
|
|
|
75
77
|
(0, helpers_1.hook)("prepareNativeApp")
|
|
76
78
|
], PrepareNativePlatformService.prototype, "prepareNativePlatform", null);
|
|
77
79
|
yok_1.injector.register("prepareNativePlatformService", PrepareNativePlatformService);
|
|
80
|
+
//# sourceMappingURL=prepare-native-platform-service.js.map
|
|
@@ -11,7 +11,9 @@ const helpers_1 = require("../common/helpers");
|
|
|
11
11
|
const os_1 = require("os");
|
|
12
12
|
const yok_1 = require("../common/yok");
|
|
13
13
|
class PlatformEnvironmentRequirements {
|
|
14
|
-
constructor($doctorService, $errors, $analyticsService,
|
|
14
|
+
constructor($doctorService, $errors, $analyticsService,
|
|
15
|
+
// @ts-ignore - required by the hook helper!
|
|
16
|
+
$injector) {
|
|
15
17
|
this.$doctorService = $doctorService;
|
|
16
18
|
this.$errors = $errors;
|
|
17
19
|
this.$analyticsService = $analyticsService;
|
|
@@ -22,7 +24,7 @@ class PlatformEnvironmentRequirements {
|
|
|
22
24
|
const selectedOption = null;
|
|
23
25
|
if (process.env.NS_SKIP_ENV_CHECK) {
|
|
24
26
|
await this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
25
|
-
action: "Check Environment Requirements"
|
|
27
|
+
action: "Check Environment Requirements" /* TrackActionNames.CheckEnvironmentRequirements */,
|
|
26
28
|
additionalData: "Skipped: NS_SKIP_ENV_CHECK is set",
|
|
27
29
|
});
|
|
28
30
|
return {
|
|
@@ -37,8 +39,9 @@ class PlatformEnvironmentRequirements {
|
|
|
37
39
|
forceCheck: input.forceCheck,
|
|
38
40
|
});
|
|
39
41
|
if (!canExecute) {
|
|
42
|
+
// if (!isInteractive()) {
|
|
40
43
|
await this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
41
|
-
action: "Check Environment Requirements"
|
|
44
|
+
action: "Check Environment Requirements" /* TrackActionNames.CheckEnvironmentRequirements */,
|
|
42
45
|
additionalData: "Non-interactive terminal, unable to execute local builds.",
|
|
43
46
|
});
|
|
44
47
|
this.fail(this.getNonInteractiveConsoleMessage(platform));
|
|
@@ -58,6 +61,7 @@ class PlatformEnvironmentRequirements {
|
|
|
58
61
|
].join(os_1.EOL);
|
|
59
62
|
}
|
|
60
63
|
getEnvVerificationMessage(platform) {
|
|
64
|
+
// map process.platform to OS name used in docs
|
|
61
65
|
const os = {
|
|
62
66
|
linux: "linux",
|
|
63
67
|
win32: "windows",
|
|
@@ -76,3 +80,4 @@ __decorate([
|
|
|
76
80
|
(0, helpers_1.hook)("checkEnvironment")
|
|
77
81
|
], PlatformEnvironmentRequirements.prototype, "checkEnvironmentRequirements", null);
|
|
78
82
|
yok_1.injector.register("platformEnvironmentRequirements", PlatformEnvironmentRequirements);
|
|
83
|
+
//# sourceMappingURL=platform-environment-requirements.js.map
|
|
@@ -54,6 +54,7 @@ class PluginsService {
|
|
|
54
54
|
const realNpmPackageJson = this.$fs.readJson(pathToRealNpmPackageJson);
|
|
55
55
|
if (realNpmPackageJson.nativescript) {
|
|
56
56
|
const pluginData = this.convertToPluginData(realNpmPackageJson, projectData.projectDir);
|
|
57
|
+
// Validate
|
|
57
58
|
const action = async (pluginDestinationPath, platform, platformData) => {
|
|
58
59
|
this.isPluginDataValidForPlatform(pluginData, platform, projectData);
|
|
59
60
|
};
|
|
@@ -136,6 +137,9 @@ class PluginsService {
|
|
|
136
137
|
paths: [projectData.projectDir],
|
|
137
138
|
});
|
|
138
139
|
if (pathToPackage) {
|
|
140
|
+
// return false if the dependency is installed - we'll filter out boolean values
|
|
141
|
+
// and end up with an array of dep names that are not installed if we end up
|
|
142
|
+
// inside the catch block.
|
|
139
143
|
return false;
|
|
140
144
|
}
|
|
141
145
|
this.$logger.trace(`${dep} is not installed, or couldn't be found`);
|
|
@@ -168,6 +172,9 @@ class PluginsService {
|
|
|
168
172
|
return productionPlugins
|
|
169
173
|
.map((plugin) => this.convertToPluginData(plugin, projectData.projectDir))
|
|
170
174
|
.filter((item, idx, self) => {
|
|
175
|
+
// Filter out duplicates to speed up build times by not building the same dependency
|
|
176
|
+
// multiple times. One possible downside is that if there are different versions
|
|
177
|
+
// of the same native dependency only the first one in the array will be built
|
|
171
178
|
return self.findIndex((p) => p.name === item.name) === idx;
|
|
172
179
|
});
|
|
173
180
|
}
|
|
@@ -199,9 +206,11 @@ class PluginsService {
|
|
|
199
206
|
const dependenciesGroupedByName = _.groupBy(productionDependencies, (p) => p.name);
|
|
200
207
|
_.each(dependenciesGroupedByName, (dependencyOccurrences, dependencyName) => {
|
|
201
208
|
if (dependencyOccurrences.length > 1) {
|
|
209
|
+
// the dependency exists multiple times in node_modules
|
|
202
210
|
const dependencyOccurrencesGroupedByVersion = _.groupBy(dependencyOccurrences, (g) => g.version);
|
|
203
211
|
const versions = _.keys(dependencyOccurrencesGroupedByVersion);
|
|
204
212
|
if (versions.length === 1) {
|
|
213
|
+
// all dependencies with this name have the same version
|
|
205
214
|
this.$logger.trace(`Detected same versions (${_.first(versions)}) of the ${dependencyName} installed at locations: ${_.map(dependencyOccurrences, (d) => d.directory).join(", ")}`);
|
|
206
215
|
}
|
|
207
216
|
else {
|
|
@@ -231,9 +240,11 @@ class PluginsService {
|
|
|
231
240
|
const dependenciesGroupedByFrameworkName = _.groupBy(dependenciesWithFrameworks, (d) => d.frameworkName);
|
|
232
241
|
_.each(dependenciesGroupedByFrameworkName, (dependencyOccurrences, frameworkName) => {
|
|
233
242
|
if (dependencyOccurrences.length > 1) {
|
|
243
|
+
// A framework exists multiple times in node_modules
|
|
234
244
|
const groupedByName = _.groupBy(dependencyOccurrences, (d) => d.name);
|
|
235
245
|
const pluginsNames = _.keys(groupedByName);
|
|
236
246
|
if (pluginsNames.length > 1) {
|
|
247
|
+
// fail - the same framework is installed by different dependencies.
|
|
237
248
|
const locations = dependencyOccurrences.map((d) => d.frameworkLocation);
|
|
238
249
|
let msg = `Detected the framework ${frameworkName} is installed from multiple plugins at locations:\n${locations.join("\n")}\n`;
|
|
239
250
|
msg += this.getHelpMessage(projectDir);
|
|
@@ -243,6 +254,7 @@ class PluginsService {
|
|
|
243
254
|
const dependencyOccurrencesGroupedByVersion = _.groupBy(dependencyOccurrences, (g) => g.version);
|
|
244
255
|
const versions = _.keys(dependencyOccurrencesGroupedByVersion);
|
|
245
256
|
if (versions.length === 1) {
|
|
257
|
+
// all dependencies with this name have the same version
|
|
246
258
|
this.$logger.warn(`Detected the framework ${frameworkName} is installed multiple times from the same versions of plugin (${_.first(versions)}) at locations: ${_.map(dependencyOccurrences, (d) => d.directory).join(", ")}`);
|
|
247
259
|
const selectedPackage = _.minBy(dependencyOccurrences, (d) => d.depth);
|
|
248
260
|
this.$logger.info(color_1.color.green(`CLI will use only the native code from '${selectedPackage.directory}'.`));
|
|
@@ -294,7 +306,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
294
306
|
pluginData.isPlugin = !!cacheData.nativescript;
|
|
295
307
|
pluginData.pluginPlatformsFolderPath = (platform) => {
|
|
296
308
|
if (this.$mobileHelper.isvisionOSPlatform(platform)) {
|
|
297
|
-
platform = "ios"
|
|
309
|
+
platform = "ios" /* constants.PlatformTypes.ios */;
|
|
298
310
|
}
|
|
299
311
|
return path.join(pluginData.fullPath, "platforms", platform.toLowerCase());
|
|
300
312
|
};
|
|
@@ -302,6 +314,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
302
314
|
if (pluginData.isPlugin) {
|
|
303
315
|
pluginData.platformsData = data.platforms;
|
|
304
316
|
pluginData.pluginVariables = data.variables;
|
|
317
|
+
pluginData.nativescript = data;
|
|
305
318
|
}
|
|
306
319
|
return pluginData;
|
|
307
320
|
}
|
|
@@ -351,6 +364,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
351
364
|
return _.keys(require(packageJsonFilePath).dependencies);
|
|
352
365
|
}
|
|
353
366
|
getNodeModuleData(module, projectDir) {
|
|
367
|
+
// module can be modulePath or moduleName
|
|
354
368
|
if (!this.$fs.exists(module) || path.basename(module) !== "package.json") {
|
|
355
369
|
module = this.getPackageJsonFilePathForModule(module, projectDir);
|
|
356
370
|
}
|
|
@@ -382,7 +396,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
382
396
|
return this.parseNpmCommandResult(npmCommandArguments);
|
|
383
397
|
}
|
|
384
398
|
parseNpmCommandResult(npmCommandResult) {
|
|
385
|
-
return npmCommandResult.split("@")[0];
|
|
399
|
+
return npmCommandResult.split("@")[0]; // returns plugin name
|
|
386
400
|
}
|
|
387
401
|
async executeForAllInstalledPlatforms(action, projectData) {
|
|
388
402
|
const availablePlatforms = this.$mobileHelper.platformNames.map((p) => p.toLowerCase());
|
|
@@ -397,6 +411,8 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
397
411
|
}
|
|
398
412
|
getInstalledFrameworkVersion(platform, projectData) {
|
|
399
413
|
const runtimePackage = this.$projectDataService.getRuntimePackage(projectData.projectDir, platform);
|
|
414
|
+
// const platformData = this.$platformsDataService.getPlatformData(platform, projectData);
|
|
415
|
+
// const frameworkData = this.$projectDataService.getNSValue(projectData.projectDir, platformData.frameworkPackageName);
|
|
400
416
|
return runtimePackage.version;
|
|
401
417
|
}
|
|
402
418
|
isPluginDataValidForPlatform(pluginData, platform, projectData) {
|
|
@@ -426,6 +442,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
426
442
|
}
|
|
427
443
|
getAllPluginsNativeHashes(pathToPluginsBuildFile) {
|
|
428
444
|
if (this.$options.hostProjectPath) {
|
|
445
|
+
// TODO: force rebuild plugins for now until we decide where to put .ns-plugins-build-data.json when embedding
|
|
429
446
|
return {};
|
|
430
447
|
}
|
|
431
448
|
let data = {};
|
|
@@ -436,6 +453,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
436
453
|
}
|
|
437
454
|
setPluginNativeHashes(opts) {
|
|
438
455
|
if (this.$options.hostProjectPath) {
|
|
456
|
+
// TODO: force rebuild plugins for now until we decide where to put .ns-plugins-build-data.json when embedding
|
|
439
457
|
return;
|
|
440
458
|
}
|
|
441
459
|
opts.allPluginsNativeHashes[opts.pluginData.name] =
|
|
@@ -456,3 +474,4 @@ PluginsService.LOCK_FILES = [
|
|
|
456
474
|
"pnpm-lock.yaml",
|
|
457
475
|
];
|
|
458
476
|
yok_1.injector.register("pluginsService", PluginsService);
|
|
477
|
+
//# sourceMappingURL=plugins-service.js.map
|
|
@@ -47,6 +47,7 @@ ProjectBackupService.Backup = class Backup {
|
|
|
47
47
|
backedUpPaths.push(pathToBackup);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
// create backup.json
|
|
50
51
|
this.$super.$fs.writeJson(path.resolve(this.backupDir, "_backup.json"), {
|
|
51
52
|
name: this.name,
|
|
52
53
|
paths: backedUpPaths,
|
|
@@ -67,6 +68,7 @@ ProjectBackupService.Backup = class Backup {
|
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
70
|
this.$super.$logger.trace(backupData);
|
|
71
|
+
// restore files
|
|
70
72
|
return this;
|
|
71
73
|
}
|
|
72
74
|
isUpToDate() {
|
|
@@ -76,6 +78,7 @@ ProjectBackupService.Backup = class Backup {
|
|
|
76
78
|
}
|
|
77
79
|
for (const pathToBackup of backupData.paths) {
|
|
78
80
|
const sourcePath = path.resolve(this.backupDir, pathToBackup);
|
|
81
|
+
// if any of the files don't exist the backup is not up-to-date
|
|
79
82
|
if (!this.$super.$fs.exists(sourcePath)) {
|
|
80
83
|
return false;
|
|
81
84
|
}
|
|
@@ -112,3 +115,4 @@ ProjectBackupService.Backup = class Backup {
|
|
|
112
115
|
}
|
|
113
116
|
};
|
|
114
117
|
yok_1.injector.register("projectBackupService", ProjectBackupService);
|
|
118
|
+
//# sourceMappingURL=project-backup-service.js.map
|
|
@@ -64,6 +64,7 @@ class ProjectChangesService {
|
|
|
64
64
|
this._prepareInfo.projectFileHash = this.getProjectFileStrippedHash(projectData.projectDir, platformData);
|
|
65
65
|
this._changesInfo.nativeChanged = this.isProjectFileChanged(projectData.projectDir, platformData);
|
|
66
66
|
}
|
|
67
|
+
// If this causes too much rebuilds of the plugins or uncecessary builds for Android, move overrideCocoapods to prepareInfo.
|
|
67
68
|
this._changesInfo.nsConfigChanged = this.filesChanged([
|
|
68
69
|
path.join(projectData.projectDir, constants_1.CONFIG_FILE_NAME_JS),
|
|
69
70
|
path.join(projectData.projectDir, constants_1.CONFIG_FILE_NAME_TS),
|
|
@@ -121,6 +122,7 @@ class ProjectChangesService {
|
|
|
121
122
|
}
|
|
122
123
|
getPrepareInfo(platformData) {
|
|
123
124
|
if (this.$options.hostProjectPath) {
|
|
125
|
+
// TODO: always prepare for now until we decide where to keep the .nsprepareinfo file when embedding
|
|
124
126
|
return null;
|
|
125
127
|
}
|
|
126
128
|
const prepareInfoFilePath = this.getPrepareInfoFilePath(platformData);
|
|
@@ -140,6 +142,7 @@ class ProjectChangesService {
|
|
|
140
142
|
await this.ensurePrepareInfo(platformData, projectData, prepareData);
|
|
141
143
|
}
|
|
142
144
|
if (this.$options.hostProjectPath) {
|
|
145
|
+
// TODO: do not save for now until we decide where to keep the .nsprepareinfo file when embedding
|
|
143
146
|
return null;
|
|
144
147
|
}
|
|
145
148
|
const prepareInfoFilePath = this.getPrepareInfoFilePath(platformData);
|
|
@@ -149,7 +152,7 @@ class ProjectChangesService {
|
|
|
149
152
|
this._prepareInfo = this._prepareInfo || this.getPrepareInfo(platformData);
|
|
150
153
|
if (this._prepareInfo &&
|
|
151
154
|
addedPlatform.nativePlatformStatus ===
|
|
152
|
-
"3") {
|
|
155
|
+
"3" /* NativePlatformStatus.alreadyPrepared */) {
|
|
153
156
|
this._prepareInfo.nativePlatformStatus =
|
|
154
157
|
addedPlatform.nativePlatformStatus;
|
|
155
158
|
}
|
|
@@ -173,8 +176,8 @@ class ProjectChangesService {
|
|
|
173
176
|
return false;
|
|
174
177
|
}
|
|
175
178
|
const nativePlatformStatus = !prepareData.nativePrepare || !prepareData.nativePrepare.skipNativePrepare
|
|
176
|
-
? "2"
|
|
177
|
-
: "1"
|
|
179
|
+
? "2" /* NativePlatformStatus.requiresPrepare */
|
|
180
|
+
: "1" /* NativePlatformStatus.requiresPlatformAdd */;
|
|
178
181
|
this._prepareInfo = {
|
|
179
182
|
time: "",
|
|
180
183
|
nativePlatformStatus,
|
|
@@ -197,6 +200,13 @@ class ProjectChangesService {
|
|
|
197
200
|
const projectFileContents = this.$fs.readJson(projectFilePath);
|
|
198
201
|
const relevantProperties = ["dependencies"];
|
|
199
202
|
const projectFileStrippedContents = _.pick(projectFileContents, relevantProperties);
|
|
203
|
+
// _(this.$devicePlatformsConstants)
|
|
204
|
+
// .keys()
|
|
205
|
+
// .map(k => k.toLowerCase())
|
|
206
|
+
// .difference([platformData.platformNameLowerCase])
|
|
207
|
+
// .each(otherPlatform => {
|
|
208
|
+
// delete projectFileContents.nativescript[`tns-${otherPlatform}`];
|
|
209
|
+
// });
|
|
200
210
|
return (0, helpers_1.getHash)(JSON.stringify(projectFileStrippedContents));
|
|
201
211
|
}
|
|
202
212
|
isProjectFileChanged(projectDir, platformData) {
|
|
@@ -262,3 +272,4 @@ __decorate([
|
|
|
262
272
|
(0, helpers_1.hook)("checkForChanges")
|
|
263
273
|
], ProjectChangesService.prototype, "checkForChanges", null);
|
|
264
274
|
yok_1.injector.register("projectChangesService", ProjectChangesService);
|
|
275
|
+
//# sourceMappingURL=project-changes-service.js.map
|
|
@@ -28,6 +28,7 @@ class ProjectCleanupService {
|
|
|
28
28
|
success = success && cleanRes.ok;
|
|
29
29
|
}
|
|
30
30
|
if (!(options === null || options === void 0 ? void 0 : options.silent)) {
|
|
31
|
+
// required to print an empty line for the spinner to not replace the last status... (probably a bug in the spinners)
|
|
31
32
|
console.log();
|
|
32
33
|
}
|
|
33
34
|
if (stats) {
|
|
@@ -87,3 +88,4 @@ class ProjectCleanupService {
|
|
|
87
88
|
}
|
|
88
89
|
exports.ProjectCleanupService = ProjectCleanupService;
|
|
89
90
|
yok_1.injector.register("projectCleanupService", ProjectCleanupService);
|
|
91
|
+
//# sourceMappingURL=project-cleanup-service.js.map
|
|
@@ -35,6 +35,7 @@ class ProjectConfigService {
|
|
|
35
35
|
return (this.forceUsingLegacyConfig = force);
|
|
36
36
|
}
|
|
37
37
|
requireFromString(src, filename) {
|
|
38
|
+
// @ts-ignore
|
|
38
39
|
const m = new module.constructor();
|
|
39
40
|
m.paths = module.paths;
|
|
40
41
|
m._compile(src, filename);
|
|
@@ -57,6 +58,7 @@ export default {
|
|
|
57
58
|
} as NativeScriptConfig;`.trim();
|
|
58
59
|
}
|
|
59
60
|
warnUsingLegacyNSConfig() {
|
|
61
|
+
// todo: remove hack
|
|
60
62
|
const isMigrate = _.get(this.$options, "argv._[0]") === "migrate";
|
|
61
63
|
if (isMigrate) {
|
|
62
64
|
return;
|
|
@@ -65,6 +67,7 @@ export default {
|
|
|
65
67
|
}
|
|
66
68
|
detectProjectConfigs(projectDir) {
|
|
67
69
|
var _a;
|
|
70
|
+
// allow overriding config name with env variable or --config (or -c)
|
|
68
71
|
let configName = (_a = process.env.NATIVESCRIPT_CONFIG_NAME) !== null && _a !== void 0 ? _a : this.$options.config;
|
|
69
72
|
if (configName === "false") {
|
|
70
73
|
configName = false;
|
|
@@ -94,6 +97,7 @@ export default {
|
|
|
94
97
|
const existingConfigs = possibleConfigPaths.filter((path) => {
|
|
95
98
|
return this.$fs.exists(path);
|
|
96
99
|
});
|
|
100
|
+
// push the first possible config into the "existing" list
|
|
97
101
|
const hasExistingConfig = !!existingConfigs.length;
|
|
98
102
|
if (!hasExistingConfig) {
|
|
99
103
|
this.$logger.trace(`No config file found - falling back to ${possibleConfigPaths[0]}.`);
|
|
@@ -188,6 +192,8 @@ export default {
|
|
|
188
192
|
this.$fs.writeFile(configFilePath, await (0, prettier_1.format)(newContent, {
|
|
189
193
|
...prettierOptions,
|
|
190
194
|
parser: "typescript",
|
|
195
|
+
// note: we don't use plugins here, since we are only formatting ts files, and they are supported by default
|
|
196
|
+
// and this also causes issues with certain plugins, like prettier-plugin-tailwindcss.
|
|
191
197
|
plugins: [],
|
|
192
198
|
}));
|
|
193
199
|
}
|
|
@@ -195,9 +201,11 @@ export default {
|
|
|
195
201
|
this.$logger.error(`Failed to update config.` + error);
|
|
196
202
|
}
|
|
197
203
|
finally {
|
|
204
|
+
// verify config is updated correctly
|
|
198
205
|
if (!Array.isArray(this.getValue(key)) && this.getValue(key) !== value) {
|
|
199
206
|
this.$logger.error(`${os_1.EOL}Failed to update ${hasTSConfig ? constants_1.CONFIG_FILE_NAME_TS : constants_1.CONFIG_FILE_NAME_JS}.${os_1.EOL}`);
|
|
200
207
|
this.$logger.printMarkdown(`Please manually update \`${hasTSConfig ? constants_1.CONFIG_FILE_NAME_TS : constants_1.CONFIG_FILE_NAME_JS}\` and set \`${key}\` to \`${value}\`.${os_1.EOL}`);
|
|
208
|
+
// restore original content
|
|
201
209
|
this.$fs.writeFile(configFilePath, configContent);
|
|
202
210
|
return false;
|
|
203
211
|
}
|
|
@@ -226,9 +234,11 @@ export default {
|
|
|
226
234
|
? this.$fs.readJson(info.NSConfigPath)
|
|
227
235
|
: {};
|
|
228
236
|
try {
|
|
237
|
+
// injecting here to avoid circular dependency
|
|
229
238
|
const projectData = this.$injector.resolve("projectData");
|
|
230
239
|
const embeddedPackageJsonPath = path.resolve(this.projectHelper.projectDir, projectData.getAppDirectoryRelativePath(), constants.PACKAGE_JSON_FILE_NAME);
|
|
231
240
|
const embeddedPackageJson = this.$fs.readJson(embeddedPackageJsonPath);
|
|
241
|
+
// filter only the supported keys
|
|
232
242
|
additionalData.push(_.pick(embeddedPackageJson, [
|
|
233
243
|
"android",
|
|
234
244
|
"ios",
|
|
@@ -240,9 +250,11 @@ export default {
|
|
|
240
250
|
}
|
|
241
251
|
catch (err) {
|
|
242
252
|
this.$logger.trace("failed to add embedded package.json data to config", err);
|
|
253
|
+
// ignore if the file doesn't exist
|
|
243
254
|
}
|
|
244
255
|
try {
|
|
245
256
|
const packageJson = this.$fs.readJson(path.join(this.projectHelper.projectDir, "package.json"));
|
|
257
|
+
// add app id to additionalData for backwards compatibility
|
|
246
258
|
if (!NSConfig.id &&
|
|
247
259
|
packageJson &&
|
|
248
260
|
packageJson.nativescript &&
|
|
@@ -266,8 +278,10 @@ export default {
|
|
|
266
278
|
}
|
|
267
279
|
catch (err) {
|
|
268
280
|
this.$logger.trace("failed to read package.json data for config", err);
|
|
281
|
+
// ignore if the file doesn't exist
|
|
269
282
|
}
|
|
270
283
|
return _.defaultsDeep({}, ...additionalData, NSConfig);
|
|
284
|
+
// return Object.assign({}, ...additionalData, NSConfig);
|
|
271
285
|
}
|
|
272
286
|
async writeLegacyNSConfigIfNeeded(projectDir, runtimePackage) {
|
|
273
287
|
const { usingNSConfig } = this.detectProjectConfigs(projectDir);
|
|
@@ -276,6 +290,8 @@ export default {
|
|
|
276
290
|
}
|
|
277
291
|
if (runtimePackage.version &&
|
|
278
292
|
semver.gte(semver.coerce(runtimePackage.version), "7.0.0-rc.5")) {
|
|
293
|
+
// runtimes >= 7.0.0-rc.5 support passing appPath and appResourcesPath through gradle project flags
|
|
294
|
+
// so writing an nsconfig is not necessary.
|
|
279
295
|
return;
|
|
280
296
|
}
|
|
281
297
|
const runtimePackageDisplay = `${runtimePackage.name}${runtimePackage.version ? " v" + runtimePackage.version : ""}`;
|
|
@@ -292,8 +308,10 @@ You may add \`nsconfig.json\` to \`.gitignore\` as the CLI will regenerate it as
|
|
|
292
308
|
appPath: this.getValue("appPath"),
|
|
293
309
|
appResourcesPath: this.getValue("appResourcesPath"),
|
|
294
310
|
});
|
|
311
|
+
// mark the file for cleanup after the CLI exits
|
|
295
312
|
await this.$cleanupService.addCleanupDeleteAction(nsConfigPath);
|
|
296
313
|
}
|
|
314
|
+
// todo: move into config manipulation
|
|
297
315
|
flattenObjectToPaths(obj, basePath) {
|
|
298
316
|
const toPath = (key) => [basePath, key].filter(Boolean).join(".");
|
|
299
317
|
return Object.keys(obj).reduce((all, key) => {
|
|
@@ -302,7 +320,7 @@ You may add \`nsconfig.json\` to \`.gitignore\` as the CLI will regenerate it as
|
|
|
302
320
|
...all,
|
|
303
321
|
{
|
|
304
322
|
key: toPath(key),
|
|
305
|
-
value: obj[key],
|
|
323
|
+
value: obj[key], // Preserve arrays as they are
|
|
306
324
|
},
|
|
307
325
|
];
|
|
308
326
|
}
|
|
@@ -321,7 +339,7 @@ You may add \`nsconfig.json\` to \`.gitignore\` as the CLI will regenerate it as
|
|
|
321
339
|
}
|
|
322
340
|
exports.ProjectConfigService = ProjectConfigService;
|
|
323
341
|
__decorate([
|
|
324
|
-
(0, decorators_1.cache)()
|
|
342
|
+
(0, decorators_1.cache)() // @cache should prevent the message being printed multiple times
|
|
325
343
|
], ProjectConfigService.prototype, "warnUsingLegacyNSConfig", null);
|
|
326
344
|
__decorate([
|
|
327
345
|
(0, decorators_1.exported)("projectConfigService")
|
|
@@ -333,3 +351,4 @@ __decorate([
|
|
|
333
351
|
(0, decorators_1.exported)("projectConfigService")
|
|
334
352
|
], ProjectConfigService.prototype, "setValue", null);
|
|
335
353
|
yok_1.injector.register("projectConfigService", ProjectConfigService);
|
|
354
|
+
//# sourceMappingURL=project-config-service.js.map
|