nativescript 9.0.4-dev.1 → 9.0.4-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/android-tools-info.js +12 -0
- package/lib/base-package-manager.js +7 -0
- package/lib/bootstrap.js +5 -1
- package/lib/bun-package-manager.js +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 +2 -1
- package/lib/commands/hooks/hooks-lock.js +1 -0
- package/lib/commands/hooks/hooks.js +1 -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/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/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 +68 -1
- 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 +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 +18 -0
- package/lib/services/ios/xcodebuild-args-service.js +11 -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 +100 -1
- package/lib/services/ios-provision-service.js +3 -0
- package/lib/services/ios-watch-app-service.js +1 -0
- package/lib/services/ip-service.js +2 -0
- package/lib/services/itmstransporter-service.js +1 -0
- package/lib/services/karma-execution.js +2 -0
- package/lib/services/livesync/android-device-livesync-service-base.js +1 -0
- package/lib/services/livesync/android-device-livesync-service.js +2 -0
- package/lib/services/livesync/android-device-livesync-sockets-service.js +3 -0
- package/lib/services/livesync/android-livesync-service.js +1 -0
- package/lib/services/livesync/android-livesync-tool.js +4 -0
- package/lib/services/livesync/device-livesync-service-base.js +2 -0
- package/lib/services/livesync/ios-device-livesync-service.js +7 -0
- package/lib/services/livesync/ios-livesync-service.js +2 -0
- package/lib/services/livesync/livesync-socket.js +1 -0
- package/lib/services/livesync/platform-livesync-service-base.js +5 -0
- package/lib/services/livesync-process-data-service.js +1 -0
- package/lib/services/log-parser-service.js +1 -0
- package/lib/services/log-source-map-service.js +15 -0
- package/lib/services/marking-mode-service.js +8 -5
- package/lib/services/metadata-filtering-service.js +1 -0
- package/lib/services/npm-config-service.js +4 -0
- package/lib/services/pacote-service.js +7 -0
- package/lib/services/performance-service.js +3 -1
- package/lib/services/platform/add-platform-service.js +49 -2
- package/lib/services/platform/platform-validation-service.js +1 -0
- package/lib/services/platform/prepare-native-platform-service.js +5 -2
- package/lib/services/platform-environment-requirements.js +8 -3
- package/lib/services/platform-project-service-base.js +1 -0
- package/lib/services/platforms-data-service.js +1 -0
- package/lib/services/plugins-service.js +20 -2
- package/lib/services/prepare-data-service.js +1 -0
- package/lib/services/project-backup-service.js +4 -0
- package/lib/services/project-changes-service.js +14 -3
- package/lib/services/project-cleanup-service.js +2 -0
- package/lib/services/project-config-service.js +21 -2
- package/lib/services/project-data-service.js +36 -7
- package/lib/services/project-name-service.js +1 -0
- package/lib/services/project-service.js +10 -0
- package/lib/services/project-templates-service.js +3 -2
- package/lib/services/qr-code-terminal-service.js +1 -0
- package/lib/services/require-service.js +1 -0
- package/lib/services/start-service.js +1 -0
- package/lib/services/temp-service.js +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 +1 -1
|
@@ -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
|
};
|
|
@@ -352,6 +364,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
352
364
|
return _.keys(require(packageJsonFilePath).dependencies);
|
|
353
365
|
}
|
|
354
366
|
getNodeModuleData(module, projectDir) {
|
|
367
|
+
// module can be modulePath or moduleName
|
|
355
368
|
if (!this.$fs.exists(module) || path.basename(module) !== "package.json") {
|
|
356
369
|
module = this.getPackageJsonFilePathForModule(module, projectDir);
|
|
357
370
|
}
|
|
@@ -383,7 +396,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
383
396
|
return this.parseNpmCommandResult(npmCommandArguments);
|
|
384
397
|
}
|
|
385
398
|
parseNpmCommandResult(npmCommandResult) {
|
|
386
|
-
return npmCommandResult.split("@")[0];
|
|
399
|
+
return npmCommandResult.split("@")[0]; // returns plugin name
|
|
387
400
|
}
|
|
388
401
|
async executeForAllInstalledPlatforms(action, projectData) {
|
|
389
402
|
const availablePlatforms = this.$mobileHelper.platformNames.map((p) => p.toLowerCase());
|
|
@@ -398,6 +411,8 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
398
411
|
}
|
|
399
412
|
getInstalledFrameworkVersion(platform, projectData) {
|
|
400
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);
|
|
401
416
|
return runtimePackage.version;
|
|
402
417
|
}
|
|
403
418
|
isPluginDataValidForPlatform(pluginData, platform, projectData) {
|
|
@@ -427,6 +442,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
427
442
|
}
|
|
428
443
|
getAllPluginsNativeHashes(pathToPluginsBuildFile) {
|
|
429
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
|
|
430
446
|
return {};
|
|
431
447
|
}
|
|
432
448
|
let data = {};
|
|
@@ -437,6 +453,7 @@ This framework comes from ${dependencyName} plugin, which is installed multiple
|
|
|
437
453
|
}
|
|
438
454
|
setPluginNativeHashes(opts) {
|
|
439
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
|
|
440
457
|
return;
|
|
441
458
|
}
|
|
442
459
|
opts.allPluginsNativeHashes[opts.pluginData.name] =
|
|
@@ -457,3 +474,4 @@ PluginsService.LOCK_FILES = [
|
|
|
457
474
|
"pnpm-lock.yaml",
|
|
458
475
|
];
|
|
459
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
|
|
@@ -27,12 +27,14 @@ class ProjectDataService {
|
|
|
27
27
|
this.$injector = $injector;
|
|
28
28
|
this.projectDataCache = {};
|
|
29
29
|
try {
|
|
30
|
+
// add the ProjectData of the default projectDir to the projectData cache
|
|
30
31
|
const projectData = this.$injector.resolve("projectData");
|
|
31
32
|
projectData.initializeProjectData();
|
|
32
33
|
this.defaultProjectDir = projectData.projectDir;
|
|
33
34
|
this.projectDataCache[this.defaultProjectDir] = projectData;
|
|
34
35
|
}
|
|
35
36
|
catch (e) {
|
|
37
|
+
// the CLI is required as a lib from a non-project folder
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
get $pluginsService() {
|
|
@@ -61,6 +63,8 @@ class ProjectDataService {
|
|
|
61
63
|
delete projectFileInfo.projectData[ProjectDataService.DEPENDENCIES_KEY_NAME][dependencyName];
|
|
62
64
|
this.$fs.writeJson(projectFileInfo.projectFilePath, projectFileInfo.projectData);
|
|
63
65
|
}
|
|
66
|
+
// TODO: Add tests
|
|
67
|
+
// TODO: Remove $projectData and replace it with $projectDataService.getProjectData
|
|
64
68
|
getProjectData(projectDir) {
|
|
65
69
|
projectDir = projectDir || this.defaultProjectDir;
|
|
66
70
|
this.projectDataCache[projectDir] =
|
|
@@ -112,6 +116,10 @@ class ProjectDataService {
|
|
|
112
116
|
this.$logger.trace(`"${propertyName}" property successfully removed.`);
|
|
113
117
|
}
|
|
114
118
|
async getAndroidAssetsStructure(opts) {
|
|
119
|
+
// TODO: Use image-size package to get the width and height of an image.
|
|
120
|
+
// TODO: Parse the splash_screen.xml in nodpi directory and get from it the names of the background and center image.
|
|
121
|
+
// TODO: Parse the AndroidManifest.xml to get the name of the icon.
|
|
122
|
+
// This way we'll not use the image-definitions.json and the method will return the real android structure.
|
|
115
123
|
const projectDir = opts.projectDir;
|
|
116
124
|
const projectData = this.getProjectData(projectDir);
|
|
117
125
|
const pathToAndroidDir = path.join(projectData.appResourcesDirectoryPath, this.$devicePlatformsConstants.Android);
|
|
@@ -125,6 +133,7 @@ class ProjectDataService {
|
|
|
125
133
|
useLegacy = !manifest.includes(`android:icon="@mipmap/ic_launcher"`);
|
|
126
134
|
}
|
|
127
135
|
catch (err) {
|
|
136
|
+
// ignore
|
|
128
137
|
}
|
|
129
138
|
const content = this.getImageDefinitions()[useLegacy ? "android_legacy" : "android"];
|
|
130
139
|
return {
|
|
@@ -148,6 +157,8 @@ class ProjectDataService {
|
|
|
148
157
|
}
|
|
149
158
|
if (fstat.isDirectory()) {
|
|
150
159
|
if (filePath === pathToProjectNodeModules) {
|
|
160
|
+
// we do not want to get the files from node_modules directory of the project.
|
|
161
|
+
// We'll get here only when you have nativescript.config with appDirectoryPath set to "."
|
|
151
162
|
return false;
|
|
152
163
|
}
|
|
153
164
|
return true;
|
|
@@ -162,6 +173,9 @@ class ProjectDataService {
|
|
|
162
173
|
}
|
|
163
174
|
}
|
|
164
175
|
updateNsConfigValue(projectDir, updateObject, propertiesToRemove) {
|
|
176
|
+
// todo: figure out a way to update js/ts configs
|
|
177
|
+
// most likely needs an ast parser/writer
|
|
178
|
+
// should be delegated to the config service
|
|
165
179
|
const nsConfigPath = path.join(projectDir, constants.CONFIG_FILE_NAME_JS);
|
|
166
180
|
const currentNsConfig = this.getNsConfig(nsConfigPath);
|
|
167
181
|
let newNsConfig = currentNsConfig;
|
|
@@ -202,10 +216,14 @@ class ProjectDataService {
|
|
|
202
216
|
const imageDefinitions = this.getImageDefinitions().ios;
|
|
203
217
|
_.each(content && content.images, (image) => {
|
|
204
218
|
let foundMatchingDefinition = false;
|
|
219
|
+
// In some cases the image may not be available, it will just be described.
|
|
220
|
+
// When this happens, the filename will be empty.
|
|
221
|
+
// So we'll keep the path empty as well.
|
|
205
222
|
if (image.filename) {
|
|
206
223
|
image.path = path.join(dirPath, image.filename);
|
|
207
224
|
}
|
|
208
225
|
if (image.size) {
|
|
226
|
+
// size is basically <width>x<height>
|
|
209
227
|
const [width, height] = image.size
|
|
210
228
|
.toString()
|
|
211
229
|
.split(constants_1.AssetConstants.sizeDelimiter);
|
|
@@ -214,6 +232,7 @@ class ProjectDataService {
|
|
|
214
232
|
image.height = +height;
|
|
215
233
|
}
|
|
216
234
|
}
|
|
235
|
+
// Find the image size based on the hardcoded values in the image-definitions.json
|
|
217
236
|
_.each(imageDefinitions, (assetSubGroup) => {
|
|
218
237
|
const assetItem = _.find(assetSubGroup, (assetElement) => assetElement.filename === image.filename &&
|
|
219
238
|
path.basename(assetElement.directory) === path.basename(dirPath));
|
|
@@ -233,6 +252,7 @@ class ProjectDataService {
|
|
|
233
252
|
image.scale = image.scale || assetItem.scale;
|
|
234
253
|
image.rgba = assetItem.rgba;
|
|
235
254
|
finalContent.images.push(image);
|
|
255
|
+
// break each
|
|
236
256
|
return false;
|
|
237
257
|
}
|
|
238
258
|
});
|
|
@@ -335,13 +355,16 @@ class ProjectDataService {
|
|
|
335
355
|
getRuntimePackage(projectDir, platform) {
|
|
336
356
|
platform = platform.toLowerCase();
|
|
337
357
|
const packageJson = this.$fs.readJson(path.join(projectDir, constants.PACKAGE_JSON_FILE_NAME));
|
|
338
|
-
const runtimeName = platform === "android"
|
|
358
|
+
const runtimeName = platform === "android" /* PlatformTypes.android */
|
|
339
359
|
? constants.TNS_ANDROID_RUNTIME_NAME
|
|
340
360
|
: constants.TNS_IOS_RUNTIME_NAME;
|
|
341
361
|
if (packageJson &&
|
|
342
362
|
packageJson.nativescript &&
|
|
343
363
|
packageJson.nativescript[runtimeName] &&
|
|
344
364
|
packageJson.nativescript[runtimeName].version) {
|
|
365
|
+
// if we have a nativescript key with a runtime version in package.json
|
|
366
|
+
// that means we are dealing with a legacy project, and should respect
|
|
367
|
+
// that information
|
|
345
368
|
return {
|
|
346
369
|
name: runtimeName,
|
|
347
370
|
version: packageJson.nativescript[runtimeName].version,
|
|
@@ -353,19 +376,19 @@ class ProjectDataService {
|
|
|
353
376
|
const runtimePackage = this.$pluginsService
|
|
354
377
|
.getDependenciesFromPackageJson(projectDir)
|
|
355
378
|
.devDependencies.find((d) => {
|
|
356
|
-
if (platform === "ios") {
|
|
379
|
+
if (platform === "ios" /* constants.PlatformTypes.ios */) {
|
|
357
380
|
return [
|
|
358
381
|
constants.SCOPED_IOS_RUNTIME_NAME,
|
|
359
382
|
constants.TNS_IOS_RUNTIME_NAME,
|
|
360
383
|
].includes(d.name);
|
|
361
384
|
}
|
|
362
|
-
else if (platform === "android") {
|
|
385
|
+
else if (platform === "android" /* constants.PlatformTypes.android */) {
|
|
363
386
|
return [
|
|
364
387
|
constants.SCOPED_ANDROID_RUNTIME_NAME,
|
|
365
388
|
constants.TNS_ANDROID_RUNTIME_NAME,
|
|
366
389
|
].includes(d.name);
|
|
367
390
|
}
|
|
368
|
-
else if (platform === "visionos") {
|
|
391
|
+
else if (platform === "visionos" /* constants.PlatformTypes.visionos */) {
|
|
369
392
|
return d.name === constants.SCOPED_VISIONOS_RUNTIME_NAME;
|
|
370
393
|
}
|
|
371
394
|
});
|
|
@@ -373,12 +396,14 @@ class ProjectDataService {
|
|
|
373
396
|
const coerced = semver.coerce(runtimePackage.version);
|
|
374
397
|
const isRange = !!coerced && coerced.version !== runtimePackage.version;
|
|
375
398
|
const isTag = !coerced;
|
|
399
|
+
// in case we are using a local tgz for the runtime or a range like ~8.0.0, ^8.0.0 etc. or a tag like JSC
|
|
376
400
|
if (runtimePackage.version.includes("tgz") || isRange || isTag) {
|
|
377
401
|
try {
|
|
378
402
|
const runtimePackageJsonPath = (0, package_path_helper_1.resolvePackageJSONPath)(runtimePackage.name, {
|
|
379
403
|
paths: [projectDir],
|
|
380
404
|
});
|
|
381
405
|
if (!runtimePackageJsonPath) {
|
|
406
|
+
// caught below
|
|
382
407
|
throw new Error("Runtime package.json not found.");
|
|
383
408
|
}
|
|
384
409
|
runtimePackage.version = this.$fs.readJson(runtimePackageJsonPath).version;
|
|
@@ -395,20 +420,21 @@ class ProjectDataService {
|
|
|
395
420
|
}
|
|
396
421
|
return runtimePackage;
|
|
397
422
|
}
|
|
423
|
+
// default to the scoped runtimes
|
|
398
424
|
this.$logger.trace("Could not find an installed runtime, falling back to default runtimes");
|
|
399
|
-
if (platform === "ios") {
|
|
425
|
+
if (platform === "ios" /* constants.PlatformTypes.ios */) {
|
|
400
426
|
return {
|
|
401
427
|
name: constants.SCOPED_IOS_RUNTIME_NAME,
|
|
402
428
|
version: null,
|
|
403
429
|
};
|
|
404
430
|
}
|
|
405
|
-
else if (platform === "android") {
|
|
431
|
+
else if (platform === "android" /* constants.PlatformTypes.android */) {
|
|
406
432
|
return {
|
|
407
433
|
name: constants.SCOPED_ANDROID_RUNTIME_NAME,
|
|
408
434
|
version: null,
|
|
409
435
|
};
|
|
410
436
|
}
|
|
411
|
-
else if (platform === "visionos") {
|
|
437
|
+
else if (platform === "visionos" /* constants.PlatformTypes.visionos */) {
|
|
412
438
|
return {
|
|
413
439
|
name: constants.SCOPED_VISIONOS_RUNTIME_NAME,
|
|
414
440
|
version: null,
|
|
@@ -443,9 +469,11 @@ __decorate([
|
|
|
443
469
|
return projectDir + ":" + platform;
|
|
444
470
|
},
|
|
445
471
|
shouldCache(result) {
|
|
472
|
+
// don't cache coerced versions
|
|
446
473
|
if (result._coerced) {
|
|
447
474
|
return false;
|
|
448
475
|
}
|
|
476
|
+
// only cache if version is defined
|
|
449
477
|
return !!result.version;
|
|
450
478
|
},
|
|
451
479
|
})
|
|
@@ -454,3 +482,4 @@ __decorate([
|
|
|
454
482
|
(0, decorators_1.exported)("projectDataService")
|
|
455
483
|
], ProjectDataService.prototype, "getNsConfigDefaultContent", null);
|
|
456
484
|
yok_1.injector.register("projectDataService", ProjectDataService);
|
|
485
|
+
//# sourceMappingURL=project-data-service.js.map
|
|
@@ -64,11 +64,15 @@ class ProjectService {
|
|
|
64
64
|
appId: appId,
|
|
65
65
|
projectName,
|
|
66
66
|
});
|
|
67
|
+
// can pass --no-git to skip creating a git repo
|
|
68
|
+
// useful in monorepos where we're creating
|
|
69
|
+
// sub projects in an existing git repo.
|
|
67
70
|
if (this.$options.git) {
|
|
68
71
|
try {
|
|
69
72
|
if (!this.$options.force) {
|
|
70
73
|
const git = (0, simple_git_1.default)(projectDir);
|
|
71
74
|
if (await git.checkIsRepo()) {
|
|
75
|
+
// throwing here since we're catching below.
|
|
72
76
|
throw new Error("Already part of a git repository.");
|
|
73
77
|
}
|
|
74
78
|
}
|
|
@@ -108,6 +112,7 @@ class ProjectService {
|
|
|
108
112
|
this.alterPackageJsonData(projectCreationSettings);
|
|
109
113
|
this.$projectConfigService.writeDefaultConfig(projectDir, appId);
|
|
110
114
|
await this.ensureAppResourcesExist(projectDir);
|
|
115
|
+
// Install devDependencies and execute all scripts:
|
|
111
116
|
await this.$packageManager.install(projectDir, projectDir, {
|
|
112
117
|
disableNpmInstall: false,
|
|
113
118
|
frameworkPath: null,
|
|
@@ -137,6 +142,7 @@ class ProjectService {
|
|
|
137
142
|
this.$logger.trace("Project does not have App_Resources - fetching from default template.");
|
|
138
143
|
this.$fs.createDirectory(appResourcesDestinationPath);
|
|
139
144
|
const tempDir = await this.$tempService.mkdirSync("ns-default-template");
|
|
145
|
+
// the template installed doesn't have App_Resources -> get from a default template
|
|
140
146
|
await this.$pacoteService.extractPackage(constants.RESERVED_TEMPLATE_NAMES["default"], tempDir);
|
|
141
147
|
const templateProjectData = this.$projectDataService.getProjectData(tempDir);
|
|
142
148
|
const templateAppResourcesDir = templateProjectData.getAppResourcesDirectoryPath(tempDir);
|
|
@@ -147,12 +153,14 @@ class ProjectService {
|
|
|
147
153
|
const { projectDir, projectName } = projectCreationSettings;
|
|
148
154
|
const projectFilePath = path.join(projectDir, this.$staticConfig.PROJECT_FILE_NAME);
|
|
149
155
|
let packageJsonData = this.$fs.readJson(projectFilePath);
|
|
156
|
+
// clean up keys from the template package.json that we don't care about.
|
|
150
157
|
Object.keys(packageJsonData).forEach((key) => {
|
|
151
158
|
if (key.startsWith("_") ||
|
|
152
159
|
constants.TemplatesV2PackageJsonKeysToRemove.includes(key)) {
|
|
153
160
|
delete packageJsonData[key];
|
|
154
161
|
}
|
|
155
162
|
});
|
|
163
|
+
// this is used to ensure the order of keys is consistent, the blanks are filled in from the template
|
|
156
164
|
const packageJsonSchema = {
|
|
157
165
|
name: projectName,
|
|
158
166
|
main: "",
|
|
@@ -160,6 +168,7 @@ class ProjectService {
|
|
|
160
168
|
private: true,
|
|
161
169
|
dependencies: {},
|
|
162
170
|
devDependencies: {},
|
|
171
|
+
// anythign else would go below
|
|
163
172
|
};
|
|
164
173
|
packageJsonData = Object.assign(packageJsonSchema, packageJsonData);
|
|
165
174
|
this.$fs.writeJson(projectFilePath, packageJsonData);
|
|
@@ -183,3 +192,4 @@ __decorate([
|
|
|
183
192
|
(0, decorators_2.performanceLog)()
|
|
184
193
|
], ProjectService.prototype, "alterPackageJsonData", null);
|
|
185
194
|
yok_1.injector.register("projectService", ProjectService);
|
|
195
|
+
//# sourceMappingURL=project-service.js.map
|
|
@@ -40,12 +40,12 @@ class ProjectTemplatesService {
|
|
|
40
40
|
const templateNameToBeTracked = this.getTemplateNameToBeTracked(templateValue, templatePackageJsonContent);
|
|
41
41
|
if (templateNameToBeTracked) {
|
|
42
42
|
await this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
43
|
-
action: "Create project"
|
|
43
|
+
action: "Create project" /* constants.TrackActionNames.CreateProject */,
|
|
44
44
|
isForDevice: null,
|
|
45
45
|
additionalData: templateNameToBeTracked,
|
|
46
46
|
});
|
|
47
47
|
await this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
48
|
-
action: "Using Template"
|
|
48
|
+
action: "Using Template" /* constants.TrackActionNames.UsingTemplate */,
|
|
49
49
|
additionalData: templateNameToBeTracked,
|
|
50
50
|
});
|
|
51
51
|
}
|
|
@@ -97,3 +97,4 @@ __decorate([
|
|
|
97
97
|
(0, decorators_1.performanceLog)()
|
|
98
98
|
], ProjectTemplatesService.prototype, "prepareTemplate", null);
|
|
99
99
|
yok_1.injector.register("projectTemplatesService", ProjectTemplatesService);
|
|
100
|
+
//# sourceMappingURL=project-templates-service.js.map
|
|
@@ -8,12 +8,14 @@ const yok_1 = require("../common/yok");
|
|
|
8
8
|
class TempService {
|
|
9
9
|
constructor($cleanupService) {
|
|
10
10
|
this.$cleanupService = $cleanupService;
|
|
11
|
+
// no-op
|
|
11
12
|
}
|
|
12
13
|
async mkdirSync(affixes) {
|
|
13
14
|
var _a;
|
|
14
15
|
const opts = typeof affixes === "string" ? { prefix: affixes } : affixes;
|
|
15
16
|
const baseDir = (opts === null || opts === void 0 ? void 0 : opts.dir) ? opts.dir : (0, os_1.tmpdir)();
|
|
16
17
|
const prefix = ((_a = opts === null || opts === void 0 ? void 0 : opts.prefix) !== null && _a !== void 0 ? _a : "ns-").replace(/\s+/g, "-");
|
|
18
|
+
// fs.mkdtempSync requires the full path prefix
|
|
17
19
|
const pathToDir = fs.mkdtempSync(path.join(baseDir, prefix));
|
|
18
20
|
await this.$cleanupService.addCleanupDeleteAction(pathToDir);
|
|
19
21
|
return pathToDir;
|
|
@@ -33,3 +35,4 @@ class TempService {
|
|
|
33
35
|
}
|
|
34
36
|
exports.TempService = TempService;
|
|
35
37
|
yok_1.injector.register("tempService", TempService);
|
|
38
|
+
//# sourceMappingURL=temp-service.js.map
|