nativescript 9.0.0-alpha.7 → 9.0.0-alpha.8
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 +0 -12
- package/lib/base-package-manager.js +0 -7
- package/lib/bootstrap.js +1 -5
- package/lib/bun-package-manager.js +1 -14
- package/lib/color.js +0 -4
- package/lib/commands/add-platform.js +0 -1
- package/lib/commands/apple-login.js +0 -1
- package/lib/commands/appstore-list.js +0 -1
- package/lib/commands/appstore-upload.js +0 -3
- package/lib/commands/build.js +2 -3
- package/lib/commands/clean.js +1 -22
- package/lib/commands/command-base.js +0 -1
- package/lib/commands/config.js +0 -4
- package/lib/commands/create-project.js +0 -6
- package/lib/commands/debug.js +1 -6
- package/lib/commands/deploy.js +2 -3
- package/lib/commands/embedding/embed.js +0 -7
- package/lib/commands/extensibility/install-extension.js +0 -1
- package/lib/commands/extensibility/list-extensions.js +0 -1
- package/lib/commands/extensibility/uninstall-extension.js +0 -1
- package/lib/commands/fonts.js +0 -1
- package/lib/commands/generate-assets.js +0 -1
- package/lib/commands/generate-help.js +0 -1
- package/lib/commands/generate.js +1 -48
- package/lib/commands/info.js +0 -1
- package/lib/commands/install.js +0 -1
- package/lib/commands/list-platforms.js +0 -1
- package/lib/commands/migrate.js +0 -1
- package/lib/commands/native-add.js +0 -5
- package/lib/commands/platform-clean.js +0 -1
- package/lib/commands/plugin/add-plugin.js +0 -1
- package/lib/commands/plugin/build-plugin.js +0 -1
- package/lib/commands/plugin/create-plugin.js +0 -5
- package/lib/commands/plugin/list-plugins.js +0 -1
- package/lib/commands/plugin/remove-plugin.js +0 -2
- package/lib/commands/plugin/update-plugin.js +0 -1
- package/lib/commands/post-install.js +0 -6
- package/lib/commands/prepare.js +3 -4
- package/lib/commands/preview.js +0 -2
- package/lib/commands/remove-platform.js +0 -1
- package/lib/commands/resources/resources-update.js +0 -2
- package/lib/commands/run.js +0 -1
- package/lib/commands/setup.js +0 -1
- package/lib/commands/start.js +0 -1
- package/lib/commands/test-init.js +0 -4
- package/lib/commands/test.js +2 -9
- package/lib/commands/typings.js +1 -2
- package/lib/commands/update-platform.js +0 -5
- package/lib/commands/update.js +0 -2
- package/lib/commands/widget.js +1 -20
- package/lib/common/bootstrap.js +0 -1
- package/lib/common/child-process.js +0 -3
- package/lib/common/codeGeneration/code-entity.js +0 -1
- package/lib/common/codeGeneration/code-printer.js +0 -1
- package/lib/common/command-params.js +0 -1
- package/lib/common/commands/analytics.js +0 -3
- package/lib/common/commands/autocompletion.js +0 -3
- package/lib/common/commands/device/device-log-stream.js +0 -1
- package/lib/common/commands/device/get-file.js +0 -2
- package/lib/common/commands/device/list-applications.js +0 -1
- package/lib/common/commands/device/list-devices.js +0 -3
- package/lib/common/commands/device/list-files.js +0 -2
- package/lib/common/commands/device/put-file.js +0 -2
- package/lib/common/commands/device/run-application.js +0 -1
- package/lib/common/commands/device/stop-application.js +0 -1
- package/lib/common/commands/device/uninstall-application.js +0 -1
- package/lib/common/commands/doctor.js +2 -3
- package/lib/common/commands/generate-messages.js +0 -1
- package/lib/common/commands/help.js +0 -1
- package/lib/common/commands/package-manager-get.js +0 -1
- package/lib/common/commands/package-manager-set.js +0 -1
- package/lib/common/commands/post-install.js +0 -1
- package/lib/common/commands/preuninstall.js +2 -11
- package/lib/common/commands/proxy/proxy-base.js +0 -4
- package/lib/common/commands/proxy/proxy-clear.js +0 -1
- package/lib/common/commands/proxy/proxy-get.js +0 -1
- package/lib/common/commands/proxy/proxy-set.js +0 -1
- package/lib/common/common-lib.js +0 -1
- package/lib/common/constants.js +0 -11
- package/lib/common/decorators.js +0 -48
- package/lib/common/dispatchers.js +1 -10
- package/lib/common/errors.js +3 -13
- package/lib/common/file-system.js +2 -13
- package/lib/common/header.js +0 -3
- package/lib/common/helpers.js +3 -89
- package/lib/common/host-info.js +0 -4
- package/lib/common/http-client.js +0 -20
- package/lib/common/logger/appenders/cli-appender.js +0 -4
- package/lib/common/logger/appenders/emit-appender.js +0 -4
- package/lib/common/logger/layouts/cli-layout.js +0 -1
- package/lib/common/logger/logger.js +0 -5
- package/lib/common/messages/messages.js +0 -6
- package/lib/common/mobile/android/android-application-manager.js +1 -20
- package/lib/common/mobile/android/android-debug-bridge-result-handler.js +0 -1
- package/lib/common/mobile/android/android-debug-bridge.js +0 -6
- package/lib/common/mobile/android/android-device-file-system.js +0 -4
- package/lib/common/mobile/android/android-device-hash-service.js +0 -3
- package/lib/common/mobile/android/android-device.js +0 -8
- package/lib/common/mobile/android/android-emulator-services.js +1 -2
- package/lib/common/mobile/android/android-ini-file-parser.js +0 -9
- package/lib/common/mobile/android/android-log-filter.js +0 -4
- package/lib/common/mobile/android/android-virtual-device-service.js +0 -26
- package/lib/common/mobile/android/device-android-debug-bridge.js +0 -1
- package/lib/common/mobile/android/genymotion/genymotion-service.js +1 -6
- package/lib/common/mobile/android/genymotion/virtualbox-service.js +0 -11
- package/lib/common/mobile/android/logcat-helper.js +0 -13
- package/lib/common/mobile/application-manager-base.js +0 -6
- package/lib/common/mobile/device-emitter.js +0 -4
- package/lib/common/mobile/device-log-emitter.js +0 -1
- package/lib/common/mobile/device-log-provider-base.js +0 -1
- package/lib/common/mobile/device-log-provider.js +0 -23
- package/lib/common/mobile/device-platforms-constants.js +0 -1
- package/lib/common/mobile/emulator-helper.js +0 -3
- package/lib/common/mobile/ios/device/ios-application-manager.js +0 -3
- package/lib/common/mobile/ios/device/ios-device-file-system.js +0 -1
- package/lib/common/mobile/ios/device/ios-device-operations.js +0 -4
- package/lib/common/mobile/ios/device/ios-device.js +0 -4
- package/lib/common/mobile/ios/ios-device-base.js +0 -1
- package/lib/common/mobile/ios/ios-device-product-name-mapper.js +0 -2
- package/lib/common/mobile/ios/ios-log-filter.js +0 -1
- package/lib/common/mobile/ios/simulator/ios-emulator-services.js +0 -4
- package/lib/common/mobile/ios/simulator/ios-sim-resolver.js +0 -1
- package/lib/common/mobile/ios/simulator/ios-simulator-application-manager.js +0 -6
- package/lib/common/mobile/ios/simulator/ios-simulator-device.js +0 -5
- package/lib/common/mobile/ios/simulator/ios-simulator-file-system.js +0 -1
- package/lib/common/mobile/ios/simulator/ios-simulator-log-provider.js +0 -1
- package/lib/common/mobile/local-to-device-path-data-factory.js +0 -1
- package/lib/common/mobile/log-filter.js +0 -2
- package/lib/common/mobile/logging-levels.js +0 -1
- package/lib/common/mobile/mobile-core/android-device-discovery.js +0 -2
- package/lib/common/mobile/mobile-core/android-emulator-discovery.js +0 -3
- package/lib/common/mobile/mobile-core/android-process-service.js +0 -32
- package/lib/common/mobile/mobile-core/device-discovery.js +0 -1
- package/lib/common/mobile/mobile-core/devices-service.js +0 -69
- package/lib/common/mobile/mobile-core/ios-device-discovery.js +0 -2
- package/lib/common/mobile/mobile-core/ios-simulator-discovery.js +0 -3
- package/lib/common/mobile/mobile-helper.js +0 -1
- package/lib/common/mobile/wp8/wp8-emulator-services.js +0 -1
- package/lib/common/opener.js +0 -1
- package/lib/common/os-info.js +0 -1
- package/lib/common/plist-parser.js +0 -1
- package/lib/common/project-helper.js +0 -1
- package/lib/common/prompter.js +1 -9
- package/lib/common/queue.js +0 -1
- package/lib/common/resource-loader.js +0 -1
- package/lib/common/services/auto-completion-service.js +1 -13
- package/lib/common/services/cancellation.js +1 -2
- package/lib/common/services/commands-service.js +6 -17
- package/lib/common/services/help-service.js +3 -11
- package/lib/common/services/hooks-service.js +0 -13
- package/lib/common/services/ios-notification-service.js +0 -1
- package/lib/common/services/json-file-settings-service.js +0 -6
- package/lib/common/services/lock-service.js +0 -6
- package/lib/common/services/message-contract-generator.js +0 -1
- package/lib/common/services/messages-service.js +0 -1
- package/lib/common/services/micro-templating-service.js +0 -6
- package/lib/common/services/net-service.js +0 -3
- package/lib/common/services/project-files-manager.js +0 -5
- package/lib/common/services/project-files-provider-base.js +0 -1
- package/lib/common/services/proxy-service.js +0 -1
- package/lib/common/services/qr.js +0 -1
- package/lib/common/services/settings-service.js +0 -1
- package/lib/common/services/xcode-select-service.js +0 -1
- package/lib/common/utils.js +0 -1
- package/lib/common/validators/project-name-validator.js +0 -1
- package/lib/common/validators/validation-result.js +0 -1
- package/lib/common/verify-node-version.js +1 -8
- package/lib/common/yok.js +11 -32
- package/lib/config.js +1 -22
- package/lib/constants-provider.js +0 -1
- package/lib/constants.js +0 -53
- package/lib/controllers/build-controller.js +3 -4
- package/lib/controllers/debug-controller.js +3 -8
- package/lib/controllers/deploy-controller.js +0 -1
- package/lib/controllers/migrate-controller.js +4 -90
- package/lib/controllers/platform-controller.js +1 -9
- package/lib/controllers/prepare-controller.js +4 -17
- package/lib/controllers/run-controller.js +1 -17
- package/lib/controllers/update-controller-base.js +0 -1
- package/lib/controllers/update-controller.js +0 -11
- package/lib/data/build-data.js +0 -1
- package/lib/data/controller-data-base.js +0 -1
- package/lib/data/debug-data.js +0 -1
- package/lib/data/platform-data.js +0 -1
- package/lib/data/prepare-data.js +0 -1
- package/lib/data/run-data.js +0 -1
- package/lib/detached-processes/cleanup-js-subprocess.js +2 -8
- package/lib/detached-processes/cleanup-process.js +14 -18
- package/lib/detached-processes/file-log-service.js +1 -2
- package/lib/device-path-provider.js +0 -1
- package/lib/device-sockets/ios/app-debug-socket-proxy-factory.js +0 -7
- package/lib/device-sockets/ios/notification.js +0 -3
- package/lib/device-sockets/ios/socket-request-executor.js +0 -3
- package/lib/helpers/android-bundle-validator-helper.js +1 -2
- package/lib/helpers/deploy-command-helper.js +0 -1
- package/lib/helpers/key-command-helper.js +2 -4
- package/lib/helpers/livesync-command-helper.js +1 -4
- package/lib/helpers/network-connectivity-validator.js +0 -1
- package/lib/helpers/options-track-helper.js +2 -3
- package/lib/helpers/package-path-helper.js +0 -1
- package/lib/helpers/platform-command-helper.js +2 -7
- package/lib/helpers/version-validator-helper.js +0 -1
- package/lib/key-commands/bootstrap.js +2 -3
- package/lib/key-commands/index.js +4 -5
- package/lib/nativescript-cli-lib-bootstrap.js +0 -4
- package/lib/nativescript-cli-lib.js +0 -1
- package/lib/nativescript-cli.js +1 -10
- package/lib/node/pbxproj-dom-xcode.js +0 -1
- package/lib/node/xcode.js +0 -1
- package/lib/node-package-manager.js +1 -11
- package/lib/options.js +119 -144
- package/lib/package-installation-manager.js +1 -8
- package/lib/package-manager.js +0 -2
- package/lib/platform-command-param.js +0 -1
- package/lib/pnpm-package-manager.js +1 -4
- package/lib/project-data.js +0 -12
- package/lib/providers/project-files-provider.js +0 -1
- package/lib/resolvers/livesync-service-resolver.js +0 -1
- package/lib/services/analytics/analytics-broker-process.js +6 -10
- package/lib/services/analytics/analytics-broker.js +1 -2
- package/lib/services/analytics/analytics-service.js +25 -29
- package/lib/services/analytics/google-analytics-provider.js +12 -13
- package/lib/services/analytics-settings-service.js +0 -5
- package/lib/services/android/android-bundle-tool-service.js +0 -1
- package/lib/services/android/gradle-build-args-service.js +0 -3
- package/lib/services/android/gradle-build-service.js +0 -1
- package/lib/services/android/gradle-command-service.js +0 -1
- package/lib/services/android-device-debug-service.js +0 -6
- package/lib/services/android-plugin-build-service.js +2 -31
- package/lib/services/android-project-service.js +4 -71
- package/lib/services/android-resources-migration-service.js +0 -7
- package/lib/services/apple-portal/apple-portal-application-service.js +0 -1
- package/lib/services/apple-portal/apple-portal-cookie-service.js +0 -1
- package/lib/services/apple-portal/apple-portal-session-service.js +4 -6
- package/lib/services/apple-portal/srp/srp-wrapper.js +1 -4
- package/lib/services/assets-generation/assets-generation-service.js +5 -10
- package/lib/services/build-artifacts-service.js +1 -2
- package/lib/services/build-data-service.js +0 -1
- package/lib/services/build-info-file-service.js +0 -1
- package/lib/services/bundler/bundler-compiler-service.js +35 -75
- package/lib/services/bundler/bundler.js +0 -1
- package/lib/services/cleanup-service.js +9 -13
- package/lib/services/cocoapods-platform-manager.js +0 -9
- package/lib/services/cocoapods-service.js +1 -21
- package/lib/services/debug-data-service.js +0 -1
- package/lib/services/debug-service-base.js +0 -7
- package/lib/services/device/device-install-app-service.js +1 -2
- package/lib/services/doctor-service.js +6 -21
- package/lib/services/extensibility-service.js +0 -8
- package/lib/services/files-hash-service.js +0 -1
- package/lib/services/hmr-status-service.js +0 -2
- package/lib/services/info-service.js +0 -1
- package/lib/services/initialize-service.js +1 -5
- package/lib/services/ios/export-options-plist-service.js +0 -4
- package/lib/services/ios/ios-signing-service.js +0 -4
- package/lib/services/ios/spm-service.js +0 -11
- package/lib/services/ios/xcodebuild-args-service.js +0 -9
- package/lib/services/ios/xcodebuild-command-service.js +0 -1
- package/lib/services/ios/xcodebuild-service.js +1 -2
- package/lib/services/ios-debugger-port-service.js +0 -1
- package/lib/services/ios-device-debug-service.js +0 -1
- package/lib/services/ios-entitlements-service.js +0 -1
- package/lib/services/ios-extensions-service.js +0 -1
- package/lib/services/ios-log-filter.js +0 -20
- package/lib/services/ios-native-target-service.js +4 -6
- package/lib/services/ios-project-service.js +1 -91
- package/lib/services/ios-provision-service.js +0 -3
- package/lib/services/ios-watch-app-service.js +0 -1
- package/lib/services/ip-service.js +0 -2
- package/lib/services/itmstransporter-service.js +0 -1
- package/lib/services/karma-execution.js +0 -2
- package/lib/services/livesync/android-device-livesync-service-base.js +0 -1
- package/lib/services/livesync/android-device-livesync-service.js +0 -2
- package/lib/services/livesync/android-device-livesync-sockets-service.js +0 -3
- package/lib/services/livesync/android-livesync-service.js +0 -1
- package/lib/services/livesync/android-livesync-tool.js +3 -5
- package/lib/services/livesync/device-livesync-service-base.js +0 -2
- package/lib/services/livesync/ios-device-livesync-service.js +0 -7
- package/lib/services/livesync/ios-livesync-service.js +0 -2
- package/lib/services/livesync/livesync-socket.js +0 -1
- package/lib/services/livesync/platform-livesync-service-base.js +0 -5
- package/lib/services/livesync-process-data-service.js +0 -1
- package/lib/services/log-parser-service.js +0 -1
- package/lib/services/log-source-map-service.js +0 -15
- package/lib/services/marking-mode-service.js +5 -8
- package/lib/services/metadata-filtering-service.js +0 -1
- package/lib/services/npm-config-service.js +0 -4
- package/lib/services/pacote-service.js +0 -7
- package/lib/services/performance-service.js +1 -3
- package/lib/services/platform/add-platform-service.js +2 -49
- package/lib/services/platform/platform-validation-service.js +0 -1
- package/lib/services/platform/prepare-native-platform-service.js +2 -5
- package/lib/services/platform-environment-requirements.js +3 -8
- package/lib/services/platform-project-service-base.js +0 -1
- package/lib/services/platforms-data-service.js +0 -1
- package/lib/services/plugins-service.js +2 -20
- package/lib/services/prepare-data-service.js +0 -1
- package/lib/services/project-backup-service.js +0 -4
- package/lib/services/project-changes-service.js +3 -14
- package/lib/services/project-cleanup-service.js +0 -2
- package/lib/services/project-config-service.js +2 -21
- package/lib/services/project-data-service.js +7 -36
- package/lib/services/project-name-service.js +0 -1
- package/lib/services/project-service.js +0 -10
- package/lib/services/project-templates-service.js +2 -3
- package/lib/services/qr-code-terminal-service.js +0 -1
- package/lib/services/require-service.js +0 -1
- package/lib/services/start-service.js +0 -1
- package/lib/services/temp-service.js +0 -3
- package/lib/services/terminal-spinner-service.js +0 -2
- package/lib/services/test-execution-service.js +2 -9
- package/lib/services/test-initialization-service.js +0 -4
- package/lib/services/timeline-profiler-service.js +0 -1
- package/lib/services/user-settings-service.js +0 -1
- package/lib/services/versions-service.js +4 -6
- package/lib/services/watch-ignore-list-service.js +0 -1
- package/lib/services/xcconfig-service.js +0 -2
- package/lib/services/xcproj-service.js +0 -1
- package/lib/shared-event-bus.js +0 -6
- package/lib/sys-info.js +1 -2
- package/lib/tools/config-manipulation/config-transformer.js +0 -12
- package/lib/tools/node-modules/node-modules-builder.js +0 -1
- package/lib/tools/node-modules/node-modules-dependencies-builder.js +0 -6
- package/lib/yarn-package-manager.js +0 -1
- package/lib/yarn2-package-manager.js +0 -3
- package/package.json +15 -15
|
@@ -12,10 +12,7 @@ class ProxyCommandBase {
|
|
|
12
12
|
}
|
|
13
13
|
async tryTrackUsage() {
|
|
14
14
|
try {
|
|
15
|
-
// TODO(Analytics): Check why we have set the `disableAnalytics` to true and we track the command as separate one
|
|
16
|
-
// instead of tracking it through the commandsService.
|
|
17
15
|
this.$logger.trace(this.commandName);
|
|
18
|
-
// await this.$analyticsService.trackFeature(this.commandName);
|
|
19
16
|
}
|
|
20
17
|
catch (ex) {
|
|
21
18
|
this.$logger.trace("Error in trying to track proxy command usage:");
|
|
@@ -24,4 +21,3 @@ class ProxyCommandBase {
|
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
23
|
exports.ProxyCommandBase = ProxyCommandBase;
|
|
27
|
-
//# sourceMappingURL=proxy-base.js.map
|
package/lib/common/common-lib.js
CHANGED
package/lib/common/constants.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SOCKET_CONNECTION_TIMEOUT_MS = exports.AndroidVirtualDevice = exports.ATTACH_REQUEST_EVENT_NAME = exports.DEBUGGER_PORT_FOUND_EVENT_NAME = exports.DEFAULT_CHUNK_SIZE = exports.HttpProtocolToPort = exports.HttpStatusCodes = exports.Proxy = exports.IOS_RELAY_NOTIFICATION_COMMAND_TYPE = exports.IOS_OBSERVE_NOTIFICATION_COMMAND_TYPE = exports.IOS_POST_NOTIFICATION_COMMAND_TYPE = exports.FileExtensions = exports.TNS_CORE_MODULES = exports.NODE_MODULES_DIR_NAME = exports.Configurations = exports.TARGET_FRAMEWORK_IDENTIFIERS = exports.FAIL_LIVESYNC_LOG_REGEX = exports.IOS_APP_CRASH_LOG_REG_EXP = exports.IOS_LOG_PREDICATE = exports.DEVICE_LOG_EVENT_NAME = exports.EmulatorDiscoveryNames = exports.DeviceDiscoveryEventNames = exports.HmrConstants = exports.LiveSyncPaths = exports.APPLE_VENDOR_NAME = exports.NOT_RUNNING_EMULATOR_STATUS = exports.RUNNING_EMULATOR_STATUS = exports.CONNECTED_STATUS = exports.UNREACHABLE_STATUS = exports.ERROR_NO_VALID_SUBCOMMAND_FORMAT = exports.ERROR_CANNOT_RESOLVE_DEVICE = exports.ERROR_NO_DEVICES_CANT_USE_IOS_SIMULATOR = exports.ERROR_CANT_USE_SIMULATOR = exports.ERROR_NO_DEVICES = exports.APP_RESOURCES_FOLDER_NAME = exports.DeviceTypes = exports.ProvisionType = void 0;
|
|
4
|
-
// enumeration taken from ProvisionType.cs
|
|
5
4
|
class ProvisionType {
|
|
6
5
|
}
|
|
7
6
|
exports.ProvisionType = ProvisionType;
|
|
@@ -83,9 +82,6 @@ Proxy.CACHE_FILE_NAME = "proxy-cache.json";
|
|
|
83
82
|
Proxy.USE_PROXY = "USE_PROXY";
|
|
84
83
|
Proxy.PROXY_PORT = "PROXY_PORT";
|
|
85
84
|
Proxy.PROXY_HOSTNAME = "PROXY_HOSTNAME";
|
|
86
|
-
/**
|
|
87
|
-
* Http status codes available from `require("http").STATUS_CODES`.
|
|
88
|
-
*/
|
|
89
85
|
class HttpStatusCodes {
|
|
90
86
|
}
|
|
91
87
|
exports.HttpStatusCodes = HttpStatusCodes;
|
|
@@ -111,13 +107,7 @@ AndroidVirtualDevice.INI_FILES_MASK = /^(.*)\.ini$/i;
|
|
|
111
107
|
AndroidVirtualDevice.AVD_FILES_MASK = /^(.*)\.avd$/i;
|
|
112
108
|
AndroidVirtualDevice.MIN_ANDROID_APILEVEL = 17;
|
|
113
109
|
AndroidVirtualDevice.MIN_ANDROID_VERSION = "4.2";
|
|
114
|
-
/**
|
|
115
|
-
* The message that is printed from `avdmanager list avds`
|
|
116
|
-
*/
|
|
117
110
|
AndroidVirtualDevice.AVAILABLE_AVDS_MESSAGE = "Available Android Virtual Devices:";
|
|
118
|
-
/**
|
|
119
|
-
* The delimiter between devices that is used from `avdmanager list avds`
|
|
120
|
-
*/
|
|
121
111
|
AndroidVirtualDevice.AVD_LIST_DELIMITER = "---------";
|
|
122
112
|
AndroidVirtualDevice.CONFIG_INI_FILE_NAME = "config.ini";
|
|
123
113
|
AndroidVirtualDevice.INI_FILE_EXTENSION = ".ini";
|
|
@@ -130,4 +120,3 @@ AndroidVirtualDevice.TIMEOUT_SECONDS = 120;
|
|
|
130
120
|
AndroidVirtualDevice.GENYMOTION_DEFAULT_STDERR_STRING = "Logging activities to file";
|
|
131
121
|
AndroidVirtualDevice.UNABLE_TO_START_EMULATOR_MESSAGE = "Cannot run the app in the selected native emulator. Try to restart the adb server by running the `adb kill-server` command in the Command Prompt, or increase the allocated RAM of the virtual device through the Android Virtual Device manager. NativeScript CLI users can try to increase the timeout of the operation by adding the `--timeout` flag.";
|
|
132
122
|
exports.SOCKET_CONNECTION_TIMEOUT_MS = 30000;
|
|
133
|
-
//# sourceMappingURL=constants.js.map
|
package/lib/common/decorators.js
CHANGED
|
@@ -9,32 +9,6 @@ exports.performanceLog = performanceLog;
|
|
|
9
9
|
exports.deprecated = deprecated;
|
|
10
10
|
const constants_1 = require("../constants");
|
|
11
11
|
const yok_1 = require("./yok");
|
|
12
|
-
/**
|
|
13
|
-
* Caches the result of the first execution of the method and returns it whenever it is called instead of executing it again.
|
|
14
|
-
* Works with methods and getters.
|
|
15
|
-
* @example
|
|
16
|
-
* ```
|
|
17
|
-
* class CacheDecoratorsTest {
|
|
18
|
-
*
|
|
19
|
-
* @cache()
|
|
20
|
-
* public method(num: number): number {
|
|
21
|
-
* return num;
|
|
22
|
-
* }
|
|
23
|
-
*
|
|
24
|
-
* @cache()
|
|
25
|
-
* public get property(): any {
|
|
26
|
-
* // execute some heavy operation.
|
|
27
|
-
* return result;
|
|
28
|
-
* }
|
|
29
|
-
* }
|
|
30
|
-
*
|
|
31
|
-
* const instance = new CacheDecoratorsTest();
|
|
32
|
-
* const result = instance.method(1); // returns 1;
|
|
33
|
-
*
|
|
34
|
-
* // all consecutive calls to instance.method will return 1.
|
|
35
|
-
* const result2 = instance.method(2); // returns 1;
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
12
|
function cache() {
|
|
39
13
|
return (target, propertyKey, descriptor) => {
|
|
40
14
|
let result;
|
|
@@ -54,7 +28,6 @@ function cache() {
|
|
|
54
28
|
let memoizeIDCounter = 0;
|
|
55
29
|
function memoize(options) {
|
|
56
30
|
return (target, propertyKey, descriptor) => {
|
|
57
|
-
// todo: remove once surely working as intended.
|
|
58
31
|
const DEBUG = false;
|
|
59
32
|
const memoizeID = memoizeIDCounter++;
|
|
60
33
|
const valueOrGet = descriptor.value ? "value" : "get";
|
|
@@ -75,7 +48,6 @@ function memoize(options) {
|
|
|
75
48
|
cacheMapName,
|
|
76
49
|
hashKey,
|
|
77
50
|
});
|
|
78
|
-
// initialize cache map if not exists
|
|
79
51
|
if (!this.hasOwnProperty(cacheMapName)) {
|
|
80
52
|
DEBUG && console.log("NO CACHE MAP YET, CREATING ONE NOW");
|
|
81
53
|
Object.defineProperty(this, cacheMapName, {
|
|
@@ -90,16 +62,12 @@ function memoize(options) {
|
|
|
90
62
|
console.log({
|
|
91
63
|
cacheMap,
|
|
92
64
|
});
|
|
93
|
-
// check if has memoized value based on hashFn
|
|
94
65
|
if (cacheMap.has(hashKey)) {
|
|
95
66
|
DEBUG && console.log("CACHE HIT");
|
|
96
|
-
// if yes, return cached value
|
|
97
67
|
return cacheMap.get(hashKey);
|
|
98
68
|
}
|
|
99
69
|
DEBUG && console.log("CACHE MISS");
|
|
100
|
-
// if not call original and get result
|
|
101
70
|
const result = originalMethod.apply(this, args);
|
|
102
|
-
// call shouldCache (if passed) with the result or default to true
|
|
103
71
|
let shouldCache = true;
|
|
104
72
|
if (options.shouldCache) {
|
|
105
73
|
shouldCache = options.shouldCache.call(this, result);
|
|
@@ -109,21 +77,12 @@ function memoize(options) {
|
|
|
109
77
|
DEBUG && console.log("CACHING NOW");
|
|
110
78
|
cacheMap.set(hashKey, result);
|
|
111
79
|
}
|
|
112
|
-
// if shouldCache: save result
|
|
113
80
|
DEBUG && console.log("RETURNING", result);
|
|
114
81
|
return result;
|
|
115
82
|
};
|
|
116
83
|
return descriptor;
|
|
117
84
|
};
|
|
118
85
|
}
|
|
119
|
-
/**
|
|
120
|
-
* Calls specific method of the instance before executing the decorated method.
|
|
121
|
-
* This is usable when some of your methods depend on initialize async method, that cannot be invoked in constructor of the class.
|
|
122
|
-
* IMPORTANT: The decorated method must be async.
|
|
123
|
-
* @param {string} methodName The name of the method that will be invoked before calling the decorated method.
|
|
124
|
-
* @param {any[]} methodArgs Args that will be passed to the method that will be invoked before calling the decorated one.
|
|
125
|
-
* @return {any} Result of the decorated method.
|
|
126
|
-
*/
|
|
127
86
|
function invokeBefore(methodName, methodArgs) {
|
|
128
87
|
return (target, propertyKey, descriptor) => {
|
|
129
88
|
const originalValue = descriptor.value;
|
|
@@ -155,7 +114,6 @@ function performanceLog(localInjector) {
|
|
|
155
114
|
const className = target.constructor.name;
|
|
156
115
|
const trackName = `${className}${constants_1.AnalyticsEventLabelDelimiter}${propertyKey}`;
|
|
157
116
|
const performanceService = localInjector.resolve("performanceService");
|
|
158
|
-
//needed for the returned function to have the same name as the original - used in hooks decorator
|
|
159
117
|
const functionWrapper = {
|
|
160
118
|
[originalMethod.name]: function (...args) {
|
|
161
119
|
const start = performanceService.now();
|
|
@@ -181,14 +139,12 @@ function performanceLog(localInjector) {
|
|
|
181
139
|
},
|
|
182
140
|
};
|
|
183
141
|
descriptor.value = functionWrapper[originalMethod.name];
|
|
184
|
-
// used to get parameter names in hooks decorator
|
|
185
142
|
descriptor.value.toString = () => {
|
|
186
143
|
return originalMethod.toString();
|
|
187
144
|
};
|
|
188
145
|
return descriptor;
|
|
189
146
|
};
|
|
190
147
|
}
|
|
191
|
-
// inspired by https://github.com/NativeScript/NativeScript/blob/55dfe25938569edbec89255008e5ad9804901305/tns-core-modules/globals/globals.ts#L121-L137
|
|
192
148
|
function deprecated(additionalInfo, localInjector) {
|
|
193
149
|
const isDeprecatedMessage = " is deprecated.";
|
|
194
150
|
return (target, key, descriptor) => {
|
|
@@ -197,7 +153,6 @@ function deprecated(additionalInfo, localInjector) {
|
|
|
197
153
|
const $logger = localInjector.resolve("logger");
|
|
198
154
|
if (descriptor) {
|
|
199
155
|
if (descriptor.value) {
|
|
200
|
-
// method
|
|
201
156
|
const originalMethod = descriptor.value;
|
|
202
157
|
descriptor.value = function (...args) {
|
|
203
158
|
$logger.warn(`${key.toString()}${isDeprecatedMessage} ${additionalInfo}`);
|
|
@@ -206,7 +161,6 @@ function deprecated(additionalInfo, localInjector) {
|
|
|
206
161
|
return descriptor;
|
|
207
162
|
}
|
|
208
163
|
else {
|
|
209
|
-
// property
|
|
210
164
|
if (descriptor.set) {
|
|
211
165
|
const originalSetter = descriptor.set;
|
|
212
166
|
descriptor.set = function (...args) {
|
|
@@ -225,7 +179,6 @@ function deprecated(additionalInfo, localInjector) {
|
|
|
225
179
|
}
|
|
226
180
|
}
|
|
227
181
|
else {
|
|
228
|
-
// class
|
|
229
182
|
$logger.warn(`${(target &&
|
|
230
183
|
(target.name ||
|
|
231
184
|
(target.constructor && target.constructor.name))) ||
|
|
@@ -234,4 +187,3 @@ function deprecated(additionalInfo, localInjector) {
|
|
|
234
187
|
}
|
|
235
188
|
};
|
|
236
189
|
}
|
|
237
|
-
//# sourceMappingURL=decorators.js.map
|
|
@@ -15,9 +15,7 @@ const yok_1 = require("./yok");
|
|
|
15
15
|
const constants_1 = require("../constants");
|
|
16
16
|
const semver = require("semver");
|
|
17
17
|
class CommandDispatcher {
|
|
18
|
-
constructor($logger,
|
|
19
|
-
// required by the hooksService
|
|
20
|
-
$injector, $cancellation, $commandsService, $staticConfig, $sysInfo, $options, $versionsService, $packageManager, $terminalSpinnerService) {
|
|
18
|
+
constructor($logger, $injector, $cancellation, $commandsService, $staticConfig, $sysInfo, $options, $versionsService, $packageManager, $terminalSpinnerService) {
|
|
21
19
|
this.$logger = $logger;
|
|
22
20
|
this.$injector = $injector;
|
|
23
21
|
this.$cancellation = $cancellation;
|
|
@@ -34,7 +32,6 @@ class CommandDispatcher {
|
|
|
34
32
|
return this.printVersion();
|
|
35
33
|
}
|
|
36
34
|
if (this.$logger.getLevel() === "TRACE" && !this.$options.json) {
|
|
37
|
-
// CommandDispatcher is called from external CLI's only, so pass the path to their package.json
|
|
38
35
|
this.$logger.trace("Collecting system information...");
|
|
39
36
|
const sysInfo = await this.$sysInfo.getSysInfo({
|
|
40
37
|
pathToNativeScriptCliPackageJson: path.join(__dirname, "..", "..", "package.json"),
|
|
@@ -64,7 +61,6 @@ class CommandDispatcher {
|
|
|
64
61
|
await this.$commandsService.tryExecuteCommand(commandName, commandArguments);
|
|
65
62
|
}
|
|
66
63
|
async resolveCommand(commandName, commandArguments, argv) {
|
|
67
|
-
// just a hook point
|
|
68
64
|
return { commandName, commandArguments, argv };
|
|
69
65
|
}
|
|
70
66
|
getCommandName() {
|
|
@@ -72,15 +68,12 @@ class CommandDispatcher {
|
|
|
72
68
|
if (remaining.length > 0) {
|
|
73
69
|
return remaining[0].toString().toLowerCase();
|
|
74
70
|
}
|
|
75
|
-
// if only <CLI_NAME> is specified on console, show console help
|
|
76
71
|
this.$options.help = true;
|
|
77
72
|
return "";
|
|
78
73
|
}
|
|
79
74
|
async printVersion() {
|
|
80
75
|
this.$logger.info(this.$staticConfig.version);
|
|
81
76
|
if (this.$options.json) {
|
|
82
|
-
// we don't check for updates when --json is passed
|
|
83
|
-
// useful for tools that rely on the output of the command
|
|
84
77
|
return;
|
|
85
78
|
}
|
|
86
79
|
const spinner = this.$terminalSpinnerService.createSpinner();
|
|
@@ -108,7 +101,6 @@ class CommandDispatcher {
|
|
|
108
101
|
if (semver.gte(nativescriptCliVersion.currentVersion, nativescriptCliVersion.latestVersion, {
|
|
109
102
|
loose: true,
|
|
110
103
|
})) {
|
|
111
|
-
// up-to-date
|
|
112
104
|
spinner.succeed("Up to date.");
|
|
113
105
|
}
|
|
114
106
|
else {
|
|
@@ -140,4 +132,3 @@ class FutureDispatcher {
|
|
|
140
132
|
}
|
|
141
133
|
}
|
|
142
134
|
yok_1.injector.register("dispatcher", FutureDispatcher, false);
|
|
143
|
-
//# sourceMappingURL=dispatchers.js.map
|
package/lib/common/errors.js
CHANGED
|
@@ -15,9 +15,7 @@ const source_map_1 = require("source-map");
|
|
|
15
15
|
const helpers_1 = require("./helpers");
|
|
16
16
|
const decorators_1 = require("./decorators");
|
|
17
17
|
const yok_1 = require("./yok");
|
|
18
|
-
// we need this to overwrite .stack property (read-only in Error)
|
|
19
18
|
function Exception() {
|
|
20
|
-
/* intentionally left blank */
|
|
21
19
|
}
|
|
22
20
|
Exception.prototype = new Error();
|
|
23
21
|
async function resolveCallStack(error) {
|
|
@@ -62,7 +60,6 @@ async function resolveCallStack(error) {
|
|
|
62
60
|
}));
|
|
63
61
|
let outputMessage = remapped.join("\n");
|
|
64
62
|
if (outputMessage.indexOf(error.message) === -1) {
|
|
65
|
-
// when fibers throw error in node 0.12.x, the stack does NOT contain the message
|
|
66
63
|
outputMessage = outputMessage.replace(/Error/, "Error: " + error.message);
|
|
67
64
|
}
|
|
68
65
|
return outputMessage;
|
|
@@ -86,9 +83,7 @@ function installUncaughtExceptionListener(actionOnException) {
|
|
|
86
83
|
}
|
|
87
84
|
}
|
|
88
85
|
catch (err) {
|
|
89
|
-
|
|
90
|
-
// We cannot do anything here as even `console.error` may fail. So just exit the process.
|
|
91
|
-
process.exit(131 /* ErrorCodes.UNHANDLED_REJECTION_FAILURE */);
|
|
86
|
+
process.exit(131);
|
|
92
87
|
}
|
|
93
88
|
};
|
|
94
89
|
process.on("uncaughtException", handler);
|
|
@@ -100,7 +95,6 @@ async function tryTrackException(error, localInjector) {
|
|
|
100
95
|
disableAnalytics = localInjector.resolve("staticConfig").disableAnalytics;
|
|
101
96
|
}
|
|
102
97
|
catch (err) {
|
|
103
|
-
// We should get here only in our unit tests.
|
|
104
98
|
disableAnalytics = true;
|
|
105
99
|
}
|
|
106
100
|
if (!disableAnalytics) {
|
|
@@ -109,7 +103,6 @@ async function tryTrackException(error, localInjector) {
|
|
|
109
103
|
await analyticsService.trackException(error, error.message);
|
|
110
104
|
}
|
|
111
105
|
catch (e) {
|
|
112
|
-
// Do not replace with logger due to cyclic dependency
|
|
113
106
|
console.error("Error while reporting exception: " + e);
|
|
114
107
|
}
|
|
115
108
|
}
|
|
@@ -147,10 +140,9 @@ class Errors {
|
|
|
147
140
|
exception.message = $messagesService.getMessage.apply($messagesService, [opts.formatStr].concat(argsArray));
|
|
148
141
|
}
|
|
149
142
|
catch (err) {
|
|
150
|
-
// Ignore
|
|
151
143
|
}
|
|
152
144
|
exception.stack = new Error(exception.message).stack;
|
|
153
|
-
exception.errorCode = opts.errorCode || 127
|
|
145
|
+
exception.errorCode = opts.errorCode || 127;
|
|
154
146
|
exception.suggestCommandHelp = suggestCommandHelp;
|
|
155
147
|
exception.proxyAuthenticationRequired = !!opts.proxyAuthenticationRequired;
|
|
156
148
|
exception.printOnStdout = opts.printOnStdout;
|
|
@@ -182,10 +174,9 @@ class Errors {
|
|
|
182
174
|
await printCommandHelpSuggestion();
|
|
183
175
|
}
|
|
184
176
|
await tryTrackException(ex, this.$injector);
|
|
185
|
-
process.exit(_.isNumber(ex.errorCode) ? ex.errorCode : 127
|
|
177
|
+
process.exit(_.isNumber(ex.errorCode) ? ex.errorCode : 127);
|
|
186
178
|
}
|
|
187
179
|
}
|
|
188
|
-
// If you want to activate this function, start Node with flags --nouse_idle_notification and --expose_gc
|
|
189
180
|
verifyHeap(message) {
|
|
190
181
|
if (global.gc) {
|
|
191
182
|
console.log("verifyHeap: '%s'", message);
|
|
@@ -198,4 +189,3 @@ __decorate([
|
|
|
198
189
|
(0, decorators_1.deprecated)("Use `fail` instead.")
|
|
199
190
|
], Errors.prototype, "failWithoutHelp", null);
|
|
200
191
|
yok_1.injector.register("errors", Errors);
|
|
201
|
-
//# sourceMappingURL=errors.js.map
|
|
@@ -20,14 +20,12 @@ const constants_1 = require("../constants");
|
|
|
20
20
|
const os_1 = require("os");
|
|
21
21
|
const detectNewline = require("detect-newline");
|
|
22
22
|
const archiver_1 = require("archiver");
|
|
23
|
-
// TODO: Add .d.ts for mkdirp module (or use it from @types repo).
|
|
24
23
|
const mkdirp = require("mkdirp");
|
|
25
24
|
let FileSystem = FileSystem_1 = class FileSystem {
|
|
26
25
|
constructor($injector) {
|
|
27
26
|
this.$injector = $injector;
|
|
28
27
|
}
|
|
29
28
|
async zipFiles(zipFile, files, zipPathCallback) {
|
|
30
|
-
//we are resolving it here instead of in the constructor, because config has dependency on file system and config shouldn't require logger
|
|
31
29
|
const $logger = this.$injector.resolve("logger");
|
|
32
30
|
const zip = (0, archiver_1.create)("zip", {
|
|
33
31
|
zlib: {
|
|
@@ -64,10 +62,10 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
64
62
|
proc = (0, path_1.join)(__dirname, "resources/platform-tools/unzip/win32/unzip");
|
|
65
63
|
}
|
|
66
64
|
else if ($hostInfo.isDarwin) {
|
|
67
|
-
proc = "unzip";
|
|
65
|
+
proc = "unzip";
|
|
68
66
|
}
|
|
69
67
|
else if ($hostInfo.isLinux) {
|
|
70
|
-
proc = "unzip";
|
|
68
|
+
proc = "unzip";
|
|
71
69
|
}
|
|
72
70
|
if (!isCaseSensitive) {
|
|
73
71
|
zipFile = this.findFileCaseInsensitive(zipFile);
|
|
@@ -108,7 +106,6 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
108
106
|
}
|
|
109
107
|
catch (err) {
|
|
110
108
|
if (err && err.code !== "ENOENT") {
|
|
111
|
-
// ignore "file doesn't exist" error
|
|
112
109
|
throw err;
|
|
113
110
|
}
|
|
114
111
|
}
|
|
@@ -147,7 +144,6 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
147
144
|
}
|
|
148
145
|
});
|
|
149
146
|
if (root) {
|
|
150
|
-
// console.log("root", paths);
|
|
151
147
|
return Array.from(paths.values()).reduce((sum, current) => sum + current, 0);
|
|
152
148
|
}
|
|
153
149
|
};
|
|
@@ -220,8 +216,6 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
220
216
|
writeFile(filename, data, encoding) {
|
|
221
217
|
this.createDirectory((0, path_1.dirname)(filename));
|
|
222
218
|
if (!data) {
|
|
223
|
-
// node 14 will no longer coerce unsupported input to strings anymore.
|
|
224
|
-
// clean any null or undefined data
|
|
225
219
|
data = "";
|
|
226
220
|
}
|
|
227
221
|
fs.writeFileSync(filename, data, { encoding: encoding });
|
|
@@ -252,8 +246,6 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
252
246
|
return;
|
|
253
247
|
}
|
|
254
248
|
this.createDirectory((0, path_1.dirname)(destinationFileName));
|
|
255
|
-
// MobileApplication.app is resolved as a directory on Mac,
|
|
256
|
-
// therefore we need to copy it recursively as it's not a single file.
|
|
257
249
|
shelljs.cp("-rf", sourceFileName, destinationFileName);
|
|
258
250
|
const err = shelljs.error();
|
|
259
251
|
if (err) {
|
|
@@ -329,9 +321,7 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
329
321
|
});
|
|
330
322
|
await this.futureFromEvent(chown, "close");
|
|
331
323
|
}
|
|
332
|
-
// nothing to do on Windows, as chown does not work on this platform
|
|
333
324
|
}
|
|
334
|
-
// filterCallback: function(path: String, stat: fs.Stats): Boolean
|
|
335
325
|
enumerateFilesInDirectorySync(directoryPath, filterCallback, opts, foundFiles) {
|
|
336
326
|
foundFiles = foundFiles || [];
|
|
337
327
|
if (!this.exists(directoryPath)) {
|
|
@@ -427,4 +417,3 @@ FileSystem.JSON_OBJECT_REGEXP = new RegExp(`{\\r*\\n*(\\W*)"`, "m");
|
|
|
427
417
|
exports.FileSystem = FileSystem = FileSystem_1 = __decorate([
|
|
428
418
|
injector.register("fs")
|
|
429
419
|
], FileSystem);
|
|
430
|
-
//# sourceMappingURL=file-system.js.map
|
package/lib/common/header.js
CHANGED
|
@@ -13,13 +13,11 @@ function printHeader() {
|
|
|
13
13
|
color_1.color.styleText(["cyanBright", "bold"], "{N} NativeScript "),
|
|
14
14
|
color_1.color.styleText(["whiteBright", "bold"], "CLI"),
|
|
15
15
|
color_1.color.dim(` [v${version}] `),
|
|
16
|
-
// color.dim(" │"),
|
|
17
16
|
].join("");
|
|
18
17
|
const tagLine = [
|
|
19
18
|
color_1.color.dim("│ "),
|
|
20
19
|
color_1.color.dim(" → "),
|
|
21
20
|
color_1.color.styleText(["whiteBright", "bold"], "Empower JavaScript with native APIs "),
|
|
22
|
-
// color.dim(" │"),
|
|
23
21
|
].join("");
|
|
24
22
|
const headerLength = (0, color_1.stripColors)(header).length;
|
|
25
23
|
const tagLineLength = (0, color_1.stripColors)(tagLine).length;
|
|
@@ -29,4 +27,3 @@ function printHeader() {
|
|
|
29
27
|
console.info(" " + tagLine + " ".repeat(width - tagLineLength) + color_1.color.dim("│"));
|
|
30
28
|
console.info(" " + color_1.color.dim("└" + "─".repeat(width - 1) + "┘"));
|
|
31
29
|
}
|
|
32
|
-
//# sourceMappingURL=header.js.map
|
package/lib/common/helpers.js
CHANGED
|
@@ -71,13 +71,6 @@ function doesCurrentNpmCommandMatch(patterns) {
|
|
|
71
71
|
}
|
|
72
72
|
return result;
|
|
73
73
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Equivalent of lodash's some, but instead of lambda, just pass array of Regular Expressions.
|
|
76
|
-
* If any of them matches any of the given elements, true is returned.
|
|
77
|
-
* @param {string[]} array Elements to be checked.
|
|
78
|
-
* @param {RegExp[]} patterns Regular expressions to be tested
|
|
79
|
-
* @returns {boolean} True in case any element of the array matches any of the patterns. False otherwise.
|
|
80
|
-
*/
|
|
81
74
|
function someWithRegExps(array, patterns) {
|
|
82
75
|
return _.some(array, (item) => _.some(patterns, (pattern) => !!item.match(pattern)));
|
|
83
76
|
}
|
|
@@ -89,7 +82,6 @@ function getCurrentNpmCommandArgv() {
|
|
|
89
82
|
result = npmConfigArgv.original || [];
|
|
90
83
|
}
|
|
91
84
|
catch (error) {
|
|
92
|
-
// ignore
|
|
93
85
|
}
|
|
94
86
|
}
|
|
95
87
|
return result;
|
|
@@ -108,7 +100,6 @@ function isInstallingNativeScriptGloballyWithNpm() {
|
|
|
108
100
|
return isInstallCommand && isGlobalCommand && hasNativeScriptPackage;
|
|
109
101
|
}
|
|
110
102
|
function isInstallingNativeScriptGloballyWithYarn() {
|
|
111
|
-
// yarn populates the same env used by npm - npm_config_argv, so check it for yarn specific command
|
|
112
103
|
const isInstallCommand = doesCurrentNpmCommandMatch([/^add$/]);
|
|
113
104
|
const isGlobalCommand = doesCurrentNpmCommandMatch([/^global$/]);
|
|
114
105
|
const hasNativeScriptPackage = doesCurrentNpmCommandMatch([
|
|
@@ -117,13 +108,6 @@ function isInstallingNativeScriptGloballyWithYarn() {
|
|
|
117
108
|
]);
|
|
118
109
|
return isInstallCommand && isGlobalCommand && hasNativeScriptPackage;
|
|
119
110
|
}
|
|
120
|
-
/**
|
|
121
|
-
* Creates regular expression from input string.
|
|
122
|
-
* The method replaces all occurences of RegExp special symbols in the input string with \<symbol>.
|
|
123
|
-
* @param {string} input The string from which a regular expression should be created.
|
|
124
|
-
* @param {string} opts RegExp options, for example "gm" - global and multiline.
|
|
125
|
-
* @returns {RegExp} The regular expression created from the input string.
|
|
126
|
-
*/
|
|
127
111
|
function createRegExp(input, opts) {
|
|
128
112
|
if (!input || !_.isString(input)) {
|
|
129
113
|
throw new Error("Input must be a string.");
|
|
@@ -131,20 +115,13 @@ function createRegExp(input, opts) {
|
|
|
131
115
|
const escapedSource = regExpEscape(input);
|
|
132
116
|
return new RegExp(escapedSource, opts);
|
|
133
117
|
}
|
|
134
|
-
/**
|
|
135
|
-
* Escapes all special symbols used in regex.
|
|
136
|
-
* @param {string} input The string in which to replace the special regexp symbols.
|
|
137
|
-
* @returns {string} A string in which all regex symbols are escaped.
|
|
138
|
-
*/
|
|
139
118
|
function regExpEscape(input) {
|
|
140
|
-
// https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
|
|
141
119
|
return input.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
142
120
|
}
|
|
143
121
|
function getShortPluginName(pluginName) {
|
|
144
122
|
return sanitizePluginName(pluginName).replace(/[\-]/g, "_");
|
|
145
123
|
}
|
|
146
124
|
function sanitizePluginName(pluginName) {
|
|
147
|
-
// avoid long plugin names, exclude the npm module scope (@scope/nativescript-plugin) from the android plugin name
|
|
148
125
|
return pluginName.split("/").pop();
|
|
149
126
|
}
|
|
150
127
|
async function executeActionByChunks(initialData, chunkSize, elementAction) {
|
|
@@ -191,13 +168,6 @@ function deferPromise() {
|
|
|
191
168
|
getResult: () => result,
|
|
192
169
|
};
|
|
193
170
|
}
|
|
194
|
-
/**
|
|
195
|
-
* Executes all promises and does not stop in case any of them throws.
|
|
196
|
-
* Returns the results of all promises in array when all are successfully resolved.
|
|
197
|
-
* In case any of the promises is rejected, rejects the resulted promise with all accumulated errors.
|
|
198
|
-
* @param {Promise<T>[]} promises Promises to be resolved.
|
|
199
|
-
* @returns {Promise<T[]>} New promise which will be resolved with the results of all promises.
|
|
200
|
-
*/
|
|
201
171
|
function settlePromises(promises) {
|
|
202
172
|
return new Promise((resolve, reject) => {
|
|
203
173
|
let settledPromisesCount = 0;
|
|
@@ -213,7 +183,6 @@ function settlePromises(promises) {
|
|
|
213
183
|
results[index] = result;
|
|
214
184
|
})
|
|
215
185
|
.catch((err) => {
|
|
216
|
-
// Accumulate all errors.
|
|
217
186
|
errors.push(err);
|
|
218
187
|
})
|
|
219
188
|
.then(() => {
|
|
@@ -245,14 +214,12 @@ function bashQuote(s) {
|
|
|
245
214
|
if (s[0] === "'" && s[s.length - 1] === "'") {
|
|
246
215
|
return s;
|
|
247
216
|
}
|
|
248
|
-
// replace ' with '"'"' and wrap in ''
|
|
249
217
|
return "'" + s.replace(/'/g, "'\"'\"'") + "'";
|
|
250
218
|
}
|
|
251
219
|
function cmdQuote(s) {
|
|
252
220
|
if (s[0] === '"' && s[s.length - 1] === '"') {
|
|
253
221
|
return s;
|
|
254
222
|
}
|
|
255
|
-
// replace " with \" and wrap in ""
|
|
256
223
|
return '"' + s.replace(/"/g, '\\"') + '"';
|
|
257
224
|
}
|
|
258
225
|
function quoteString(s) {
|
|
@@ -309,9 +276,6 @@ function isInteractive() {
|
|
|
309
276
|
const result = isRunningInTTY() && !isCIEnvironment();
|
|
310
277
|
return result;
|
|
311
278
|
}
|
|
312
|
-
/**
|
|
313
|
-
* Checks if current process is running in Text Terminal (TTY)
|
|
314
|
-
*/
|
|
315
279
|
function isRunningInTTY() {
|
|
316
280
|
return (process.stdout &&
|
|
317
281
|
process.stdout.isTTY &&
|
|
@@ -319,10 +283,6 @@ function isRunningInTTY() {
|
|
|
319
283
|
process.stdin.isTTY);
|
|
320
284
|
}
|
|
321
285
|
function isCIEnvironment() {
|
|
322
|
-
// The following CI environments set their own environment variables that we respect:
|
|
323
|
-
// travis: "CI",
|
|
324
|
-
// circleCI: "CI",
|
|
325
|
-
// jenkins: "JENKINS_HOME"
|
|
326
286
|
return !!(process.env && (process.env.CI || process.env.JENKINS_HOME));
|
|
327
287
|
}
|
|
328
288
|
function toBoolean(str) {
|
|
@@ -377,11 +337,11 @@ function getMessageWithBorders(message, spanLength = 3) {
|
|
|
377
337
|
const longestRowLength = message.split("\n").sort((a, b) => {
|
|
378
338
|
return b.length - a.length;
|
|
379
339
|
})[0].length;
|
|
380
|
-
let border = "*".repeat(longestRowLength + 2 * spanLength);
|
|
340
|
+
let border = "*".repeat(longestRowLength + 2 * spanLength);
|
|
381
341
|
if (border.length % 2 === 0) {
|
|
382
|
-
border += "*";
|
|
342
|
+
border += "*";
|
|
383
343
|
}
|
|
384
|
-
border = border.replace(/\*\*/g, "* ");
|
|
344
|
+
border = border.replace(/\*\*/g, "* ");
|
|
385
345
|
const formatRow = function (row) {
|
|
386
346
|
return (_.padEnd("*", spanLength) +
|
|
387
347
|
_.padEnd(row, border.length - 2 * spanLength) +
|
|
@@ -411,20 +371,12 @@ function trimSymbol(str, symbol) {
|
|
|
411
371
|
return str;
|
|
412
372
|
}
|
|
413
373
|
function parseJson(data) {
|
|
414
|
-
// Replace BOM from the header of the file if it exists
|
|
415
374
|
return JSON.parse(data.replace(/^\uFEFF/, ""));
|
|
416
375
|
}
|
|
417
|
-
// TODO: Use generic for predicatе predicate: (element: T|T[]) when TypeScript support this.
|
|
418
376
|
async function getFuturesResults(promises, predicate) {
|
|
419
377
|
const results = await Promise.all(promises);
|
|
420
378
|
return _(results).filter(predicate).flatten().value();
|
|
421
379
|
}
|
|
422
|
-
/**
|
|
423
|
-
* Appends zeroes to a version string until it reaches a specified length.
|
|
424
|
-
* @param {string} version The version on which to append zeroes.
|
|
425
|
-
* @param requiredVersionLength The required length of the version string.
|
|
426
|
-
* @returns {string} Appended version string. In case input is null, undefined or empty string, it is returned immediately without appending anything.
|
|
427
|
-
*/
|
|
428
380
|
function appendZeroesToVersion(version, requiredVersionLength) {
|
|
429
381
|
if (version) {
|
|
430
382
|
const zeroesToAppend = requiredVersionLength - version.split(".").length;
|
|
@@ -569,14 +521,6 @@ function getProjectFilesConfig(opts) {
|
|
|
569
521
|
};
|
|
570
522
|
return projectFilesConfig;
|
|
571
523
|
}
|
|
572
|
-
/**
|
|
573
|
-
* Tries to find the process id (PID) of the specified application identifier.
|
|
574
|
-
* This is specific implementation for iOS Simulator, where the running applications are real processes.
|
|
575
|
-
* Their PIDs are printed in a specific format in the the logs, once the application is started.
|
|
576
|
-
* @param {string} applicationIdentifier Application Identifier of the app for which we try to get the PID.
|
|
577
|
-
* @param {string} logLine Line that may contain the PID of the process.
|
|
578
|
-
* @returns {string} The PID of the searched application identifier in case it's found in the current line, null otherwise.
|
|
579
|
-
*/
|
|
580
524
|
function getPidFromiOSSimulatorLogs(applicationIdentifier, logLine) {
|
|
581
525
|
if (logLine) {
|
|
582
526
|
const pidRegExp = new RegExp(`${applicationIdentifier}:\\s?(\\d+)`);
|
|
@@ -624,7 +568,6 @@ function getWinRegPropertyValue(key, propertyName) {
|
|
|
624
568
|
function stringify(value, replacer, space) {
|
|
625
569
|
return JSON.stringify(value, replacer, space || 2);
|
|
626
570
|
}
|
|
627
|
-
//2019-01-07 18:29:50.745
|
|
628
571
|
function getFixedLengthDateString() {
|
|
629
572
|
const currentDate = new Date();
|
|
630
573
|
const year = currentDate.getFullYear();
|
|
@@ -647,28 +590,6 @@ function getFormattedMilliseconds(date) {
|
|
|
647
590
|
}
|
|
648
591
|
return milliseconds;
|
|
649
592
|
}
|
|
650
|
-
//--- begin part copied from AngularJS
|
|
651
|
-
//The MIT License
|
|
652
|
-
//
|
|
653
|
-
//Copyright (c) 2010-2012 Google, Inc. http://angularjs.org
|
|
654
|
-
//
|
|
655
|
-
//Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
656
|
-
//of this software and associated documentation files (the "Software"), to deal
|
|
657
|
-
//in the Software without restriction, including without limitation the rights
|
|
658
|
-
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
659
|
-
//copies of the Software, and to permit persons to whom the Software is
|
|
660
|
-
//furnished to do so, subject to the following conditions:
|
|
661
|
-
//
|
|
662
|
-
// The above copyright notice and this permission notice shall be included in
|
|
663
|
-
//all copies or substantial portions of the Software.
|
|
664
|
-
//
|
|
665
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
666
|
-
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
667
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
668
|
-
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
669
|
-
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
670
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
671
|
-
//THE SOFTWARE.
|
|
672
593
|
const CLASS_NAME = /class\s+([A-Z].+?)(?:\s+.*?)?\{/;
|
|
673
594
|
const CONSTRUCTOR_ARGS = /constructor\s*([^\(]*)\(\s*([^\)]*)\)/m;
|
|
674
595
|
const FN_NAME_AND_ARGS = /^(?:function)?\s*([^\(]*)\(\s*([^\)]*)\)\s*(=>)?\s*[{_]/m;
|
|
@@ -698,11 +619,6 @@ function annotate(fn) {
|
|
|
698
619
|
}
|
|
699
620
|
return $inject;
|
|
700
621
|
}
|
|
701
|
-
/**
|
|
702
|
-
* Returns true if all Android signing options are provided, false otherwise.
|
|
703
|
-
* @param {IAndroidSigningData} signingData The signing data to be validated.
|
|
704
|
-
* @return {void}
|
|
705
|
-
*/
|
|
706
622
|
function hasValidAndroidSigning(signingData) {
|
|
707
623
|
const isValid = signingData &&
|
|
708
624
|
signingData.keyStorePath &&
|
|
@@ -711,5 +627,3 @@ function hasValidAndroidSigning(signingData) {
|
|
|
711
627
|
signingData.keyStoreAliasPassword;
|
|
712
628
|
return !!isValid;
|
|
713
629
|
}
|
|
714
|
-
//--- end part copied from AngularJS
|
|
715
|
-
//# sourceMappingURL=helpers.js.map
|