nativescript 8.8.0 → 8.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/test-deps-versions-generated.json +1 -1
- package/lib/android-tools-info.js +12 -0
- package/lib/base-package-manager.js +11 -1
- package/lib/bootstrap.js +5 -1
- package/lib/bun-package-manager.js +17 -1
- package/lib/color.js +3 -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 +4 -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 +3 -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 +12 -2
- 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/common/bootstrap.js +1 -0
- package/lib/common/child-process.js +3 -0
- package/lib/common/codeGeneration/code-entity.js +1 -0
- package/lib/common/codeGeneration/code-printer.js +1 -0
- package/lib/common/command-params.js +1 -0
- package/lib/common/commands/analytics.js +3 -0
- package/lib/common/commands/autocompletion.js +3 -0
- package/lib/common/commands/device/device-log-stream.js +1 -0
- package/lib/common/commands/device/get-file.js +2 -0
- package/lib/common/commands/device/list-applications.js +1 -0
- package/lib/common/commands/device/list-devices.js +3 -0
- package/lib/common/commands/device/list-files.js +2 -0
- package/lib/common/commands/device/put-file.js +2 -0
- package/lib/common/commands/device/run-application.js +1 -0
- package/lib/common/commands/device/stop-application.js +1 -0
- package/lib/common/commands/device/uninstall-application.js +1 -0
- package/lib/common/commands/doctor.js +3 -2
- package/lib/common/commands/generate-messages.js +1 -0
- package/lib/common/commands/help.js +1 -0
- package/lib/common/commands/package-manager-get.js +1 -0
- package/lib/common/commands/package-manager-set.js +1 -0
- package/lib/common/commands/post-install.js +1 -0
- package/lib/common/commands/preuninstall.js +11 -2
- package/lib/common/commands/proxy/proxy-base.js +4 -0
- package/lib/common/commands/proxy/proxy-clear.js +1 -0
- package/lib/common/commands/proxy/proxy-get.js +1 -0
- package/lib/common/commands/proxy/proxy-set.js +1 -0
- package/lib/common/common-lib.js +1 -0
- package/lib/common/constants.js +11 -0
- package/lib/common/decorators.js +48 -0
- package/lib/common/dispatchers.js +10 -1
- package/lib/common/errors.js +13 -3
- package/lib/common/file-system.js +13 -2
- package/lib/common/header.js +3 -0
- package/lib/common/helpers.js +89 -3
- package/lib/common/host-info.js +4 -0
- package/lib/common/http-client.js +20 -0
- package/lib/common/logger/appenders/cli-appender.js +4 -0
- package/lib/common/logger/appenders/emit-appender.js +4 -0
- package/lib/common/logger/layouts/cli-layout.js +1 -0
- package/lib/common/logger/logger.js +5 -0
- package/lib/common/messages/messages.js +6 -0
- package/lib/common/mobile/android/android-application-manager.js +20 -1
- package/lib/common/mobile/android/android-debug-bridge-result-handler.js +1 -0
- package/lib/common/mobile/android/android-debug-bridge.js +6 -0
- package/lib/common/mobile/android/android-device-file-system.js +4 -0
- package/lib/common/mobile/android/android-device-hash-service.js +3 -0
- package/lib/common/mobile/android/android-device.js +8 -0
- package/lib/common/mobile/android/android-emulator-services.js +2 -1
- package/lib/common/mobile/android/android-ini-file-parser.js +9 -0
- package/lib/common/mobile/android/android-log-filter.js +4 -0
- package/lib/common/mobile/android/android-virtual-device-service.js +30 -1
- package/lib/common/mobile/android/device-android-debug-bridge.js +1 -0
- package/lib/common/mobile/android/genymotion/genymotion-service.js +5 -0
- 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 +4 -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 +91 -3
- package/lib/controllers/platform-controller.js +9 -1
- package/lib/controllers/prepare-controller.js +17 -4
- package/lib/controllers/run-controller.js +17 -1
- package/lib/controllers/update-controller-base.js +1 -0
- package/lib/controllers/update-controller.js +11 -0
- package/lib/data/build-data.js +1 -0
- package/lib/data/controller-data-base.js +1 -0
- package/lib/data/debug-data.js +1 -0
- package/lib/data/platform-data.js +1 -0
- package/lib/data/prepare-data.js +1 -0
- package/lib/data/run-data.js +1 -0
- package/lib/detached-processes/cleanup-js-subprocess.js +8 -2
- package/lib/detached-processes/cleanup-process.js +18 -14
- package/lib/detached-processes/file-log-service.js +2 -1
- package/lib/device-path-provider.js +1 -0
- package/lib/device-sockets/ios/app-debug-socket-proxy-factory.js +7 -0
- package/lib/device-sockets/ios/notification.js +3 -0
- package/lib/device-sockets/ios/socket-request-executor.js +3 -0
- package/lib/helpers/android-bundle-validator-helper.js +2 -1
- package/lib/helpers/deploy-command-helper.js +1 -0
- package/lib/helpers/key-command-helper.js +4 -2
- package/lib/helpers/livesync-command-helper.js +4 -1
- package/lib/helpers/network-connectivity-validator.js +1 -0
- package/lib/helpers/options-track-helper.js +3 -2
- package/lib/helpers/package-path-helper.js +1 -0
- package/lib/helpers/platform-command-helper.js +7 -2
- package/lib/helpers/version-validator-helper.js +1 -0
- package/lib/key-commands/bootstrap.js +3 -2
- package/lib/key-commands/index.js +5 -4
- package/lib/nativescript-cli-lib-bootstrap.js +4 -0
- package/lib/nativescript-cli-lib.js +1 -0
- package/lib/nativescript-cli.js +10 -1
- package/lib/node/pbxproj-dom-xcode.js +1 -0
- package/lib/node/xcode.js +1 -0
- package/lib/node-package-manager.js +11 -1
- package/lib/options.js +143 -118
- 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 +6 -1
- package/lib/services/android-device-debug-service.js +6 -0
- package/lib/services/android-plugin-build-service.js +33 -1
- 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/assets-generation/assets-generation-service.js +16 -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/cleanup-service.js +13 -9
- package/lib/services/cocoapods-platform-manager.js +9 -0
- package/lib/services/cocoapods-service.js +21 -1
- package/lib/services/debug-data-service.js +1 -0
- package/lib/services/debug-service-base.js +7 -0
- package/lib/services/device/device-install-app-service.js +2 -1
- package/lib/services/doctor-service.js +21 -6
- package/lib/services/extensibility-service.js +8 -0
- package/lib/services/files-hash-service.js +1 -0
- package/lib/services/hmr-status-service.js +2 -0
- package/lib/services/info-service.js +1 -0
- package/lib/services/initialize-service.js +5 -1
- package/lib/services/ios/export-options-plist-service.js +4 -0
- package/lib/services/ios/ios-signing-service.js +4 -0
- package/lib/services/ios/spm-service.js +9 -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 +1 -0
- 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 +94 -2
- package/lib/services/ios-provision-service.js +3 -0
- package/lib/services/ios-watch-app-service.js +1 -0
- package/lib/services/ip-service.js +2 -0
- package/lib/services/itmstransporter-service.js +1 -0
- package/lib/services/karma-execution.js +2 -0
- package/lib/services/livesync/android-device-livesync-service-base.js +1 -0
- package/lib/services/livesync/android-device-livesync-service.js +2 -0
- package/lib/services/livesync/android-device-livesync-sockets-service.js +3 -0
- package/lib/services/livesync/android-livesync-service.js +1 -0
- package/lib/services/livesync/android-livesync-tool.js +4 -0
- package/lib/services/livesync/device-livesync-service-base.js +2 -0
- package/lib/services/livesync/ios-device-livesync-service.js +7 -0
- package/lib/services/livesync/ios-livesync-service.js +2 -0
- package/lib/services/livesync/livesync-socket.js +1 -0
- package/lib/services/livesync/platform-livesync-service-base.js +5 -0
- package/lib/services/livesync-process-data-service.js +1 -0
- package/lib/services/log-parser-service.js +1 -0
- package/lib/services/log-source-map-service.js +15 -0
- package/lib/services/marking-mode-service.js +8 -5
- package/lib/services/metadata-filtering-service.js +1 -0
- package/lib/services/npm-config-service.js +4 -0
- package/lib/services/pacote-service.js +7 -0
- package/lib/services/performance-service.js +3 -1
- package/lib/services/platform/add-platform-service.js +49 -2
- package/lib/services/platform/platform-validation-service.js +1 -0
- package/lib/services/platform/prepare-native-platform-service.js +5 -2
- package/lib/services/platform-environment-requirements.js +8 -3
- package/lib/services/platform-project-service-base.js +1 -0
- package/lib/services/platforms-data-service.js +1 -0
- package/lib/services/plugins-service.js +20 -2
- package/lib/services/prepare-data-service.js +1 -0
- package/lib/services/project-backup-service.js +4 -0
- package/lib/services/project-changes-service.js +14 -3
- package/lib/services/project-cleanup-service.js +2 -0
- package/lib/services/project-config-service.js +22 -2
- package/lib/services/project-data-service.js +36 -7
- package/lib/services/project-name-service.js +1 -0
- package/lib/services/project-service.js +10 -0
- package/lib/services/project-templates-service.js +3 -2
- package/lib/services/qr-code-terminal-service.js +1 -0
- package/lib/services/require-service.js +1 -0
- package/lib/services/start-service.js +1 -0
- package/lib/services/temp-service.js +1 -0
- package/lib/services/terminal-spinner-service.js +2 -0
- package/lib/services/test-execution-service.js +9 -2
- package/lib/services/test-initialization-service.js +4 -0
- package/lib/services/timeline-profiler-service.js +1 -0
- package/lib/services/user-settings-service.js +1 -0
- package/lib/services/versions-service.js +6 -4
- package/lib/services/watch-ignore-list-service.js +1 -0
- package/lib/services/webpack/webpack-compiler-service.js +42 -1
- package/lib/services/xcconfig-service.js +2 -0
- package/lib/services/xcproj-service.js +1 -0
- package/lib/shared-event-bus.js +6 -0
- package/lib/sys-info.js +2 -1
- package/lib/tools/config-manipulation/config-transformer.js +12 -0
- package/lib/tools/node-modules/node-modules-builder.js +1 -0
- package/lib/tools/node-modules/node-modules-dependencies-builder.js +6 -0
- package/lib/yarn-package-manager.js +1 -0
- package/lib/yarn2-package-manager.js +3 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/CHANGELOG.md +15 -0
- package/node_modules/rimraf/CHANGELOG.md +65 -0
- package/node_modules/stringify-package/CHANGELOG.md +16 -0
- package/package.json +2 -2
|
@@ -21,7 +21,11 @@ const constants_1 = require("../../constants");
|
|
|
21
21
|
const decorators_1 = require("../../common/decorators");
|
|
22
22
|
const yok_1 = require("../../common/yok");
|
|
23
23
|
class AddPlatformService {
|
|
24
|
-
constructor($fs, $logger, $options,
|
|
24
|
+
constructor($fs, $logger, $options,
|
|
25
|
+
// private $pacoteService: IPacoteService,
|
|
26
|
+
// private $projectDataService: IProjectDataService,
|
|
27
|
+
$packageManager, $terminalSpinnerService, $analyticsService // private $tempService: ITempService
|
|
28
|
+
) {
|
|
25
29
|
this.$fs = $fs;
|
|
26
30
|
this.$logger = $logger;
|
|
27
31
|
this.$options = $options;
|
|
@@ -37,9 +41,13 @@ class AddPlatformService {
|
|
|
37
41
|
const spinner = this.$terminalSpinnerService.createSpinner();
|
|
38
42
|
try {
|
|
39
43
|
spinner.start();
|
|
44
|
+
// const frameworkDirPath = addPlatformData.frameworkPath ?
|
|
45
|
+
// await this.extractPackage(packageToInstall)
|
|
46
|
+
// : await this.installPackage(projectData.projectDir, packageToInstall);
|
|
40
47
|
const frameworkDirPath = yield this.installPackage(projectData.projectDir, packageToInstall);
|
|
41
48
|
const frameworkPackageJsonContent = this.$fs.readJson(path.join(frameworkDirPath, "..", "package.json"));
|
|
42
49
|
const frameworkVersion = frameworkPackageJsonContent.version;
|
|
50
|
+
// await this.setPlatformVersion(platformData, projectData, frameworkVersion);
|
|
43
51
|
yield this.trackPlatformVersion(frameworkVersion, platformData);
|
|
44
52
|
if (!addPlatformData.nativePrepare ||
|
|
45
53
|
!addPlatformData.nativePrepare.skipNativePrepare) {
|
|
@@ -62,10 +70,22 @@ class AddPlatformService {
|
|
|
62
70
|
yield this.installPackage(projectData.projectDir, `${platformData.frameworkPackageName}@${frameworkVersion}`);
|
|
63
71
|
});
|
|
64
72
|
}
|
|
73
|
+
// private async extractPackage(pkg: string): Promise<string> {
|
|
74
|
+
// const downloadedPackagePath = await this.$tempService.mkdirSync(
|
|
75
|
+
// "runtimeDir"
|
|
76
|
+
// );
|
|
77
|
+
// await this.$pacoteService.extractPackage(pkg, downloadedPackagePath);
|
|
78
|
+
// const frameworkDir = path.join(
|
|
79
|
+
// downloadedPackagePath,
|
|
80
|
+
// PROJECT_FRAMEWORK_FOLDER_NAME
|
|
81
|
+
// );
|
|
82
|
+
// return path.resolve(frameworkDir);
|
|
83
|
+
// }
|
|
65
84
|
installPackage(projectDir, packageName) {
|
|
66
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
67
86
|
const frameworkDir = this.resolveFrameworkDir(projectDir, packageName);
|
|
68
87
|
if (frameworkDir && this.$fs.exists(frameworkDir)) {
|
|
88
|
+
// don't install if it's already installed
|
|
69
89
|
return frameworkDir;
|
|
70
90
|
}
|
|
71
91
|
const installedPackage = yield this.$packageManager.install(packageName, projectDir, {
|
|
@@ -82,6 +102,30 @@ class AddPlatformService {
|
|
|
82
102
|
}
|
|
83
103
|
resolveFrameworkDir(projectDir, packageName) {
|
|
84
104
|
try {
|
|
105
|
+
// strip version info if present <package>@1.2.3-rc.0 -> <package>
|
|
106
|
+
// tested cases:
|
|
107
|
+
// @nativescript/ios
|
|
108
|
+
// @nativescript/ios@1
|
|
109
|
+
// @nativescript/ios@1.2
|
|
110
|
+
// @nativescript/ios@1.2.3
|
|
111
|
+
// @nativescript/ios@1.2.3-
|
|
112
|
+
// @nativescript/ios@1.2.3-rc
|
|
113
|
+
// @nativescript/ios@1.2.3-rc.
|
|
114
|
+
// @nativescript/ios@1.2.3-rc.0
|
|
115
|
+
// @nativescript/ios@rc
|
|
116
|
+
// @nativescript/ios@^7.0.0
|
|
117
|
+
// @nativescript/ios@~7.0.0
|
|
118
|
+
// tns-ios
|
|
119
|
+
// tns-ios@1
|
|
120
|
+
// tns-ios@1.2
|
|
121
|
+
// tns-ios@1.2.3
|
|
122
|
+
// tns-ios@1.2.3-
|
|
123
|
+
// tns-ios@1.2.3-rc
|
|
124
|
+
// tns-ios@1.2.3-rc.
|
|
125
|
+
// tns-ios@1.2.3-rc.0
|
|
126
|
+
// tns-ios@rc
|
|
127
|
+
// tns-ios@^7.0.0
|
|
128
|
+
// tns-ios@~7.0.0
|
|
85
129
|
packageName = packageName.replace(/(.+)@.+$/g, "$1");
|
|
86
130
|
const frameworkDir = require
|
|
87
131
|
.resolve(`${packageName}/package.json`, {
|
|
@@ -100,8 +144,10 @@ class AddPlatformService {
|
|
|
100
144
|
addNativePlatform(platformData, projectData, frameworkDirPath, frameworkVersion) {
|
|
101
145
|
var _a;
|
|
102
146
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
// here we should use ios OR android
|
|
103
148
|
const platformDir = (_a = this.$options.hostProjectPath) !== null && _a !== void 0 ? _a : path.join(projectData.platformsDir, platformData.normalizedPlatformName.toLowerCase());
|
|
104
149
|
this.$fs.deleteDirectory(platformDir);
|
|
150
|
+
//if iosHost - dont create project
|
|
105
151
|
yield platformData.platformProjectService.createProject(path.resolve(frameworkDirPath), frameworkVersion, projectData);
|
|
106
152
|
platformData.platformProjectService.ensureConfigurationFileInAppResources(projectData);
|
|
107
153
|
yield platformData.platformProjectService.interpolateData(projectData);
|
|
@@ -111,7 +157,7 @@ class AddPlatformService {
|
|
|
111
157
|
trackPlatformVersion(frameworkVersion, platformData) {
|
|
112
158
|
return __awaiter(this, void 0, void 0, function* () {
|
|
113
159
|
yield this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
114
|
-
action: "Add Platform"
|
|
160
|
+
action: "Add Platform" /* TrackActionNames.AddPlatform */,
|
|
115
161
|
additionalData: `${platformData.platformNameLowerCase}${constants_1.AnalyticsEventLabelDelimiter}${frameworkVersion}`,
|
|
116
162
|
});
|
|
117
163
|
});
|
|
@@ -122,3 +168,4 @@ __decorate([
|
|
|
122
168
|
], AddPlatformService.prototype, "addNativePlatform", null);
|
|
123
169
|
exports.AddPlatformService = AddPlatformService;
|
|
124
170
|
yok_1.injector.register("addPlatformService", AddPlatformService);
|
|
171
|
+
//# sourceMappingURL=add-platform-service.js.map
|
|
@@ -59,19 +59,21 @@ class PrepareNativePlatformService {
|
|
|
59
59
|
this.$metadataFilteringService.generateMetadataFilters(projectData, platformData.platformNameLowerCase);
|
|
60
60
|
}
|
|
61
61
|
platformData.platformProjectService.interpolateConfigurationFile(projectData);
|
|
62
|
-
yield this.$projectChangesService.setNativePlatformStatus(platformData, projectData, { nativePlatformStatus: "3" });
|
|
62
|
+
yield this.$projectChangesService.setNativePlatformStatus(platformData, projectData, { nativePlatformStatus: "3" /* NativePlatformStatus.alreadyPrepared */ });
|
|
63
63
|
return hasChanges;
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
cleanProject(platformData, options) {
|
|
67
67
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
// android build artifacts need to be cleaned up
|
|
69
|
+
// when switching between debug, release and webpack builds
|
|
68
70
|
if (platformData.platformNameLowerCase !== "android") {
|
|
69
71
|
return;
|
|
70
72
|
}
|
|
71
73
|
const previousPrepareInfo = this.$projectChangesService.getPrepareInfo(platformData);
|
|
72
74
|
if (!previousPrepareInfo ||
|
|
73
75
|
previousPrepareInfo.nativePlatformStatus !==
|
|
74
|
-
"3") {
|
|
76
|
+
"3" /* NativePlatformStatus.alreadyPrepared */) {
|
|
75
77
|
return;
|
|
76
78
|
}
|
|
77
79
|
const { release: previousWasRelease } = previousPrepareInfo;
|
|
@@ -88,3 +90,4 @@ __decorate([
|
|
|
88
90
|
], PrepareNativePlatformService.prototype, "prepareNativePlatform", null);
|
|
89
91
|
exports.PrepareNativePlatformService = PrepareNativePlatformService;
|
|
90
92
|
yok_1.injector.register("prepareNativePlatformService", PrepareNativePlatformService);
|
|
93
|
+
//# sourceMappingURL=prepare-native-platform-service.js.map
|
|
@@ -20,7 +20,9 @@ const helpers_1 = require("../common/helpers");
|
|
|
20
20
|
const os_1 = require("os");
|
|
21
21
|
const yok_1 = require("../common/yok");
|
|
22
22
|
class PlatformEnvironmentRequirements {
|
|
23
|
-
constructor($doctorService, $errors, $analyticsService,
|
|
23
|
+
constructor($doctorService, $errors, $analyticsService,
|
|
24
|
+
// @ts-ignore - required by the hook helper!
|
|
25
|
+
$injector) {
|
|
24
26
|
this.$doctorService = $doctorService;
|
|
25
27
|
this.$errors = $errors;
|
|
26
28
|
this.$analyticsService = $analyticsService;
|
|
@@ -32,7 +34,7 @@ class PlatformEnvironmentRequirements {
|
|
|
32
34
|
const selectedOption = null;
|
|
33
35
|
if (process.env.NS_SKIP_ENV_CHECK) {
|
|
34
36
|
yield this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
35
|
-
action: "Check Environment Requirements"
|
|
37
|
+
action: "Check Environment Requirements" /* TrackActionNames.CheckEnvironmentRequirements */,
|
|
36
38
|
additionalData: "Skipped: NS_SKIP_ENV_CHECK is set",
|
|
37
39
|
});
|
|
38
40
|
return {
|
|
@@ -47,8 +49,9 @@ class PlatformEnvironmentRequirements {
|
|
|
47
49
|
forceCheck: input.forceCheck,
|
|
48
50
|
});
|
|
49
51
|
if (!canExecute) {
|
|
52
|
+
// if (!isInteractive()) {
|
|
50
53
|
yield this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
51
|
-
action: "Check Environment Requirements"
|
|
54
|
+
action: "Check Environment Requirements" /* TrackActionNames.CheckEnvironmentRequirements */,
|
|
52
55
|
additionalData: "Non-interactive terminal, unable to execute local builds.",
|
|
53
56
|
});
|
|
54
57
|
this.fail(this.getNonInteractiveConsoleMessage(platform));
|
|
@@ -69,6 +72,7 @@ class PlatformEnvironmentRequirements {
|
|
|
69
72
|
].join(os_1.EOL);
|
|
70
73
|
}
|
|
71
74
|
getEnvVerificationMessage(platform) {
|
|
75
|
+
// map process.platform to OS name used in docs
|
|
72
76
|
const os = {
|
|
73
77
|
linux: "linux",
|
|
74
78
|
win32: "windows",
|
|
@@ -87,3 +91,4 @@ __decorate([
|
|
|
87
91
|
], PlatformEnvironmentRequirements.prototype, "checkEnvironmentRequirements", null);
|
|
88
92
|
exports.PlatformEnvironmentRequirements = PlatformEnvironmentRequirements;
|
|
89
93
|
yok_1.injector.register("platformEnvironmentRequirements", PlatformEnvironmentRequirements);
|
|
94
|
+
//# sourceMappingURL=platform-environment-requirements.js.map
|
|
@@ -64,6 +64,7 @@ class PluginsService {
|
|
|
64
64
|
const realNpmPackageJson = this.$fs.readJson(pathToRealNpmPackageJson);
|
|
65
65
|
if (realNpmPackageJson.nativescript) {
|
|
66
66
|
const pluginData = this.convertToPluginData(realNpmPackageJson, projectData.projectDir);
|
|
67
|
+
// Validate
|
|
67
68
|
const action = (pluginDestinationPath, platform, platformData) => __awaiter(this, void 0, void 0, function* () {
|
|
68
69
|
this.isPluginDataValidForPlatform(pluginData, platform, projectData);
|
|
69
70
|
});
|
|
@@ -152,6 +153,9 @@ class PluginsService {
|
|
|
152
153
|
paths: [projectData.projectDir],
|
|
153
154
|
});
|
|
154
155
|
if (pathToPackage) {
|
|
156
|
+
// return false if the dependency is installed - we'll filter out boolean values
|
|
157
|
+
// and end up with an array of dep names that are not installed if we end up
|
|
158
|
+
// inside the catch block.
|
|
155
159
|
return false;
|
|
156
160
|
}
|
|
157
161
|
this.$logger.trace(`${dep} is not installed, or couldn't be found`);
|
|
@@ -187,6 +191,9 @@ class PluginsService {
|
|
|
187
191
|
return productionPlugins
|
|
188
192
|
.map((plugin) => this.convertToPluginData(plugin, projectData.projectDir))
|
|
189
193
|
.filter((item, idx, self) => {
|
|
194
|
+
// Filter out duplicates to speed up build times by not building the same dependency
|
|
195
|
+
// multiple times. One possible downside is that if there are different versions
|
|
196
|
+
// of the same native dependency only the first one in the array will be built
|
|
190
197
|
return self.findIndex((p) => p.name === item.name) === idx;
|
|
191
198
|
});
|
|
192
199
|
}
|
|
@@ -218,9 +225,11 @@ class PluginsService {
|
|
|
218
225
|
const dependenciesGroupedByName = _.groupBy(productionDependencies, (p) => p.name);
|
|
219
226
|
_.each(dependenciesGroupedByName, (dependencyOccurrences, dependencyName) => {
|
|
220
227
|
if (dependencyOccurrences.length > 1) {
|
|
228
|
+
// the dependency exists multiple times in node_modules
|
|
221
229
|
const dependencyOccurrencesGroupedByVersion = _.groupBy(dependencyOccurrences, (g) => g.version);
|
|
222
230
|
const versions = _.keys(dependencyOccurrencesGroupedByVersion);
|
|
223
231
|
if (versions.length === 1) {
|
|
232
|
+
// all dependencies with this name have the same version
|
|
224
233
|
this.$logger.trace(`Detected same versions (${_.first(versions)}) of the ${dependencyName} installed at locations: ${_.map(dependencyOccurrences, (d) => d.directory).join(", ")}`);
|
|
225
234
|
}
|
|
226
235
|
else {
|
|
@@ -246,9 +255,11 @@ class PluginsService {
|
|
|
246
255
|
const dependenciesGroupedByFrameworkName = _.groupBy(dependenciesWithFrameworks, (d) => d.frameworkName);
|
|
247
256
|
_.each(dependenciesGroupedByFrameworkName, (dependencyOccurrences, frameworkName) => {
|
|
248
257
|
if (dependencyOccurrences.length > 1) {
|
|
258
|
+
// A framework exists multiple times in node_modules
|
|
249
259
|
const groupedByName = _.groupBy(dependencyOccurrences, (d) => d.name);
|
|
250
260
|
const pluginsNames = _.keys(groupedByName);
|
|
251
261
|
if (pluginsNames.length > 1) {
|
|
262
|
+
// fail - the same framework is installed by different dependencies.
|
|
252
263
|
const locations = dependencyOccurrences.map((d) => d.frameworkLocation);
|
|
253
264
|
let msg = `Detected the framework ${frameworkName} is installed from multiple plugins at locations:\n${locations.join("\n")}\n`;
|
|
254
265
|
msg += this.getHelpMessage(projectDir);
|
|
@@ -258,6 +269,7 @@ class PluginsService {
|
|
|
258
269
|
const dependencyOccurrencesGroupedByVersion = _.groupBy(dependencyOccurrences, (g) => g.version);
|
|
259
270
|
const versions = _.keys(dependencyOccurrencesGroupedByVersion);
|
|
260
271
|
if (versions.length === 1) {
|
|
272
|
+
// all dependencies with this name have the same version
|
|
261
273
|
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(", ")}`);
|
|
262
274
|
const selectedPackage = _.minBy(dependencyOccurrences, (d) => d.depth);
|
|
263
275
|
this.$logger.info(color_1.color.green(`CLI will use only the native code from '${selectedPackage.directory}'.`));
|
|
@@ -309,7 +321,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
309
321
|
pluginData.isPlugin = !!cacheData.nativescript;
|
|
310
322
|
pluginData.pluginPlatformsFolderPath = (platform) => {
|
|
311
323
|
if (this.$mobileHelper.isvisionOSPlatform(platform)) {
|
|
312
|
-
platform = "ios"
|
|
324
|
+
platform = "ios" /* constants.PlatformTypes.ios */;
|
|
313
325
|
}
|
|
314
326
|
return path.join(pluginData.fullPath, "platforms", platform.toLowerCase());
|
|
315
327
|
};
|
|
@@ -366,6 +378,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
366
378
|
return _.keys(require(packageJsonFilePath).dependencies);
|
|
367
379
|
}
|
|
368
380
|
getNodeModuleData(module, projectDir) {
|
|
381
|
+
// module can be modulePath or moduleName
|
|
369
382
|
if (!this.$fs.exists(module) || path.basename(module) !== "package.json") {
|
|
370
383
|
module = this.getPackageJsonFilePathForModule(module, projectDir);
|
|
371
384
|
}
|
|
@@ -403,7 +416,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
403
416
|
});
|
|
404
417
|
}
|
|
405
418
|
parseNpmCommandResult(npmCommandResult) {
|
|
406
|
-
return npmCommandResult.split("@")[0];
|
|
419
|
+
return npmCommandResult.split("@")[0]; // returns plugin name
|
|
407
420
|
}
|
|
408
421
|
executeForAllInstalledPlatforms(action, projectData) {
|
|
409
422
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -420,6 +433,8 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
420
433
|
}
|
|
421
434
|
getInstalledFrameworkVersion(platform, projectData) {
|
|
422
435
|
const runtimePackage = this.$projectDataService.getRuntimePackage(projectData.projectDir, platform);
|
|
436
|
+
// const platformData = this.$platformsDataService.getPlatformData(platform, projectData);
|
|
437
|
+
// const frameworkData = this.$projectDataService.getNSValue(projectData.projectDir, platformData.frameworkPackageName);
|
|
423
438
|
return runtimePackage.version;
|
|
424
439
|
}
|
|
425
440
|
isPluginDataValidForPlatform(pluginData, platform, projectData) {
|
|
@@ -451,6 +466,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
451
466
|
}
|
|
452
467
|
getAllPluginsNativeHashes(pathToPluginsBuildFile) {
|
|
453
468
|
if (this.$options.hostProjectPath) {
|
|
469
|
+
// TODO: force rebuild plugins for now until we decide where to put .ns-plugins-build-data.json when embedding
|
|
454
470
|
return {};
|
|
455
471
|
}
|
|
456
472
|
let data = {};
|
|
@@ -461,6 +477,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
461
477
|
}
|
|
462
478
|
setPluginNativeHashes(opts) {
|
|
463
479
|
if (this.$options.hostProjectPath) {
|
|
480
|
+
// TODO: force rebuild plugins for now until we decide where to put .ns-plugins-build-data.json when embedding
|
|
464
481
|
return;
|
|
465
482
|
}
|
|
466
483
|
opts.allPluginsNativeHashes[opts.pluginData.name] =
|
|
@@ -481,3 +498,4 @@ PluginsService.LOCK_FILES = [
|
|
|
481
498
|
];
|
|
482
499
|
exports.PluginsService = PluginsService;
|
|
483
500
|
yok_1.injector.register("pluginsService", PluginsService);
|
|
501
|
+
//# sourceMappingURL=plugins-service.js.map
|
|
@@ -46,6 +46,7 @@ ProjectBackupService.Backup = class Backup {
|
|
|
46
46
|
backedUpPaths.push(pathToBackup);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
+
// create backup.json
|
|
49
50
|
this.$super.$fs.writeJson(path.resolve(this.backupDir, "_backup.json"), {
|
|
50
51
|
name: this.name,
|
|
51
52
|
paths: backedUpPaths,
|
|
@@ -66,6 +67,7 @@ ProjectBackupService.Backup = class Backup {
|
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
this.$super.$logger.trace(backupData);
|
|
70
|
+
// restore files
|
|
69
71
|
return this;
|
|
70
72
|
}
|
|
71
73
|
isUpToDate() {
|
|
@@ -75,6 +77,7 @@ ProjectBackupService.Backup = class Backup {
|
|
|
75
77
|
}
|
|
76
78
|
for (const pathToBackup of backupData.paths) {
|
|
77
79
|
const sourcePath = path.resolve(this.backupDir, pathToBackup);
|
|
80
|
+
// if any of the files don't exist the backup is not up-to-date
|
|
78
81
|
if (!this.$super.$fs.exists(sourcePath)) {
|
|
79
82
|
return false;
|
|
80
83
|
}
|
|
@@ -112,3 +115,4 @@ ProjectBackupService.Backup = class Backup {
|
|
|
112
115
|
};
|
|
113
116
|
exports.ProjectBackupService = ProjectBackupService;
|
|
114
117
|
yok_1.injector.register("projectBackupService", ProjectBackupService);
|
|
118
|
+
//# sourceMappingURL=project-backup-service.js.map
|
|
@@ -74,6 +74,7 @@ class ProjectChangesService {
|
|
|
74
74
|
this._prepareInfo.projectFileHash = this.getProjectFileStrippedHash(projectData.projectDir, platformData);
|
|
75
75
|
this._changesInfo.nativeChanged = this.isProjectFileChanged(projectData.projectDir, platformData);
|
|
76
76
|
}
|
|
77
|
+
// If this causes too much rebuilds of the plugins or uncecessary builds for Android, move overrideCocoapods to prepareInfo.
|
|
77
78
|
this._changesInfo.nsConfigChanged = this.filesChanged([
|
|
78
79
|
path.join(projectData.projectDir, constants_1.CONFIG_FILE_NAME_JS),
|
|
79
80
|
path.join(projectData.projectDir, constants_1.CONFIG_FILE_NAME_TS),
|
|
@@ -132,6 +133,7 @@ class ProjectChangesService {
|
|
|
132
133
|
}
|
|
133
134
|
getPrepareInfo(platformData) {
|
|
134
135
|
if (this.$options.hostProjectPath) {
|
|
136
|
+
// TODO: always prepare for now until we decide where to keep the .nsprepareinfo file when embedding
|
|
135
137
|
return null;
|
|
136
138
|
}
|
|
137
139
|
const prepareInfoFilePath = this.getPrepareInfoFilePath(platformData);
|
|
@@ -152,6 +154,7 @@ class ProjectChangesService {
|
|
|
152
154
|
yield this.ensurePrepareInfo(platformData, projectData, prepareData);
|
|
153
155
|
}
|
|
154
156
|
if (this.$options.hostProjectPath) {
|
|
157
|
+
// TODO: do not save for now until we decide where to keep the .nsprepareinfo file when embedding
|
|
155
158
|
return null;
|
|
156
159
|
}
|
|
157
160
|
const prepareInfoFilePath = this.getPrepareInfoFilePath(platformData);
|
|
@@ -163,7 +166,7 @@ class ProjectChangesService {
|
|
|
163
166
|
this._prepareInfo = this._prepareInfo || this.getPrepareInfo(platformData);
|
|
164
167
|
if (this._prepareInfo &&
|
|
165
168
|
addedPlatform.nativePlatformStatus ===
|
|
166
|
-
"3") {
|
|
169
|
+
"3" /* NativePlatformStatus.alreadyPrepared */) {
|
|
167
170
|
this._prepareInfo.nativePlatformStatus =
|
|
168
171
|
addedPlatform.nativePlatformStatus;
|
|
169
172
|
}
|
|
@@ -189,8 +192,8 @@ class ProjectChangesService {
|
|
|
189
192
|
return false;
|
|
190
193
|
}
|
|
191
194
|
const nativePlatformStatus = !prepareData.nativePrepare || !prepareData.nativePrepare.skipNativePrepare
|
|
192
|
-
? "2"
|
|
193
|
-
: "1"
|
|
195
|
+
? "2" /* NativePlatformStatus.requiresPrepare */
|
|
196
|
+
: "1" /* NativePlatformStatus.requiresPlatformAdd */;
|
|
194
197
|
this._prepareInfo = {
|
|
195
198
|
time: "",
|
|
196
199
|
nativePlatformStatus,
|
|
@@ -214,6 +217,13 @@ class ProjectChangesService {
|
|
|
214
217
|
const projectFileContents = this.$fs.readJson(projectFilePath);
|
|
215
218
|
const relevantProperties = ["dependencies"];
|
|
216
219
|
const projectFileStrippedContents = _.pick(projectFileContents, relevantProperties);
|
|
220
|
+
// _(this.$devicePlatformsConstants)
|
|
221
|
+
// .keys()
|
|
222
|
+
// .map(k => k.toLowerCase())
|
|
223
|
+
// .difference([platformData.platformNameLowerCase])
|
|
224
|
+
// .each(otherPlatform => {
|
|
225
|
+
// delete projectFileContents.nativescript[`tns-${otherPlatform}`];
|
|
226
|
+
// });
|
|
217
227
|
return (0, helpers_1.getHash)(JSON.stringify(projectFileStrippedContents));
|
|
218
228
|
}
|
|
219
229
|
isProjectFileChanged(projectDir, platformData) {
|
|
@@ -279,3 +289,4 @@ __decorate([
|
|
|
279
289
|
], ProjectChangesService.prototype, "checkForChanges", null);
|
|
280
290
|
exports.ProjectChangesService = ProjectChangesService;
|
|
281
291
|
yok_1.injector.register("projectChangesService", ProjectChangesService);
|
|
292
|
+
//# sourceMappingURL=project-changes-service.js.map
|
|
@@ -38,6 +38,7 @@ class ProjectCleanupService {
|
|
|
38
38
|
success = success && cleanRes.ok;
|
|
39
39
|
}
|
|
40
40
|
if (!(options === null || options === void 0 ? void 0 : options.silent)) {
|
|
41
|
+
// required to print an empty line for the spinner to not replace the last status... (probably a bug in the spinners)
|
|
41
42
|
console.log();
|
|
42
43
|
}
|
|
43
44
|
if (stats) {
|
|
@@ -100,3 +101,4 @@ class ProjectCleanupService {
|
|
|
100
101
|
}
|
|
101
102
|
exports.ProjectCleanupService = ProjectCleanupService;
|
|
102
103
|
yok_1.injector.register("projectCleanupService", ProjectCleanupService);
|
|
104
|
+
//# sourceMappingURL=project-cleanup-service.js.map
|
|
@@ -44,6 +44,7 @@ class ProjectConfigService {
|
|
|
44
44
|
return (this.forceUsingLegacyConfig = force);
|
|
45
45
|
}
|
|
46
46
|
requireFromString(src, filename) {
|
|
47
|
+
// @ts-ignore
|
|
47
48
|
const m = new module.constructor();
|
|
48
49
|
m.paths = module.paths;
|
|
49
50
|
m._compile(src, filename);
|
|
@@ -66,6 +67,7 @@ export default {
|
|
|
66
67
|
} as NativeScriptConfig;`.trim();
|
|
67
68
|
}
|
|
68
69
|
warnUsingLegacyNSConfig() {
|
|
70
|
+
// todo: remove hack
|
|
69
71
|
const isMigrate = _.get(this.$options, "argv._[0]") === "migrate";
|
|
70
72
|
if (isMigrate) {
|
|
71
73
|
return;
|
|
@@ -74,6 +76,7 @@ export default {
|
|
|
74
76
|
}
|
|
75
77
|
detectProjectConfigs(projectDir) {
|
|
76
78
|
var _a;
|
|
79
|
+
// allow overriding config name with env variable or --config (or -c)
|
|
77
80
|
let configName = (_a = process.env.NATIVESCRIPT_CONFIG_NAME) !== null && _a !== void 0 ? _a : this.$options.config;
|
|
78
81
|
if (configName === "false") {
|
|
79
82
|
configName = false;
|
|
@@ -103,6 +106,7 @@ export default {
|
|
|
103
106
|
const existingConfigs = possibleConfigPaths.filter((path) => {
|
|
104
107
|
return this.$fs.exists(path);
|
|
105
108
|
});
|
|
109
|
+
// push the first possible config into the "existing" list
|
|
106
110
|
const hasExistingConfig = !!existingConfigs.length;
|
|
107
111
|
if (!hasExistingConfig) {
|
|
108
112
|
this.$logger.trace(`No config file found - falling back to ${possibleConfigPaths[0]}.`);
|
|
@@ -195,15 +199,20 @@ export default {
|
|
|
195
199
|
singleQuote: true,
|
|
196
200
|
};
|
|
197
201
|
this.$logger.trace("updating config, prettier options: ", prettierOptions);
|
|
198
|
-
this.$fs.writeFile(configFilePath, (0, prettier_1.format)(newContent, Object.assign(Object.assign({}, prettierOptions), { parser: "typescript",
|
|
202
|
+
this.$fs.writeFile(configFilePath, (0, prettier_1.format)(newContent, Object.assign(Object.assign({}, prettierOptions), { parser: "typescript",
|
|
203
|
+
// note: we don't use plugins here, since we are only formatting ts files, and they are supported by default
|
|
204
|
+
// and this also causes issues with certain plugins, like prettier-plugin-tailwindcss.
|
|
205
|
+
plugins: [] })));
|
|
199
206
|
}
|
|
200
207
|
catch (error) {
|
|
201
208
|
this.$logger.error(`Failed to update config.` + error);
|
|
202
209
|
}
|
|
203
210
|
finally {
|
|
211
|
+
// verify config is updated correctly
|
|
204
212
|
if (this.getValue(key) !== value) {
|
|
205
213
|
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}`);
|
|
206
214
|
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}`);
|
|
215
|
+
// restore original content
|
|
207
216
|
this.$fs.writeFile(configFilePath, configContent);
|
|
208
217
|
return false;
|
|
209
218
|
}
|
|
@@ -233,9 +242,11 @@ export default {
|
|
|
233
242
|
? this.$fs.readJson(info.NSConfigPath)
|
|
234
243
|
: {};
|
|
235
244
|
try {
|
|
245
|
+
// injecting here to avoid circular dependency
|
|
236
246
|
const projectData = this.$injector.resolve("projectData");
|
|
237
247
|
const embeddedPackageJsonPath = path.resolve(this.projectHelper.projectDir, projectData.getAppDirectoryRelativePath(), constants.PACKAGE_JSON_FILE_NAME);
|
|
238
248
|
const embeddedPackageJson = this.$fs.readJson(embeddedPackageJsonPath);
|
|
249
|
+
// filter only the supported keys
|
|
239
250
|
additionalData.push(_.pick(embeddedPackageJson, [
|
|
240
251
|
"android",
|
|
241
252
|
"ios",
|
|
@@ -247,9 +258,11 @@ export default {
|
|
|
247
258
|
}
|
|
248
259
|
catch (err) {
|
|
249
260
|
this.$logger.trace("failed to add embedded package.json data to config", err);
|
|
261
|
+
// ignore if the file doesn't exist
|
|
250
262
|
}
|
|
251
263
|
try {
|
|
252
264
|
const packageJson = this.$fs.readJson(path.join(this.projectHelper.projectDir, "package.json"));
|
|
265
|
+
// add app id to additionalData for backwards compatibility
|
|
253
266
|
if (!NSConfig.id &&
|
|
254
267
|
packageJson &&
|
|
255
268
|
packageJson.nativescript &&
|
|
@@ -273,8 +286,10 @@ export default {
|
|
|
273
286
|
}
|
|
274
287
|
catch (err) {
|
|
275
288
|
this.$logger.trace("failed to read package.json data for config", err);
|
|
289
|
+
// ignore if the file doesn't exist
|
|
276
290
|
}
|
|
277
291
|
return _.defaultsDeep({}, ...additionalData, NSConfig);
|
|
292
|
+
// return Object.assign({}, ...additionalData, NSConfig);
|
|
278
293
|
}
|
|
279
294
|
writeLegacyNSConfigIfNeeded(projectDir, runtimePackage) {
|
|
280
295
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -284,6 +299,8 @@ export default {
|
|
|
284
299
|
}
|
|
285
300
|
if (runtimePackage.version &&
|
|
286
301
|
semver.gte(semver.coerce(runtimePackage.version), "7.0.0-rc.5")) {
|
|
302
|
+
// runtimes >= 7.0.0-rc.5 support passing appPath and appResourcesPath through gradle project flags
|
|
303
|
+
// so writing an nsconfig is not necessary.
|
|
287
304
|
return;
|
|
288
305
|
}
|
|
289
306
|
const runtimePackageDisplay = `${runtimePackage.name}${runtimePackage.version ? " v" + runtimePackage.version : ""}`;
|
|
@@ -300,9 +317,11 @@ You may add \`nsconfig.json\` to \`.gitignore\` as the CLI will regenerate it as
|
|
|
300
317
|
appPath: this.getValue("appPath"),
|
|
301
318
|
appResourcesPath: this.getValue("appResourcesPath"),
|
|
302
319
|
});
|
|
320
|
+
// mark the file for cleanup after the CLI exits
|
|
303
321
|
yield this.$cleanupService.addCleanupDeleteAction(nsConfigPath);
|
|
304
322
|
});
|
|
305
323
|
}
|
|
324
|
+
// todo: move into config manipulation
|
|
306
325
|
flattenObjectToPaths(obj, basePath) {
|
|
307
326
|
const toPath = (key) => [basePath, key].filter(Boolean).join(".");
|
|
308
327
|
return Object.keys(obj).reduce((all, key) => {
|
|
@@ -320,7 +339,7 @@ You may add \`nsconfig.json\` to \`.gitignore\` as the CLI will regenerate it as
|
|
|
320
339
|
}
|
|
321
340
|
}
|
|
322
341
|
__decorate([
|
|
323
|
-
(0, decorators_1.cache)()
|
|
342
|
+
(0, decorators_1.cache)() // @cache should prevent the message being printed multiple times
|
|
324
343
|
], ProjectConfigService.prototype, "warnUsingLegacyNSConfig", null);
|
|
325
344
|
__decorate([
|
|
326
345
|
(0, decorators_1.exported)("projectConfigService")
|
|
@@ -333,3 +352,4 @@ __decorate([
|
|
|
333
352
|
], ProjectConfigService.prototype, "setValue", null);
|
|
334
353
|
exports.ProjectConfigService = ProjectConfigService;
|
|
335
354
|
yok_1.injector.register("projectConfigService", ProjectConfigService);
|
|
355
|
+
//# sourceMappingURL=project-config-service.js.map
|