nativescript 8.7.0-rc.0 → 8.7.0-rc.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 +7 -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 +20 -3
- 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 +34 -19
- package/lib/commands/debug.js +6 -1
- package/lib/commands/deploy.js +3 -2
- 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/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 +3 -2
- 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 +1 -0
- 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/definitions/mobile.d.ts +1 -1
- 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 +5 -0
- package/lib/common/mobile/android/genymotion/virtualbox-service.js +11 -0
- package/lib/common/mobile/android/logcat-helper.js +20 -1
- 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 +72 -3
- package/lib/common/mobile/mobile-core/ios-device-discovery.js +3 -1
- package/lib/common/mobile/mobile-core/ios-simulator-discovery.js +3 -0
- package/lib/common/mobile/mobile-helper.js +2 -1
- 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 +12 -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 +58 -5
- 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 +15 -5
- 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 +3 -2
- 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 +5 -2
- 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 +141 -115
- 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 +2 -1
- 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 +28 -0
- 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 +2 -1
- 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 +10 -1
- package/lib/services/ios/xcodebuild-args-service.js +13 -4
- 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 +29 -7
- 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 +47 -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 +18 -2
- package/lib/services/prepare-data-service.js +2 -1
- package/lib/services/project-backup-service.js +4 -0
- package/lib/services/project-changes-service.js +12 -3
- package/lib/services/project-cleanup-service.js +2 -0
- package/lib/services/project-config-service.js +18 -1
- 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 +1 -1
|
@@ -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) {
|
|
@@ -475,3 +490,4 @@ PluginsService.LOCK_FILES = [
|
|
|
475
490
|
];
|
|
476
491
|
exports.PluginsService = PluginsService;
|
|
477
492
|
yok_1.injector.register("pluginsService", PluginsService);
|
|
493
|
+
//# sourceMappingURL=plugins-service.js.map
|
|
@@ -9,7 +9,7 @@ class PrepareDataService {
|
|
|
9
9
|
}
|
|
10
10
|
getPrepareData(projectDir, platform, data) {
|
|
11
11
|
const platformLowerCase = platform.toLowerCase();
|
|
12
|
-
if (this.$mobileHelper.
|
|
12
|
+
if (this.$mobileHelper.isApplePlatform(platform)) {
|
|
13
13
|
return new prepare_data_1.IOSPrepareData(projectDir, platformLowerCase, data);
|
|
14
14
|
}
|
|
15
15
|
else if (this.$mobileHelper.isAndroidPlatform(platform)) {
|
|
@@ -19,3 +19,4 @@ class PrepareDataService {
|
|
|
19
19
|
}
|
|
20
20
|
exports.PrepareDataService = PrepareDataService;
|
|
21
21
|
yok_1.injector.register("prepareDataService", PrepareDataService);
|
|
22
|
+
//# sourceMappingURL=prepare-data-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
|
|
@@ -73,6 +73,7 @@ class ProjectChangesService {
|
|
|
73
73
|
this._prepareInfo.projectFileHash = this.getProjectFileStrippedHash(projectData.projectDir, platformData);
|
|
74
74
|
this._changesInfo.nativeChanged = this.isProjectFileChanged(projectData.projectDir, platformData);
|
|
75
75
|
}
|
|
76
|
+
// If this causes too much rebuilds of the plugins or uncecessary builds for Android, move overrideCocoapods to prepareInfo.
|
|
76
77
|
this._changesInfo.nsConfigChanged = this.filesChanged([
|
|
77
78
|
path.join(projectData.projectDir, constants_1.CONFIG_FILE_NAME_JS),
|
|
78
79
|
path.join(projectData.projectDir, constants_1.CONFIG_FILE_NAME_TS),
|
|
@@ -156,7 +157,7 @@ class ProjectChangesService {
|
|
|
156
157
|
this._prepareInfo = this._prepareInfo || this.getPrepareInfo(platformData);
|
|
157
158
|
if (this._prepareInfo &&
|
|
158
159
|
addedPlatform.nativePlatformStatus ===
|
|
159
|
-
"3") {
|
|
160
|
+
"3" /* NativePlatformStatus.alreadyPrepared */) {
|
|
160
161
|
this._prepareInfo.nativePlatformStatus =
|
|
161
162
|
addedPlatform.nativePlatformStatus;
|
|
162
163
|
}
|
|
@@ -182,8 +183,8 @@ class ProjectChangesService {
|
|
|
182
183
|
return false;
|
|
183
184
|
}
|
|
184
185
|
const nativePlatformStatus = !prepareData.nativePrepare || !prepareData.nativePrepare.skipNativePrepare
|
|
185
|
-
? "2"
|
|
186
|
-
: "1"
|
|
186
|
+
? "2" /* NativePlatformStatus.requiresPrepare */
|
|
187
|
+
: "1" /* NativePlatformStatus.requiresPlatformAdd */;
|
|
187
188
|
this._prepareInfo = {
|
|
188
189
|
time: "",
|
|
189
190
|
nativePlatformStatus,
|
|
@@ -207,6 +208,13 @@ class ProjectChangesService {
|
|
|
207
208
|
const projectFileContents = this.$fs.readJson(projectFilePath);
|
|
208
209
|
const relevantProperties = ["dependencies"];
|
|
209
210
|
const projectFileStrippedContents = _.pick(projectFileContents, relevantProperties);
|
|
211
|
+
// _(this.$devicePlatformsConstants)
|
|
212
|
+
// .keys()
|
|
213
|
+
// .map(k => k.toLowerCase())
|
|
214
|
+
// .difference([platformData.platformNameLowerCase])
|
|
215
|
+
// .each(otherPlatform => {
|
|
216
|
+
// delete projectFileContents.nativescript[`tns-${otherPlatform}`];
|
|
217
|
+
// });
|
|
210
218
|
return (0, helpers_1.getHash)(JSON.stringify(projectFileStrippedContents));
|
|
211
219
|
}
|
|
212
220
|
isProjectFileChanged(projectDir, platformData) {
|
|
@@ -272,3 +280,4 @@ __decorate([
|
|
|
272
280
|
], ProjectChangesService.prototype, "checkForChanges", null);
|
|
273
281
|
exports.ProjectChangesService = ProjectChangesService;
|
|
274
282
|
yok_1.injector.register("projectChangesService", ProjectChangesService);
|
|
283
|
+
//# 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]}.`);
|
|
@@ -201,9 +205,11 @@ export default {
|
|
|
201
205
|
this.$logger.error(`Failed to update config.` + error);
|
|
202
206
|
}
|
|
203
207
|
finally {
|
|
208
|
+
// verify config is updated correctly
|
|
204
209
|
if (this.getValue(key) !== value) {
|
|
205
210
|
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
211
|
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}`);
|
|
212
|
+
// restore original content
|
|
207
213
|
this.$fs.writeFile(configFilePath, configContent);
|
|
208
214
|
return false;
|
|
209
215
|
}
|
|
@@ -233,9 +239,11 @@ export default {
|
|
|
233
239
|
? this.$fs.readJson(info.NSConfigPath)
|
|
234
240
|
: {};
|
|
235
241
|
try {
|
|
242
|
+
// injecting here to avoid circular dependency
|
|
236
243
|
const projectData = this.$injector.resolve("projectData");
|
|
237
244
|
const embeddedPackageJsonPath = path.resolve(this.projectHelper.projectDir, projectData.getAppDirectoryRelativePath(), constants.PACKAGE_JSON_FILE_NAME);
|
|
238
245
|
const embeddedPackageJson = this.$fs.readJson(embeddedPackageJsonPath);
|
|
246
|
+
// filter only the supported keys
|
|
239
247
|
additionalData.push(_.pick(embeddedPackageJson, [
|
|
240
248
|
"android",
|
|
241
249
|
"ios",
|
|
@@ -247,9 +255,11 @@ export default {
|
|
|
247
255
|
}
|
|
248
256
|
catch (err) {
|
|
249
257
|
this.$logger.trace("failed to add embedded package.json data to config", err);
|
|
258
|
+
// ignore if the file doesn't exist
|
|
250
259
|
}
|
|
251
260
|
try {
|
|
252
261
|
const packageJson = this.$fs.readJson(path.join(this.projectHelper.projectDir, "package.json"));
|
|
262
|
+
// add app id to additionalData for backwards compatibility
|
|
253
263
|
if (!NSConfig.id &&
|
|
254
264
|
packageJson &&
|
|
255
265
|
packageJson.nativescript &&
|
|
@@ -273,8 +283,10 @@ export default {
|
|
|
273
283
|
}
|
|
274
284
|
catch (err) {
|
|
275
285
|
this.$logger.trace("failed to read package.json data for config", err);
|
|
286
|
+
// ignore if the file doesn't exist
|
|
276
287
|
}
|
|
277
288
|
return _.defaultsDeep({}, ...additionalData, NSConfig);
|
|
289
|
+
// return Object.assign({}, ...additionalData, NSConfig);
|
|
278
290
|
}
|
|
279
291
|
writeLegacyNSConfigIfNeeded(projectDir, runtimePackage) {
|
|
280
292
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -284,6 +296,8 @@ export default {
|
|
|
284
296
|
}
|
|
285
297
|
if (runtimePackage.version &&
|
|
286
298
|
semver.gte(semver.coerce(runtimePackage.version), "7.0.0-rc.5")) {
|
|
299
|
+
// runtimes >= 7.0.0-rc.5 support passing appPath and appResourcesPath through gradle project flags
|
|
300
|
+
// so writing an nsconfig is not necessary.
|
|
287
301
|
return;
|
|
288
302
|
}
|
|
289
303
|
const runtimePackageDisplay = `${runtimePackage.name}${runtimePackage.version ? " v" + runtimePackage.version : ""}`;
|
|
@@ -300,9 +314,11 @@ You may add \`nsconfig.json\` to \`.gitignore\` as the CLI will regenerate it as
|
|
|
300
314
|
appPath: this.getValue("appPath"),
|
|
301
315
|
appResourcesPath: this.getValue("appResourcesPath"),
|
|
302
316
|
});
|
|
317
|
+
// mark the file for cleanup after the CLI exits
|
|
303
318
|
yield this.$cleanupService.addCleanupDeleteAction(nsConfigPath);
|
|
304
319
|
});
|
|
305
320
|
}
|
|
321
|
+
// todo: move into config manipulation
|
|
306
322
|
flattenObjectToPaths(obj, basePath) {
|
|
307
323
|
const toPath = (key) => [basePath, key].filter(Boolean).join(".");
|
|
308
324
|
return Object.keys(obj).reduce((all, key) => {
|
|
@@ -320,7 +336,7 @@ You may add \`nsconfig.json\` to \`.gitignore\` as the CLI will regenerate it as
|
|
|
320
336
|
}
|
|
321
337
|
}
|
|
322
338
|
__decorate([
|
|
323
|
-
(0, decorators_1.cache)()
|
|
339
|
+
(0, decorators_1.cache)() // @cache should prevent the message being printed multiple times
|
|
324
340
|
], ProjectConfigService.prototype, "warnUsingLegacyNSConfig", null);
|
|
325
341
|
__decorate([
|
|
326
342
|
(0, decorators_1.exported)("projectConfigService")
|
|
@@ -333,3 +349,4 @@ __decorate([
|
|
|
333
349
|
], ProjectConfigService.prototype, "setValue", null);
|
|
334
350
|
exports.ProjectConfigService = ProjectConfigService;
|
|
335
351
|
yok_1.injector.register("projectConfigService", ProjectConfigService);
|
|
352
|
+
//# sourceMappingURL=project-config-service.js.map
|
|
@@ -36,12 +36,14 @@ class ProjectDataService {
|
|
|
36
36
|
this.$injector = $injector;
|
|
37
37
|
this.projectDataCache = {};
|
|
38
38
|
try {
|
|
39
|
+
// add the ProjectData of the default projectDir to the projectData cache
|
|
39
40
|
const projectData = this.$injector.resolve("projectData");
|
|
40
41
|
projectData.initializeProjectData();
|
|
41
42
|
this.defaultProjectDir = projectData.projectDir;
|
|
42
43
|
this.projectDataCache[this.defaultProjectDir] = projectData;
|
|
43
44
|
}
|
|
44
45
|
catch (e) {
|
|
46
|
+
// the CLI is required as a lib from a non-project folder
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
get $pluginsService() {
|
|
@@ -70,6 +72,8 @@ class ProjectDataService {
|
|
|
70
72
|
delete projectFileInfo.projectData[ProjectDataService.DEPENDENCIES_KEY_NAME][dependencyName];
|
|
71
73
|
this.$fs.writeJson(projectFileInfo.projectFilePath, projectFileInfo.projectData);
|
|
72
74
|
}
|
|
75
|
+
// TODO: Add tests
|
|
76
|
+
// TODO: Remove $projectData and replace it with $projectDataService.getProjectData
|
|
73
77
|
getProjectData(projectDir) {
|
|
74
78
|
projectDir = projectDir || this.defaultProjectDir;
|
|
75
79
|
this.projectDataCache[projectDir] =
|
|
@@ -126,6 +130,10 @@ class ProjectDataService {
|
|
|
126
130
|
}
|
|
127
131
|
getAndroidAssetsStructure(opts) {
|
|
128
132
|
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
// TODO: Use image-size package to get the width and height of an image.
|
|
134
|
+
// TODO: Parse the splash_screen.xml in nodpi directory and get from it the names of the background and center image.
|
|
135
|
+
// TODO: Parse the AndroidManifest.xml to get the name of the icon.
|
|
136
|
+
// This way we'll not use the image-definitions.json and the method will return the real android structure.
|
|
129
137
|
const projectDir = opts.projectDir;
|
|
130
138
|
const projectData = this.getProjectData(projectDir);
|
|
131
139
|
const pathToAndroidDir = path.join(projectData.appResourcesDirectoryPath, this.$devicePlatformsConstants.Android);
|
|
@@ -139,6 +147,7 @@ class ProjectDataService {
|
|
|
139
147
|
useLegacy = !manifest.includes(`android:icon="@mipmap/ic_launcher"`);
|
|
140
148
|
}
|
|
141
149
|
catch (err) {
|
|
150
|
+
// ignore
|
|
142
151
|
}
|
|
143
152
|
const content = this.getImageDefinitions()[useLegacy ? "android_legacy" : "android"];
|
|
144
153
|
return {
|
|
@@ -163,6 +172,8 @@ class ProjectDataService {
|
|
|
163
172
|
}
|
|
164
173
|
if (fstat.isDirectory()) {
|
|
165
174
|
if (filePath === pathToProjectNodeModules) {
|
|
175
|
+
// we do not want to get the files from node_modules directory of the project.
|
|
176
|
+
// We'll get here only when you have nativescript.config with appDirectoryPath set to "."
|
|
166
177
|
return false;
|
|
167
178
|
}
|
|
168
179
|
return true;
|
|
@@ -177,6 +188,9 @@ class ProjectDataService {
|
|
|
177
188
|
}
|
|
178
189
|
}
|
|
179
190
|
updateNsConfigValue(projectDir, updateObject, propertiesToRemove) {
|
|
191
|
+
// todo: figure out a way to update js/ts configs
|
|
192
|
+
// most likely needs an ast parser/writer
|
|
193
|
+
// should be delegated to the config service
|
|
180
194
|
const nsConfigPath = path.join(projectDir, constants.CONFIG_FILE_NAME_JS);
|
|
181
195
|
const currentNsConfig = this.getNsConfig(nsConfigPath);
|
|
182
196
|
let newNsConfig = currentNsConfig;
|
|
@@ -218,10 +232,14 @@ class ProjectDataService {
|
|
|
218
232
|
const imageDefinitions = this.getImageDefinitions().ios;
|
|
219
233
|
_.each(content && content.images, (image) => {
|
|
220
234
|
let foundMatchingDefinition = false;
|
|
235
|
+
// In some cases the image may not be available, it will just be described.
|
|
236
|
+
// When this happens, the filename will be empty.
|
|
237
|
+
// So we'll keep the path empty as well.
|
|
221
238
|
if (image.filename) {
|
|
222
239
|
image.path = path.join(dirPath, image.filename);
|
|
223
240
|
}
|
|
224
241
|
if (image.size) {
|
|
242
|
+
// size is basically <width>x<height>
|
|
225
243
|
const [width, height] = image.size
|
|
226
244
|
.toString()
|
|
227
245
|
.split(constants_1.AssetConstants.sizeDelimiter);
|
|
@@ -230,6 +248,7 @@ class ProjectDataService {
|
|
|
230
248
|
image.height = +height;
|
|
231
249
|
}
|
|
232
250
|
}
|
|
251
|
+
// Find the image size based on the hardcoded values in the image-definitions.json
|
|
233
252
|
_.each(imageDefinitions, (assetSubGroup) => {
|
|
234
253
|
const assetItem = _.find(assetSubGroup, (assetElement) => assetElement.filename === image.filename &&
|
|
235
254
|
path.basename(assetElement.directory) === path.basename(dirPath));
|
|
@@ -249,6 +268,7 @@ class ProjectDataService {
|
|
|
249
268
|
image.scale = image.scale || assetItem.scale;
|
|
250
269
|
image.rgba = assetItem.rgba;
|
|
251
270
|
finalContent.images.push(image);
|
|
271
|
+
// break each
|
|
252
272
|
return false;
|
|
253
273
|
}
|
|
254
274
|
});
|
|
@@ -352,13 +372,16 @@ class ProjectDataService {
|
|
|
352
372
|
getRuntimePackage(projectDir, platform) {
|
|
353
373
|
platform = platform.toLowerCase();
|
|
354
374
|
const packageJson = this.$fs.readJson(path.join(projectDir, constants.PACKAGE_JSON_FILE_NAME));
|
|
355
|
-
const runtimeName = platform === "android"
|
|
375
|
+
const runtimeName = platform === "android" /* PlatformTypes.android */
|
|
356
376
|
? constants.TNS_ANDROID_RUNTIME_NAME
|
|
357
377
|
: constants.TNS_IOS_RUNTIME_NAME;
|
|
358
378
|
if (packageJson &&
|
|
359
379
|
packageJson.nativescript &&
|
|
360
380
|
packageJson.nativescript[runtimeName] &&
|
|
361
381
|
packageJson.nativescript[runtimeName].version) {
|
|
382
|
+
// if we have a nativescript key with a runtime version in package.json
|
|
383
|
+
// that means we are dealing with a legacy project, and should respect
|
|
384
|
+
// that information
|
|
362
385
|
return {
|
|
363
386
|
name: runtimeName,
|
|
364
387
|
version: packageJson.nativescript[runtimeName].version,
|
|
@@ -370,19 +393,19 @@ class ProjectDataService {
|
|
|
370
393
|
const runtimePackage = this.$pluginsService
|
|
371
394
|
.getDependenciesFromPackageJson(projectDir)
|
|
372
395
|
.devDependencies.find((d) => {
|
|
373
|
-
if (platform === "ios") {
|
|
396
|
+
if (platform === "ios" /* constants.PlatformTypes.ios */) {
|
|
374
397
|
return [
|
|
375
398
|
constants.SCOPED_IOS_RUNTIME_NAME,
|
|
376
399
|
constants.TNS_IOS_RUNTIME_NAME,
|
|
377
400
|
].includes(d.name);
|
|
378
401
|
}
|
|
379
|
-
else if (platform === "android") {
|
|
402
|
+
else if (platform === "android" /* constants.PlatformTypes.android */) {
|
|
380
403
|
return [
|
|
381
404
|
constants.SCOPED_ANDROID_RUNTIME_NAME,
|
|
382
405
|
constants.TNS_ANDROID_RUNTIME_NAME,
|
|
383
406
|
].includes(d.name);
|
|
384
407
|
}
|
|
385
|
-
else if (platform === "visionos") {
|
|
408
|
+
else if (platform === "visionos" /* constants.PlatformTypes.visionos */) {
|
|
386
409
|
return d.name === constants.SCOPED_VISIONOS_RUNTIME_NAME;
|
|
387
410
|
}
|
|
388
411
|
});
|
|
@@ -390,12 +413,14 @@ class ProjectDataService {
|
|
|
390
413
|
const coerced = semver.coerce(runtimePackage.version);
|
|
391
414
|
const isRange = !!coerced && coerced.version !== runtimePackage.version;
|
|
392
415
|
const isTag = !coerced;
|
|
416
|
+
// 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
|
|
393
417
|
if (runtimePackage.version.includes("tgz") || isRange || isTag) {
|
|
394
418
|
try {
|
|
395
419
|
const runtimePackageJsonPath = (0, package_path_helper_1.resolvePackageJSONPath)(runtimePackage.name, {
|
|
396
420
|
paths: [projectDir],
|
|
397
421
|
});
|
|
398
422
|
if (!runtimePackageJsonPath) {
|
|
423
|
+
// caught below
|
|
399
424
|
throw new Error("Runtime package.json not found.");
|
|
400
425
|
}
|
|
401
426
|
runtimePackage.version = this.$fs.readJson(runtimePackageJsonPath).version;
|
|
@@ -412,20 +437,21 @@ class ProjectDataService {
|
|
|
412
437
|
}
|
|
413
438
|
return runtimePackage;
|
|
414
439
|
}
|
|
440
|
+
// default to the scoped runtimes
|
|
415
441
|
this.$logger.trace("Could not find an installed runtime, falling back to default runtimes");
|
|
416
|
-
if (platform === "ios") {
|
|
442
|
+
if (platform === "ios" /* constants.PlatformTypes.ios */) {
|
|
417
443
|
return {
|
|
418
444
|
name: constants.SCOPED_IOS_RUNTIME_NAME,
|
|
419
445
|
version: null,
|
|
420
446
|
};
|
|
421
447
|
}
|
|
422
|
-
else if (platform === "android") {
|
|
448
|
+
else if (platform === "android" /* constants.PlatformTypes.android */) {
|
|
423
449
|
return {
|
|
424
450
|
name: constants.SCOPED_ANDROID_RUNTIME_NAME,
|
|
425
451
|
version: null,
|
|
426
452
|
};
|
|
427
453
|
}
|
|
428
|
-
else if (platform === "visionos") {
|
|
454
|
+
else if (platform === "visionos" /* constants.PlatformTypes.visionos */) {
|
|
429
455
|
return {
|
|
430
456
|
name: constants.SCOPED_VISIONOS_RUNTIME_NAME,
|
|
431
457
|
version: null,
|
|
@@ -459,9 +485,11 @@ __decorate([
|
|
|
459
485
|
return projectDir + ":" + platform;
|
|
460
486
|
},
|
|
461
487
|
shouldCache(result) {
|
|
488
|
+
// don't cache coerced versions
|
|
462
489
|
if (result._coerced) {
|
|
463
490
|
return false;
|
|
464
491
|
}
|
|
492
|
+
// only cache if version is defined
|
|
465
493
|
return !!result.version;
|
|
466
494
|
},
|
|
467
495
|
})
|
|
@@ -471,3 +499,4 @@ __decorate([
|
|
|
471
499
|
], ProjectDataService.prototype, "getNsConfigDefaultContent", null);
|
|
472
500
|
exports.ProjectDataService = ProjectDataService;
|
|
473
501
|
yok_1.injector.register("projectDataService", ProjectDataService);
|
|
502
|
+
//# sourceMappingURL=project-data-service.js.map
|
|
@@ -76,11 +76,15 @@ class ProjectService {
|
|
|
76
76
|
appId: appId,
|
|
77
77
|
projectName,
|
|
78
78
|
});
|
|
79
|
+
// can pass --no-git to skip creating a git repo
|
|
80
|
+
// useful in monorepos where we're creating
|
|
81
|
+
// sub projects in an existing git repo.
|
|
79
82
|
if (this.$options.git) {
|
|
80
83
|
try {
|
|
81
84
|
if (!this.$options.force) {
|
|
82
85
|
const git = (0, simple_git_1.default)(projectDir);
|
|
83
86
|
if (yield git.checkIsRepo()) {
|
|
87
|
+
// throwing here since we're catching below.
|
|
84
88
|
throw new Error("Already part of a git repository.");
|
|
85
89
|
}
|
|
86
90
|
}
|
|
@@ -122,6 +126,7 @@ class ProjectService {
|
|
|
122
126
|
this.alterPackageJsonData(projectCreationSettings);
|
|
123
127
|
this.$projectConfigService.writeDefaultConfig(projectDir, appId);
|
|
124
128
|
yield this.ensureAppResourcesExist(projectDir);
|
|
129
|
+
// Install devDependencies and execute all scripts:
|
|
125
130
|
yield this.$packageManager.install(projectDir, projectDir, {
|
|
126
131
|
disableNpmInstall: false,
|
|
127
132
|
frameworkPath: null,
|
|
@@ -155,6 +160,7 @@ class ProjectService {
|
|
|
155
160
|
this.$logger.trace("Project does not have App_Resources - fetching from default template.");
|
|
156
161
|
this.$fs.createDirectory(appResourcesDestinationPath);
|
|
157
162
|
const tempDir = yield this.$tempService.mkdirSync("ns-default-template");
|
|
163
|
+
// the template installed doesn't have App_Resources -> get from a default template
|
|
158
164
|
yield this.$pacoteService.extractPackage(constants.RESERVED_TEMPLATE_NAMES["default"], tempDir);
|
|
159
165
|
const templateProjectData = this.$projectDataService.getProjectData(tempDir);
|
|
160
166
|
const templateAppResourcesDir = templateProjectData.getAppResourcesDirectoryPath(tempDir);
|
|
@@ -166,12 +172,14 @@ class ProjectService {
|
|
|
166
172
|
const { projectDir, projectName } = projectCreationSettings;
|
|
167
173
|
const projectFilePath = path.join(projectDir, this.$staticConfig.PROJECT_FILE_NAME);
|
|
168
174
|
let packageJsonData = this.$fs.readJson(projectFilePath);
|
|
175
|
+
// clean up keys from the template package.json that we don't care about.
|
|
169
176
|
Object.keys(packageJsonData).forEach((key) => {
|
|
170
177
|
if (key.startsWith("_") ||
|
|
171
178
|
constants.TemplatesV2PackageJsonKeysToRemove.includes(key)) {
|
|
172
179
|
delete packageJsonData[key];
|
|
173
180
|
}
|
|
174
181
|
});
|
|
182
|
+
// this is used to ensure the order of keys is consistent, the blanks are filled in from the template
|
|
175
183
|
const packageJsonSchema = {
|
|
176
184
|
name: projectName,
|
|
177
185
|
main: "",
|
|
@@ -179,6 +187,7 @@ class ProjectService {
|
|
|
179
187
|
private: true,
|
|
180
188
|
dependencies: {},
|
|
181
189
|
devDependencies: {},
|
|
190
|
+
// anythign else would go below
|
|
182
191
|
};
|
|
183
192
|
packageJsonData = Object.assign(packageJsonSchema, packageJsonData);
|
|
184
193
|
this.$fs.writeJson(projectFilePath, packageJsonData);
|
|
@@ -202,3 +211,4 @@ __decorate([
|
|
|
202
211
|
], ProjectService.prototype, "alterPackageJsonData", null);
|
|
203
212
|
exports.ProjectService = ProjectService;
|
|
204
213
|
yok_1.injector.register("projectService", ProjectService);
|
|
214
|
+
//# sourceMappingURL=project-service.js.map
|
|
@@ -50,12 +50,12 @@ class ProjectTemplatesService {
|
|
|
50
50
|
const templateNameToBeTracked = this.getTemplateNameToBeTracked(templateValue, templatePackageJsonContent);
|
|
51
51
|
if (templateNameToBeTracked) {
|
|
52
52
|
yield this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
53
|
-
action: "Create project"
|
|
53
|
+
action: "Create project" /* constants.TrackActionNames.CreateProject */,
|
|
54
54
|
isForDevice: null,
|
|
55
55
|
additionalData: templateNameToBeTracked,
|
|
56
56
|
});
|
|
57
57
|
yield this.$analyticsService.trackEventActionInGoogleAnalytics({
|
|
58
|
-
action: "Using Template"
|
|
58
|
+
action: "Using Template" /* constants.TrackActionNames.UsingTemplate */,
|
|
59
59
|
additionalData: templateNameToBeTracked,
|
|
60
60
|
});
|
|
61
61
|
}
|
|
@@ -112,3 +112,4 @@ __decorate([
|
|
|
112
112
|
], ProjectTemplatesService.prototype, "prepareTemplate", null);
|
|
113
113
|
exports.ProjectTemplatesService = ProjectTemplatesService;
|
|
114
114
|
yok_1.injector.register("projectTemplatesService", ProjectTemplatesService);
|
|
115
|
+
//# sourceMappingURL=project-templates-service.js.map
|
|
@@ -14,6 +14,7 @@ const ora = require("ora");
|
|
|
14
14
|
const yok_1 = require("../common/yok");
|
|
15
15
|
class TerminalSpinnerService {
|
|
16
16
|
createSpinner(spinnerOptions = {}) {
|
|
17
|
+
// @ts-expect-error - options are readonly, however we still want to override them before passing them on...
|
|
17
18
|
spinnerOptions.stream = spinnerOptions.stream || process.stdout;
|
|
18
19
|
return ora(spinnerOptions);
|
|
19
20
|
}
|
|
@@ -36,3 +37,4 @@ class TerminalSpinnerService {
|
|
|
36
37
|
}
|
|
37
38
|
exports.TerminalSpinnerService = TerminalSpinnerService;
|
|
38
39
|
yok_1.injector.register("terminalSpinnerService", TerminalSpinnerService);
|
|
40
|
+
//# sourceMappingURL=terminal-spinner-service.js.map
|