nativescript 8.5.3 → 8.5.4-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/config.json +0 -5
- package/lib/.d.ts +2 -37
- package/lib/bootstrap.js +1 -12
- package/lib/color.js +5 -0
- package/lib/commands/build.js +2 -6
- package/lib/commands/clean.js +11 -10
- package/lib/commands/config.js +6 -5
- package/lib/commands/create-project.js +12 -11
- package/lib/commands/debug.js +10 -11
- package/lib/commands/plugin/list-plugins.js +3 -2
- package/lib/commands/post-install.js +3 -5
- package/lib/commands/preview.js +4 -3
- package/lib/commands/run.js +17 -19
- package/lib/commands/test-init.js +14 -15
- package/lib/commands/test.js +0 -3
- package/lib/commands/update.js +1 -1
- package/lib/common/bootstrap.js +0 -1
- package/lib/common/child-process.js +3 -3
- package/lib/common/codeGeneration/code-printer.js +1 -1
- package/lib/common/commands/device/device-log-stream.js +1 -1
- package/lib/common/commands/device/list-devices.js +7 -8
- package/lib/common/commands/generate-messages.js +1 -1
- package/lib/common/constants.js +11 -11
- package/lib/common/declarations.d.ts +1 -53
- package/lib/common/definitions/commands-service.d.ts +0 -1
- package/lib/common/definitions/commands.d.ts +0 -1
- package/lib/common/definitions/google-analytics.d.ts +0 -5
- package/lib/common/dispatchers.js +0 -5
- package/lib/common/file-system.js +18 -22
- package/lib/common/host-info.js +4 -4
- package/lib/common/http-client.js +2 -2
- package/lib/common/logger/layouts/cli-layout.js +6 -2
- package/lib/common/logger/logger.js +7 -7
- package/lib/common/mobile/android/android-debug-bridge-result-handler.js +1 -1
- package/lib/common/mobile/android/android-log-filter.js +5 -5
- package/lib/common/mobile/android/android-virtual-device-service.js +2 -2
- package/lib/common/mobile/android/genymotion/genymotion-service.js +2 -2
- package/lib/common/mobile/android/logcat-helper.js +1 -1
- package/lib/common/mobile/device-log-provider.js +8 -8
- package/lib/common/mobile/ios/device/ios-device-file-system.js +1 -1
- package/lib/common/mobile/ios/simulator/ios-emulator-services.js +1 -1
- package/lib/common/mobile/ios/simulator/ios-sim-resolver.js +1 -1
- package/lib/common/mobile/mobile-helper.js +1 -1
- package/lib/common/mobile/wp8/wp8-emulator-services.js +4 -4
- package/lib/common/opener.js +5 -1
- package/lib/common/plist-parser.js +3 -3
- package/lib/common/project-helper.js +2 -2
- package/lib/common/services/analytics/google-analytics-custom-dimensions.d.ts +7 -7
- package/lib/common/services/auto-completion-service.js +2 -2
- package/lib/common/services/commands-service.js +5 -114
- package/lib/common/services/help-service.js +16 -16
- package/lib/common/services/hooks-service.js +2 -1
- package/lib/common/services/json-file-settings-service.js +3 -3
- package/lib/common/services/lock-service.js +5 -5
- package/lib/common/services/messages-service.js +6 -6
- package/lib/common/services/net-service.js +1 -1
- package/lib/common/services/project-files-manager.js +2 -2
- package/lib/common/services/settings-service.js +2 -2
- package/lib/common/validators/project-name-validator.js +1 -1
- package/lib/common/validators/validation-result.js +1 -1
- package/lib/common/verify-node-version.js +2 -2
- package/lib/config.js +3 -8
- package/lib/constants.js +18 -32
- package/lib/controllers/build-controller.js +5 -5
- package/lib/controllers/debug-controller.js +2 -2
- package/lib/controllers/migrate-controller.js +21 -20
- package/lib/controllers/update-controller.js +5 -4
- package/lib/declarations.d.ts +0 -24
- package/lib/definitions/build.d.ts +1 -1
- package/lib/definitions/livesync.d.ts +0 -10
- package/lib/definitions/project.d.ts +0 -6
- package/lib/definitions/xcode.d.ts +1 -1
- package/lib/device-sockets/ios/app-debug-socket-proxy-factory.js +15 -4
- package/lib/device-sockets/ios/notification.js +1 -1
- package/lib/helpers/android-bundle-validator-helper.js +1 -1
- package/lib/helpers/network-connectivity-validator.js +1 -1
- package/lib/helpers/options-track-helper.js +1 -1
- package/lib/nativescript-cli.js +8 -10
- package/lib/options.js +61 -21
- package/lib/package-installation-manager.js +5 -4
- package/lib/project-data.js +9 -10
- package/lib/providers/project-files-provider.js +3 -3
- package/lib/services/analytics/analytics-broker-process.js +0 -3
- package/lib/services/analytics/analytics-broker.js +5 -5
- package/lib/services/analytics/analytics-service.js +0 -4
- package/lib/services/analytics/analytics.d.ts +1 -8
- package/lib/services/analytics/google-analytics-provider.js +1 -21
- package/lib/services/analytics-settings-service.js +3 -11
- package/lib/services/android-device-debug-service.js +3 -3
- package/lib/services/android-plugin-build-service.js +3 -3
- package/lib/services/android-resources-migration-service.js +1 -1
- package/lib/services/assets-generation/assets-generation-service.js +5 -5
- package/lib/services/{build-artefacts-service.js → build-artifacts-service.js} +4 -4
- package/lib/services/cocoapods-service.js +1 -1
- package/lib/services/device/device-install-app-service.js +3 -3
- package/lib/services/doctor-service.js +10 -9
- package/lib/services/extensibility-service.js +8 -8
- package/lib/services/ios-entitlements-service.js +1 -1
- package/lib/services/ios-project-service.js +5 -5
- package/lib/services/ios-provision-service.js +7 -7
- package/lib/services/ios-watch-app-service.js +1 -1
- package/lib/services/ip-service.js +2 -4
- package/lib/services/itmstransporter-service.js +2 -2
- package/lib/services/livesync/android-device-livesync-sockets-service.js +1 -1
- package/lib/services/livesync/android-livesync-tool.js +5 -5
- package/lib/services/livesync/ios-device-livesync-service.js +2 -2
- package/lib/services/livesync/platform-livesync-service-base.js +2 -1
- package/lib/services/log-parser-service.js +1 -5
- package/lib/services/log-source-map-service.js +10 -7
- package/lib/services/npm-config-service.js +23 -9
- package/lib/services/performance-service.js +3 -3
- package/lib/services/platform-environment-requirements.js +1 -1
- package/lib/services/plugins-service.js +19 -19
- package/lib/services/project-backup-service.js +4 -3
- package/lib/services/project-cleanup-service.js +4 -3
- package/lib/services/test-execution-service.js +2 -2
- package/lib/services/timeline-profiler-service.js +4 -1
- package/lib/services/user-settings-service.js +4 -4
- package/lib/tools/config-manipulation/config-transformer.js +3 -3
- package/lib/tools/node-modules/node-modules-builder.js +1 -1
- package/node_modules/@npmcli/move-file/LICENSE.md +22 -0
- package/node_modules/@npmcli/move-file/README.md +69 -0
- package/node_modules/@npmcli/move-file/lib/index.js +185 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/CHANGELOG.md +15 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/LICENSE +21 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/bin/cmd.js +68 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/index.js +31 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/find-made.js +29 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/mkdirp-manual.js +64 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/mkdirp-native.js +39 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/opts-arg.js +23 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/path-arg.js +29 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/use-native.js +10 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/package.json +44 -0
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/readme.markdown +266 -0
- package/node_modules/@npmcli/move-file/package.json +47 -0
- package/node_modules/balanced-match/.npmignore +5 -0
- package/node_modules/balanced-match/LICENSE.md +21 -0
- package/node_modules/balanced-match/README.md +91 -0
- package/node_modules/balanced-match/index.js +59 -0
- package/node_modules/balanced-match/package.json +49 -0
- package/node_modules/brace-expansion/LICENSE +21 -0
- package/node_modules/brace-expansion/README.md +129 -0
- package/node_modules/brace-expansion/index.js +201 -0
- package/node_modules/brace-expansion/package.json +47 -0
- package/node_modules/concat-map/.travis.yml +4 -0
- package/node_modules/concat-map/LICENSE +18 -0
- package/node_modules/concat-map/README.markdown +62 -0
- package/node_modules/concat-map/example/map.js +6 -0
- package/node_modules/concat-map/index.js +13 -0
- package/node_modules/concat-map/package.json +43 -0
- package/node_modules/concat-map/test/map.js +39 -0
- package/node_modules/fs.realpath/LICENSE +43 -0
- package/node_modules/fs.realpath/README.md +33 -0
- package/node_modules/fs.realpath/index.js +66 -0
- package/node_modules/fs.realpath/old.js +303 -0
- package/node_modules/fs.realpath/package.json +26 -0
- package/node_modules/inflight/LICENSE +15 -0
- package/node_modules/inflight/README.md +37 -0
- package/node_modules/inflight/inflight.js +54 -0
- package/node_modules/inflight/package.json +29 -0
- package/node_modules/inherits/LICENSE +16 -0
- package/node_modules/inherits/README.md +42 -0
- package/node_modules/inherits/inherits.js +9 -0
- package/node_modules/inherits/inherits_browser.js +27 -0
- package/node_modules/inherits/package.json +29 -0
- package/node_modules/once/LICENSE +15 -0
- package/node_modules/once/README.md +79 -0
- package/node_modules/once/once.js +42 -0
- package/node_modules/once/package.json +33 -0
- package/node_modules/path-is-absolute/index.js +20 -0
- package/node_modules/path-is-absolute/license +21 -0
- package/node_modules/path-is-absolute/package.json +43 -0
- package/node_modules/path-is-absolute/readme.md +59 -0
- package/node_modules/rimraf/CHANGELOG.md +65 -0
- package/node_modules/rimraf/LICENSE +15 -0
- package/node_modules/rimraf/README.md +101 -0
- package/node_modules/rimraf/bin.js +68 -0
- package/node_modules/rimraf/node_modules/glob/LICENSE +21 -0
- package/node_modules/rimraf/node_modules/glob/README.md +378 -0
- package/node_modules/rimraf/node_modules/glob/common.js +238 -0
- package/node_modules/rimraf/node_modules/glob/glob.js +790 -0
- package/node_modules/rimraf/node_modules/glob/package.json +55 -0
- package/node_modules/rimraf/node_modules/glob/sync.js +486 -0
- package/node_modules/rimraf/node_modules/minimatch/LICENSE +15 -0
- package/node_modules/rimraf/node_modules/minimatch/README.md +230 -0
- package/node_modules/rimraf/node_modules/minimatch/minimatch.js +947 -0
- package/node_modules/rimraf/node_modules/minimatch/package.json +33 -0
- package/node_modules/rimraf/package.json +32 -0
- package/node_modules/rimraf/rimraf.js +360 -0
- package/node_modules/stringify-package/CHANGELOG.md +16 -0
- package/node_modules/stringify-package/LICENSE +13 -0
- package/node_modules/stringify-package/README.md +55 -0
- package/node_modules/stringify-package/index.js +18 -0
- package/node_modules/stringify-package/package.json +38 -0
- package/node_modules/wrappy/LICENSE +15 -0
- package/node_modules/wrappy/README.md +36 -0
- package/node_modules/wrappy/package.json +29 -0
- package/node_modules/wrappy/wrappy.js +33 -0
- package/package.json +88 -89
- package/lib/common/definitions/byline.d.ts +0 -4
- package/lib/common/definitions/colors.d.ts +0 -24
- package/lib/common/definitions/marked.d.ts +0 -125
- package/lib/common/definitions/open.d.ts +0 -5
- package/lib/common/definitions/osenv.d.ts +0 -4
- package/lib/common/definitions/plist.d.ts +0 -7
- package/lib/common/definitions/rimraf.d.ts +0 -9
- package/lib/common/definitions/shelljs.d.ts +0 -583
- package/lib/common/definitions/simple-plist.d.ts +0 -7
- package/lib/common/definitions/xmlhttprequest.d.ts +0 -29
- package/lib/controllers/company-insights-controller.js +0 -78
- package/lib/controllers/preview-app-controller.js +0 -251
- package/lib/definitions/company-insights-controller.d.ts +0 -59
- package/lib/definitions/email-validator.d.ts +0 -8
- package/lib/definitions/libnpmconfig.d.ts +0 -3
- package/lib/definitions/npm.d.ts +0 -12
- package/lib/definitions/preview-app-livesync.d.ts +0 -116
- package/lib/services/livesync/playground/devices/preview-devices-service.js +0 -67
- package/lib/services/livesync/playground/preview-app-constants.js +0 -23
- package/lib/services/livesync/playground/preview-app-files-service.js +0 -83
- package/lib/services/livesync/playground/preview-app-log-provider.js +0 -14
- package/lib/services/livesync/playground/preview-app-plugins-service.js +0 -134
- package/lib/services/livesync/playground/preview-qr-code-service.js +0 -109
- package/lib/services/livesync/playground/preview-schema-service.js +0 -57
- package/lib/services/livesync/playground/preview-sdk-service.js +0 -112
- package/lib/services/playground-service.js +0 -65
- package/lib/xml-validator.js +0 -47
|
@@ -14,6 +14,7 @@ const _ = require("lodash");
|
|
|
14
14
|
const constants_1 = require("../constants");
|
|
15
15
|
const helpers_1 = require("../common/helpers");
|
|
16
16
|
const yok_1 = require("../common/yok");
|
|
17
|
+
const color_1 = require("../color");
|
|
17
18
|
class TestInitCommand {
|
|
18
19
|
constructor($packageManager, $projectData, $errors, $options, $prompter, $fs, $resources, $pluginsService, $logger, $testInitializationService) {
|
|
19
20
|
this.$packageManager = $packageManager;
|
|
@@ -99,11 +100,11 @@ class TestInitCommand {
|
|
|
99
100
|
let shouldCreateSampleTests = true;
|
|
100
101
|
if (this.$fs.exists(testsDir)) {
|
|
101
102
|
const specFilenamePattern = `<filename>.spec${projectFilesExtension}`;
|
|
102
|
-
bufferedLogs.push([
|
|
103
|
+
bufferedLogs.push(color_1.color.yellow([
|
|
103
104
|
`Note: The "${projectTestsDir}" directory already exists, will not create example tests in the project.`,
|
|
104
105
|
`You may create "${specFilenamePattern}" files anywhere you'd like.`,
|
|
105
106
|
"",
|
|
106
|
-
].join("\n")
|
|
107
|
+
].join("\n")));
|
|
107
108
|
shouldCreateSampleTests = false;
|
|
108
109
|
}
|
|
109
110
|
this.$fs.ensureDirectoryExists(testsDir);
|
|
@@ -124,42 +125,40 @@ class TestInitCommand {
|
|
|
124
125
|
if (shouldCreateSampleTests && this.$fs.exists(exampleFilePath)) {
|
|
125
126
|
this.$fs.copyFile(exampleFilePath, targetExampleTestPath);
|
|
126
127
|
const targetExampleTestRelativePath = path.relative(projectDir, targetExampleTestPath);
|
|
127
|
-
bufferedLogs.push(`Added example test: ${
|
|
128
|
+
bufferedLogs.push(`Added example test: ${color_1.color.yellow(targetExampleTestRelativePath)}`);
|
|
128
129
|
}
|
|
129
130
|
const testMainResourcesPath = this.$resources.resolvePath(`test/test-main${projectFilesExtension}`);
|
|
130
131
|
const testMainPath = path.join(this.$projectData.appDirectoryPath, `test${projectFilesExtension}`);
|
|
131
132
|
if (!this.$fs.exists(testMainPath)) {
|
|
132
133
|
this.$fs.copyFile(testMainResourcesPath, testMainPath);
|
|
133
134
|
const testMainRelativePath = path.relative(projectDir, testMainPath);
|
|
134
|
-
bufferedLogs.push(`Main test entrypoint created: ${
|
|
135
|
+
bufferedLogs.push(`Main test entrypoint created: ${color_1.color.yellow(testMainRelativePath)}`);
|
|
135
136
|
}
|
|
136
137
|
const testTsConfigTemplate = this.$resources.readText("test/tsconfig.spec.json");
|
|
137
138
|
const testTsConfig = _.template(testTsConfigTemplate)({
|
|
138
139
|
basePath: this.$projectData.getAppDirectoryRelativePath(),
|
|
139
140
|
});
|
|
140
141
|
this.$fs.writeFile(path.join(projectDir, "tsconfig.spec.json"), testTsConfig);
|
|
141
|
-
bufferedLogs.push(`Added/replaced ${"tsconfig.spec.json"
|
|
142
|
-
const greyDollarSign = "$"
|
|
142
|
+
bufferedLogs.push(`Added/replaced ${color_1.color.yellow("tsconfig.spec.json")}`);
|
|
143
|
+
const greyDollarSign = color_1.color.grey("$");
|
|
143
144
|
this.$logger.info([
|
|
144
145
|
[
|
|
145
|
-
`Tests using
|
|
146
|
-
|
|
147
|
-
`were successfully initialized
|
|
146
|
+
color_1.color.green(`Tests using`),
|
|
147
|
+
color_1.color.cyan(frameworkToInstall),
|
|
148
|
+
color_1.color.green(`were successfully initialized.`),
|
|
148
149
|
].join(" "),
|
|
149
150
|
"",
|
|
150
151
|
...bufferedLogs,
|
|
151
152
|
"",
|
|
152
|
-
`Note: @nativescript/unit-test-runner was included in "dependencies" as a convenience to automatically adjust your app's Info.plist on iOS and AndroidManifest.xml on Android to ensure the socket connects properly.`
|
|
153
|
-
.yellow,
|
|
153
|
+
color_1.color.yellow(`Note: @nativescript/unit-test-runner was included in "dependencies" as a convenience to automatically adjust your app's Info.plist on iOS and AndroidManifest.xml on Android to ensure the socket connects properly.`),
|
|
154
154
|
"",
|
|
155
|
-
`For production you may want to move to "devDependencies" and manage the settings yourself.`
|
|
156
|
-
.yellow,
|
|
155
|
+
color_1.color.yellow(`For production you may want to move to "devDependencies" and manage the settings yourself.`),
|
|
157
156
|
"",
|
|
158
157
|
"",
|
|
159
158
|
`You can now run your tests:`,
|
|
160
159
|
"",
|
|
161
|
-
` ${greyDollarSign} ${"ns test ios"
|
|
162
|
-
` ${greyDollarSign} ${"ns test android"
|
|
160
|
+
` ${greyDollarSign} ${color_1.color.green("ns test ios")}`,
|
|
161
|
+
` ${greyDollarSign} ${color_1.color.green("ns test android")}`,
|
|
163
162
|
"",
|
|
164
163
|
].join("\n"));
|
|
165
164
|
});
|
package/lib/commands/test.js
CHANGED
|
@@ -70,9 +70,6 @@ class TestCommandBase {
|
|
|
70
70
|
platform: this.platform,
|
|
71
71
|
projectDir: this.$projectData.projectDir,
|
|
72
72
|
options: this.$options,
|
|
73
|
-
notConfiguredEnvOptions: {
|
|
74
|
-
hideSyncToPreviewAppOption: true,
|
|
75
|
-
},
|
|
76
73
|
});
|
|
77
74
|
const canStartKarmaServer = yield this.$testExecutionService.canStartKarmaServer(this.$projectData);
|
|
78
75
|
if (!canStartKarmaServer) {
|
package/lib/commands/update.js
CHANGED
|
@@ -64,7 +64,7 @@ class UpdateCommand {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
exports.UpdateCommand = UpdateCommand;
|
|
68
67
|
UpdateCommand.SHOULD_MIGRATE_PROJECT_MESSAGE = 'This project is not compatible with the current NativeScript version and cannot be updated. Use "ns migrate" to make your project compatible.';
|
|
69
68
|
UpdateCommand.PROJECT_UP_TO_DATE_MESSAGE = "This project is up to date.";
|
|
69
|
+
exports.UpdateCommand = UpdateCommand;
|
|
70
70
|
yok_1.injector.registerCommand("update", UpdateCommand);
|
package/lib/common/bootstrap.js
CHANGED
|
@@ -4,7 +4,6 @@ const yok_1 = require("./yok");
|
|
|
4
4
|
const _ = require("lodash");
|
|
5
5
|
global._ = _;
|
|
6
6
|
global.$injector = yok_1.injector;
|
|
7
|
-
require("colors");
|
|
8
7
|
yok_1.injector.require("errors", "./errors");
|
|
9
8
|
yok_1.injector.requirePublic("fs", "./file-system");
|
|
10
9
|
yok_1.injector.require("hostInfo", "./host-info");
|
|
@@ -44,7 +44,7 @@ class ChildProcess extends events_1.EventEmitter {
|
|
|
44
44
|
}
|
|
45
45
|
execFile(command, args) {
|
|
46
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
this.$logger.
|
|
47
|
+
this.$logger.trace("execFile: %s %s", command, this.getArgumentsAsQuotedString(args));
|
|
48
48
|
return new Promise((resolve, reject) => {
|
|
49
49
|
child_process.execFile(command, args, (error, stdout) => {
|
|
50
50
|
if (error) {
|
|
@@ -63,11 +63,11 @@ class ChildProcess extends events_1.EventEmitter {
|
|
|
63
63
|
const cwd = (_a = options === null || options === void 0 ? void 0 : options.cwd) !== null && _a !== void 0 ? _a : process.cwd();
|
|
64
64
|
command = (0, path_1.resolve)(cwd, command);
|
|
65
65
|
}
|
|
66
|
-
this.$logger.
|
|
66
|
+
this.$logger.trace("spawn: %s %s", command, this.getArgumentsAsQuotedString(args));
|
|
67
67
|
return child_process.spawn(command, args, options);
|
|
68
68
|
}
|
|
69
69
|
fork(modulePath, args, options) {
|
|
70
|
-
this.$logger.
|
|
70
|
+
this.$logger.trace("fork: %s %s", modulePath, this.getArgumentsAsQuotedString(args));
|
|
71
71
|
return child_process.fork(modulePath, args, options);
|
|
72
72
|
}
|
|
73
73
|
spawnFromEvent(command, args, event, options, spawnFromEventOptions) {
|
|
@@ -40,9 +40,9 @@ class CodePrinter {
|
|
|
40
40
|
return content;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
exports.CodePrinter = CodePrinter;
|
|
44
43
|
CodePrinter.INDENT_CHAR = "\t";
|
|
45
44
|
CodePrinter.NEW_LINE_CHAR = os_1.EOL;
|
|
46
45
|
CodePrinter.START_BLOCK_CHAR = " {";
|
|
47
46
|
CodePrinter.END_BLOCK_CHAR = "}";
|
|
47
|
+
exports.CodePrinter = CodePrinter;
|
|
48
48
|
yok_1.injector.register("swaggerCodePrinter", CodePrinter);
|
|
@@ -39,6 +39,6 @@ class OpenDeviceLogStreamCommand {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
exports.OpenDeviceLogStreamCommand = OpenDeviceLogStreamCommand;
|
|
43
42
|
OpenDeviceLogStreamCommand.NOT_SPECIFIED_DEVICE_ERROR_MESSAGE = "More than one device found. Specify device explicitly.";
|
|
43
|
+
exports.OpenDeviceLogStreamCommand = OpenDeviceLogStreamCommand;
|
|
44
44
|
yok_1.injector.registerCommand(["device|log", "devices|log"], OpenDeviceLogStreamCommand);
|
|
@@ -13,6 +13,7 @@ exports.ListDevicesCommand = void 0;
|
|
|
13
13
|
const helpers_1 = require("../../helpers");
|
|
14
14
|
const constants_1 = require("../../../constants");
|
|
15
15
|
const yok_1 = require("../../yok");
|
|
16
|
+
const color_1 = require("../../../color");
|
|
16
17
|
class ListDevicesCommand {
|
|
17
18
|
constructor($devicesService, $errors, $emulatorHelper, $logger, $stringParameter, $mobileHelper, $options) {
|
|
18
19
|
this.$devicesService = $devicesService;
|
|
@@ -38,12 +39,10 @@ class ListDevicesCommand {
|
|
|
38
39
|
const emulators = this.$emulatorHelper.getEmulatorsFromAvailableEmulatorsOutput(availableEmulatorsOutput);
|
|
39
40
|
devices.available = emulators;
|
|
40
41
|
if (!this.$options.json) {
|
|
41
|
-
this.
|
|
42
|
+
this.$logger.info(color_1.color.bold("\n Available emulators"));
|
|
43
|
+
this.printEmulators(emulators);
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
|
-
if (!this.$options.json) {
|
|
45
|
-
this.$logger.info("\nConnected devices & emulators");
|
|
46
|
-
}
|
|
47
46
|
let index = 1;
|
|
48
47
|
yield this.$devicesService.initialize({
|
|
49
48
|
platform: args[0],
|
|
@@ -53,6 +52,9 @@ class ListDevicesCommand {
|
|
|
53
52
|
skipEmulatorStart: true,
|
|
54
53
|
fullDiscovery: true,
|
|
55
54
|
});
|
|
55
|
+
if (!this.$options.json) {
|
|
56
|
+
this.$logger.info(color_1.color.bold("\n Connected devices & emulators"));
|
|
57
|
+
}
|
|
56
58
|
const table = (0, helpers_1.createTable)([
|
|
57
59
|
"#",
|
|
58
60
|
"Device Name",
|
|
@@ -94,15 +96,13 @@ class ListDevicesCommand {
|
|
|
94
96
|
}
|
|
95
97
|
});
|
|
96
98
|
}
|
|
97
|
-
printEmulators(
|
|
98
|
-
this.$logger.info(title);
|
|
99
|
+
printEmulators(emulators) {
|
|
99
100
|
const table = (0, helpers_1.createTable)([
|
|
100
101
|
"Device Name",
|
|
101
102
|
"Platform",
|
|
102
103
|
"Version",
|
|
103
104
|
"Device Identifier",
|
|
104
105
|
"Image Identifier",
|
|
105
|
-
"Error Help",
|
|
106
106
|
], []);
|
|
107
107
|
for (const info of emulators) {
|
|
108
108
|
table.push([
|
|
@@ -111,7 +111,6 @@ class ListDevicesCommand {
|
|
|
111
111
|
info.version,
|
|
112
112
|
info.identifier || "",
|
|
113
113
|
info.imageIdentifier || "",
|
|
114
|
-
info.errorHelp || "",
|
|
115
114
|
]);
|
|
116
115
|
}
|
|
117
116
|
this.$logger.info(table.toString());
|
|
@@ -39,7 +39,7 @@ class GenerateMessages {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
exports.GenerateMessages = GenerateMessages;
|
|
43
42
|
GenerateMessages.MESSAGES_DEFINITIONS_FILE_NAME = "messages.interface.d.ts";
|
|
44
43
|
GenerateMessages.MESSAGES_IMPLEMENTATION_FILE_NAME = "messages.ts";
|
|
44
|
+
exports.GenerateMessages = GenerateMessages;
|
|
45
45
|
yok_1.injector.registerCommand("dev-generate-messages", GenerateMessages);
|
package/lib/common/constants.js
CHANGED
|
@@ -3,17 +3,17 @@ 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
4
|
class ProvisionType {
|
|
5
5
|
}
|
|
6
|
-
exports.ProvisionType = ProvisionType;
|
|
7
6
|
ProvisionType.Development = "Development";
|
|
8
7
|
ProvisionType.AdHoc = "AdHoc";
|
|
9
8
|
ProvisionType.AppStore = "AppStore";
|
|
10
9
|
ProvisionType.Enterprise = "Enterprise";
|
|
10
|
+
exports.ProvisionType = ProvisionType;
|
|
11
11
|
class DeviceTypes {
|
|
12
12
|
}
|
|
13
|
-
exports.DeviceTypes = DeviceTypes;
|
|
14
13
|
DeviceTypes.Emulator = "Emulator";
|
|
15
14
|
DeviceTypes.Simulator = "Simulator";
|
|
16
15
|
DeviceTypes.Device = "Device";
|
|
16
|
+
exports.DeviceTypes = DeviceTypes;
|
|
17
17
|
exports.APP_RESOURCES_FOLDER_NAME = "App_Resources";
|
|
18
18
|
exports.ERROR_NO_DEVICES = "Cannot find connected devices. Reconnect any connected devices, verify that your system recognizes them, and run this command again.";
|
|
19
19
|
exports.ERROR_CANT_USE_SIMULATOR = "You can use iOS simulator only on OS X.";
|
|
@@ -27,29 +27,29 @@ exports.NOT_RUNNING_EMULATOR_STATUS = "Not running";
|
|
|
27
27
|
exports.APPLE_VENDOR_NAME = "Apple";
|
|
28
28
|
class LiveSyncPaths {
|
|
29
29
|
}
|
|
30
|
-
exports.LiveSyncPaths = LiveSyncPaths;
|
|
31
30
|
LiveSyncPaths.SYNC_DIR_NAME = "sync";
|
|
32
31
|
LiveSyncPaths.REMOVEDSYNC_DIR_NAME = "removedsync";
|
|
33
32
|
LiveSyncPaths.FULLSYNC_DIR_NAME = "fullsync";
|
|
34
33
|
LiveSyncPaths.IOS_DEVICE_PROJECT_ROOT_PATH = "Library/Application Support/LiveSync";
|
|
35
34
|
LiveSyncPaths.IOS_DEVICE_SYNC_ZIP_PATH = "Library/Application Support/LiveSync/sync.zip";
|
|
36
35
|
LiveSyncPaths.ANDROID_TMP_DIR_NAME = "/data/local/tmp";
|
|
36
|
+
exports.LiveSyncPaths = LiveSyncPaths;
|
|
37
37
|
class HmrConstants {
|
|
38
38
|
}
|
|
39
|
-
exports.HmrConstants = HmrConstants;
|
|
40
39
|
HmrConstants.HMR_ERROR_STATUS = 3;
|
|
41
40
|
HmrConstants.HMR_SUCCESS_STATUS = 2;
|
|
41
|
+
exports.HmrConstants = HmrConstants;
|
|
42
42
|
class DeviceDiscoveryEventNames {
|
|
43
43
|
}
|
|
44
|
-
exports.DeviceDiscoveryEventNames = DeviceDiscoveryEventNames;
|
|
45
44
|
DeviceDiscoveryEventNames.DEVICE_FOUND = "deviceFound";
|
|
46
45
|
DeviceDiscoveryEventNames.DEVICE_UPDATED = "deviceUpdated";
|
|
47
46
|
DeviceDiscoveryEventNames.DEVICE_LOST = "deviceLost";
|
|
47
|
+
exports.DeviceDiscoveryEventNames = DeviceDiscoveryEventNames;
|
|
48
48
|
class EmulatorDiscoveryNames {
|
|
49
49
|
}
|
|
50
|
-
exports.EmulatorDiscoveryNames = EmulatorDiscoveryNames;
|
|
51
50
|
EmulatorDiscoveryNames.EMULATOR_IMAGE_FOUND = "emulatorImageFound";
|
|
52
51
|
EmulatorDiscoveryNames.EMULATOR_IMAGE_LOST = "emulatorImageLost";
|
|
52
|
+
exports.EmulatorDiscoveryNames = EmulatorDiscoveryNames;
|
|
53
53
|
exports.DEVICE_LOG_EVENT_NAME = "deviceLogData";
|
|
54
54
|
exports.IOS_LOG_PREDICATE = 'senderImagePath contains "NativeScript"';
|
|
55
55
|
exports.IOS_APP_CRASH_LOG_REG_EXP = /Fatal JavaScript exception \- application has been terminated/;
|
|
@@ -60,36 +60,36 @@ exports.TARGET_FRAMEWORK_IDENTIFIERS = {
|
|
|
60
60
|
};
|
|
61
61
|
class Configurations {
|
|
62
62
|
}
|
|
63
|
-
exports.Configurations = Configurations;
|
|
64
63
|
Configurations.Debug = "Debug";
|
|
65
64
|
Configurations.Release = "Release";
|
|
65
|
+
exports.Configurations = Configurations;
|
|
66
66
|
exports.NODE_MODULES_DIR_NAME = "node_modules";
|
|
67
67
|
exports.TNS_CORE_MODULES = "tns-core-modules";
|
|
68
68
|
class FileExtensions {
|
|
69
69
|
}
|
|
70
|
-
exports.FileExtensions = FileExtensions;
|
|
71
70
|
FileExtensions.TYPESCRIPT_DEFINITION_FILE = ".d.ts";
|
|
72
71
|
FileExtensions.TYPESCRIPT_FILE = ".ts";
|
|
73
72
|
FileExtensions.PNG_FILE = ".png";
|
|
74
73
|
FileExtensions.NINE_PATCH_PNG_FILE = ".9.png";
|
|
74
|
+
exports.FileExtensions = FileExtensions;
|
|
75
75
|
exports.IOS_POST_NOTIFICATION_COMMAND_TYPE = "PostNotification";
|
|
76
76
|
exports.IOS_OBSERVE_NOTIFICATION_COMMAND_TYPE = "ObserveNotification";
|
|
77
77
|
exports.IOS_RELAY_NOTIFICATION_COMMAND_TYPE = "RelayNotification";
|
|
78
78
|
class Proxy {
|
|
79
79
|
}
|
|
80
|
-
exports.Proxy = Proxy;
|
|
81
80
|
Proxy.CACHE_FILE_NAME = "proxy-cache.json";
|
|
82
81
|
Proxy.USE_PROXY = "USE_PROXY";
|
|
83
82
|
Proxy.PROXY_PORT = "PROXY_PORT";
|
|
84
83
|
Proxy.PROXY_HOSTNAME = "PROXY_HOSTNAME";
|
|
84
|
+
exports.Proxy = Proxy;
|
|
85
85
|
class HttpStatusCodes {
|
|
86
86
|
}
|
|
87
|
-
exports.HttpStatusCodes = HttpStatusCodes;
|
|
88
87
|
HttpStatusCodes.SEE_OTHER = 303;
|
|
89
88
|
HttpStatusCodes.NOT_MODIFIED = 304;
|
|
90
89
|
HttpStatusCodes.PAYMENT_REQUIRED = 402;
|
|
91
90
|
HttpStatusCodes.PROXY_AUTHENTICATION_REQUIRED = 407;
|
|
92
91
|
HttpStatusCodes.CONFLICTING_RESOURCE = 409;
|
|
92
|
+
exports.HttpStatusCodes = HttpStatusCodes;
|
|
93
93
|
exports.HttpProtocolToPort = {
|
|
94
94
|
"http:": 80,
|
|
95
95
|
"https:": 443,
|
|
@@ -99,7 +99,6 @@ exports.DEBUGGER_PORT_FOUND_EVENT_NAME = "DEBUGGER_PORT_FOUND";
|
|
|
99
99
|
exports.ATTACH_REQUEST_EVENT_NAME = "ATTACH_REQUEST";
|
|
100
100
|
class AndroidVirtualDevice {
|
|
101
101
|
}
|
|
102
|
-
exports.AndroidVirtualDevice = AndroidVirtualDevice;
|
|
103
102
|
AndroidVirtualDevice.ANDROID_DIR_NAME = ".android";
|
|
104
103
|
AndroidVirtualDevice.AVD_DIR_NAME = "avd";
|
|
105
104
|
AndroidVirtualDevice.ENCODING_MASK = /^avd\.ini\.encoding=(.*)$/;
|
|
@@ -119,4 +118,5 @@ AndroidVirtualDevice.AVD_VENDOR_NAME = "Avd";
|
|
|
119
118
|
AndroidVirtualDevice.TIMEOUT_SECONDS = 120;
|
|
120
119
|
AndroidVirtualDevice.GENYMOTION_DEFAULT_STDERR_STRING = "Logging activities to file";
|
|
121
120
|
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.";
|
|
121
|
+
exports.AndroidVirtualDevice = AndroidVirtualDevice;
|
|
122
122
|
exports.SOCKET_CONNECTION_TIMEOUT_MS = 30000;
|
|
@@ -217,11 +217,6 @@ declare const enum TrackingTypes {
|
|
|
217
217
|
*/
|
|
218
218
|
GoogleAnalyticsData = "googleAnalyticsData",
|
|
219
219
|
|
|
220
|
-
/**
|
|
221
|
-
* Defines that the broker process should get and track the data from preview app to Google Analytics
|
|
222
|
-
*/
|
|
223
|
-
PreviewAppData = "PreviewAppData",
|
|
224
|
-
|
|
225
220
|
/**
|
|
226
221
|
* Defines that the broker process should send all the pending information to Analytics.
|
|
227
222
|
* After that the process should send information it has finished tracking and die gracefully.
|
|
@@ -562,7 +557,7 @@ interface IFileSystem {
|
|
|
562
557
|
*/
|
|
563
558
|
getFileShasum(
|
|
564
559
|
fileName: string,
|
|
565
|
-
options?: { algorithm?: string; encoding?: "
|
|
560
|
+
options?: { algorithm?: string; encoding?: "hex" | "base64" }
|
|
566
561
|
): Promise<string>;
|
|
567
562
|
|
|
568
563
|
// shell.js wrappers
|
|
@@ -680,7 +675,6 @@ interface IFutureDispatcher {
|
|
|
680
675
|
|
|
681
676
|
interface ICommandDispatcher {
|
|
682
677
|
dispatchCommand(): Promise<void>;
|
|
683
|
-
completeCommand(): Promise<boolean>;
|
|
684
678
|
}
|
|
685
679
|
|
|
686
680
|
interface ICancellationService extends IDisposable {
|
|
@@ -815,11 +809,6 @@ interface IAnalyticsService {
|
|
|
815
809
|
*/
|
|
816
810
|
trackEventActionInGoogleAnalytics(data: IEventActionData): Promise<void>;
|
|
817
811
|
|
|
818
|
-
/**
|
|
819
|
-
* Tracks preview's app data to Google Analytics project.
|
|
820
|
-
*/
|
|
821
|
-
trackPreviewAppData(platform: string, projectDir: string): Promise<void>;
|
|
822
|
-
|
|
823
812
|
/**
|
|
824
813
|
* Defines if the instance should be disposed.
|
|
825
814
|
* @param {boolean} shouldDispose Defines if the instance should be disposed and the child processes should be disconnected.
|
|
@@ -885,37 +874,6 @@ interface IAnalyticsSettingsService {
|
|
|
885
874
|
* @returns {string} The user agent string.
|
|
886
875
|
*/
|
|
887
876
|
getUserAgentString(identifier: string): string;
|
|
888
|
-
|
|
889
|
-
/**
|
|
890
|
-
* Gets information for projects that are exported from playground
|
|
891
|
-
* @param projectDir Project directory path
|
|
892
|
-
*/
|
|
893
|
-
getPlaygroundInfo(projectDir?: string): Promise<IPlaygroundInfo>;
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
/**
|
|
897
|
-
* Designed for getting information for projects that are exported from playground.
|
|
898
|
-
*/
|
|
899
|
-
interface IPlaygroundService {
|
|
900
|
-
/**
|
|
901
|
-
* Gets information for projects that are exported from playground
|
|
902
|
-
* @return {Promise<IPlaygroundInfo>} collected info
|
|
903
|
-
* @param projectDir Project directory path
|
|
904
|
-
*/
|
|
905
|
-
getPlaygroundInfo(projectDir?: string): Promise<IPlaygroundInfo>;
|
|
906
|
-
}
|
|
907
|
-
/**
|
|
908
|
-
* Describes information about project that is exported from playground.
|
|
909
|
-
*/
|
|
910
|
-
interface IPlaygroundInfo {
|
|
911
|
-
/**
|
|
912
|
-
* The unique client identifier
|
|
913
|
-
*/
|
|
914
|
-
id: string;
|
|
915
|
-
/**
|
|
916
|
-
* Whether the user comes from tutorial page. Can be true or false
|
|
917
|
-
*/
|
|
918
|
-
usedTutorial: boolean;
|
|
919
877
|
}
|
|
920
878
|
|
|
921
879
|
interface IAutoCompletionService {
|
|
@@ -1739,16 +1697,6 @@ interface IiOSNotificationService {
|
|
|
1739
1697
|
): Promise<number>;
|
|
1740
1698
|
}
|
|
1741
1699
|
|
|
1742
|
-
// declare module "stringify-package" {
|
|
1743
|
-
// function stringifyPackage(data: any, indent: any, newline: string): string
|
|
1744
|
-
// export = stringifyPackage
|
|
1745
|
-
// }
|
|
1746
|
-
|
|
1747
|
-
// declare module "detect-newline" {
|
|
1748
|
-
// function detectNewline(data: string): string | null;
|
|
1749
|
-
// export = detectNewline
|
|
1750
|
-
// }
|
|
1751
|
-
|
|
1752
1700
|
/**
|
|
1753
1701
|
* Describes information for application.
|
|
1754
1702
|
*/
|
|
@@ -15,11 +15,6 @@ interface IGoogleAnalyticsData {
|
|
|
15
15
|
customDimensions?: IStringDictionary;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
interface IPreviewAppGoogleAnalyticsData {
|
|
19
|
-
platform: string;
|
|
20
|
-
additionalData?: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
18
|
/**
|
|
24
19
|
* Describes information about event that should be tracked.
|
|
25
20
|
*/
|
|
@@ -70,11 +70,6 @@ class CommandDispatcher {
|
|
|
70
70
|
yield this.$commandsService.tryExecuteCommand(commandName, commandArguments);
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
completeCommand() {
|
|
74
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
return this.$commandsService.completeCommand();
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
73
|
resolveCommand(commandName, commandArguments, argv) {
|
|
79
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
75
|
return { commandName, commandArguments, argv };
|
|
@@ -27,8 +27,9 @@ const shelljs = require("shelljs");
|
|
|
27
27
|
const helpers_1 = require("./helpers");
|
|
28
28
|
const constants_1 = require("../constants");
|
|
29
29
|
const os_1 = require("os");
|
|
30
|
-
const stringifyPackage = require("stringify-package");
|
|
31
30
|
const detectNewline = require("detect-newline");
|
|
31
|
+
const archiver_1 = require("archiver");
|
|
32
|
+
const stringifyPackage = require("stringify-package");
|
|
32
33
|
const mkdirp = require("mkdirp");
|
|
33
34
|
let FileSystem = FileSystem_1 = class FileSystem {
|
|
34
35
|
constructor($injector) {
|
|
@@ -37,31 +38,26 @@ let FileSystem = FileSystem_1 = class FileSystem {
|
|
|
37
38
|
zipFiles(zipFile, files, zipPathCallback) {
|
|
38
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
40
|
const $logger = this.$injector.resolve("logger");
|
|
40
|
-
const
|
|
41
|
-
|
|
41
|
+
const zip = (0, archiver_1.create)("zip", {
|
|
42
|
+
zlib: {
|
|
43
|
+
level: 9,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
42
46
|
const outFile = fs.createWriteStream(zipFile);
|
|
43
47
|
zip.pipe(outFile);
|
|
44
48
|
return new Promise((resolve, reject) => {
|
|
45
49
|
outFile.on("error", (err) => reject(err));
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
outFile.on("finish", () => resolve());
|
|
58
|
-
zip.finalize((bytesWritten) => {
|
|
59
|
-
$logger.debug("zipstream: %d bytes written", bytesWritten);
|
|
60
|
-
outFile.end();
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
zipCallback();
|
|
50
|
+
outFile.on("close", () => {
|
|
51
|
+
$logger.trace("zip: %d bytes written", zip.pointer());
|
|
52
|
+
resolve();
|
|
53
|
+
});
|
|
54
|
+
for (const file of files) {
|
|
55
|
+
let relativePath = zipPathCallback(file);
|
|
56
|
+
relativePath = relativePath.replace(/\\/g, "/");
|
|
57
|
+
$logger.trace("zipping as '%s' file '%s'", relativePath, file);
|
|
58
|
+
zip.append(fs.createReadStream(file), { name: relativePath });
|
|
59
|
+
}
|
|
60
|
+
zip.finalize();
|
|
65
61
|
});
|
|
66
62
|
});
|
|
67
63
|
}
|
package/lib/common/host-info.js
CHANGED
|
@@ -20,10 +20,6 @@ const decorators_1 = require("./decorators");
|
|
|
20
20
|
const _ = require("lodash");
|
|
21
21
|
const yok_1 = require("./yok");
|
|
22
22
|
class HostInfo {
|
|
23
|
-
constructor($errors, $injector) {
|
|
24
|
-
this.$errors = $errors;
|
|
25
|
-
this.$injector = $injector;
|
|
26
|
-
}
|
|
27
23
|
get $childProcess() {
|
|
28
24
|
return this.$injector.resolve("childProcess");
|
|
29
25
|
}
|
|
@@ -33,6 +29,10 @@ class HostInfo {
|
|
|
33
29
|
get $logger() {
|
|
34
30
|
return this.$injector.resolve("logger");
|
|
35
31
|
}
|
|
32
|
+
constructor($errors, $injector) {
|
|
33
|
+
this.$errors = $errors;
|
|
34
|
+
this.$injector = $injector;
|
|
35
|
+
}
|
|
36
36
|
get isWindows() {
|
|
37
37
|
return process.platform === HostInfo.WIN32_NAME;
|
|
38
38
|
}
|
|
@@ -64,7 +64,7 @@ class HttpClient {
|
|
|
64
64
|
if (!headers["User-Agent"]) {
|
|
65
65
|
if (!this.defaultUserAgent) {
|
|
66
66
|
this.defaultUserAgent = `${this.$staticConfig.USER_AGENT_NAME}/${this.$staticConfig.version} (Node.js ${process.versions.node}; ${process.platform}; ${process.arch})`;
|
|
67
|
-
this.$logger.
|
|
67
|
+
this.$logger.trace("User-Agent: %s", this.defaultUserAgent);
|
|
68
68
|
}
|
|
69
69
|
headers["User-Agent"] = this.defaultUserAgent;
|
|
70
70
|
}
|
|
@@ -167,7 +167,7 @@ class HttpClient {
|
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
exports.HttpClient = HttpClient;
|
|
171
170
|
HttpClient.STUCK_REQUEST_ERROR_MESSAGE = "The request can't receive any response.";
|
|
172
171
|
HttpClient.STUCK_RESPONSE_ERROR_MESSAGE = "Can't receive all parts of the response.";
|
|
172
|
+
exports.HttpClient = HttpClient;
|
|
173
173
|
yok_1.injector.register("httpClient", HttpClient);
|
|
@@ -5,6 +5,7 @@ const util_1 = require("util");
|
|
|
5
5
|
const helpers_1 = require("../../helpers");
|
|
6
6
|
const constants_1 = require("../../../constants");
|
|
7
7
|
const os_1 = require("os");
|
|
8
|
+
const color_1 = require("../../../color");
|
|
8
9
|
function layout(config) {
|
|
9
10
|
return function (logEvent) {
|
|
10
11
|
let msg = util_1.format.apply(null, logEvent.data);
|
|
@@ -18,10 +19,13 @@ function layout(config) {
|
|
|
18
19
|
return msg;
|
|
19
20
|
}
|
|
20
21
|
if (logEvent.level.isEqualTo(constants_1.LoggerLevel.ERROR)) {
|
|
21
|
-
return
|
|
22
|
+
return color_1.color.red.bold(msg);
|
|
22
23
|
}
|
|
23
24
|
if (logEvent.level.isEqualTo(constants_1.LoggerLevel.WARN)) {
|
|
24
|
-
return
|
|
25
|
+
return color_1.color.yellow(msg);
|
|
26
|
+
}
|
|
27
|
+
if (logEvent.level.isEqualTo(constants_1.LoggerLevel.TRACE)) {
|
|
28
|
+
return color_1.color.grey(msg);
|
|
25
29
|
}
|
|
26
30
|
return msg;
|
|
27
31
|
};
|
|
@@ -11,14 +11,14 @@ const log4js = require("log4js");
|
|
|
11
11
|
const util = require("util");
|
|
12
12
|
const readline = require("readline");
|
|
13
13
|
const stream = require("stream");
|
|
14
|
-
const
|
|
14
|
+
const marked_1 = require("marked");
|
|
15
15
|
const _ = require("lodash");
|
|
16
16
|
const decorators_1 = require("../decorators");
|
|
17
17
|
const cli_layout_1 = require("./layouts/cli-layout");
|
|
18
18
|
const constants_1 = require("../../constants");
|
|
19
19
|
const yok_1 = require("../yok");
|
|
20
|
+
const color_1 = require("../../color");
|
|
20
21
|
const TerminalRenderer = require("marked-terminal");
|
|
21
|
-
const chalk = require("chalk");
|
|
22
22
|
class Logger {
|
|
23
23
|
constructor($config) {
|
|
24
24
|
this.$config = $config;
|
|
@@ -109,9 +109,9 @@ class Logger {
|
|
|
109
109
|
printMarkdown(...args) {
|
|
110
110
|
const opts = {
|
|
111
111
|
unescape: true,
|
|
112
|
-
link:
|
|
113
|
-
strong:
|
|
114
|
-
firstHeading:
|
|
112
|
+
link: color_1.color.red,
|
|
113
|
+
strong: color_1.color.green.bold,
|
|
114
|
+
firstHeading: color_1.color.blue.bold,
|
|
115
115
|
tableOptions: {
|
|
116
116
|
chars: { mid: "", "left-mid": "", "mid-mid": "", "right-mid": "" },
|
|
117
117
|
style: {
|
|
@@ -123,8 +123,8 @@ class Logger {
|
|
|
123
123
|
},
|
|
124
124
|
},
|
|
125
125
|
};
|
|
126
|
-
marked.setOptions({ renderer: new TerminalRenderer(opts) });
|
|
127
|
-
const formattedMessage = marked(util.format.apply(null, args));
|
|
126
|
+
marked_1.marked.setOptions({ renderer: new TerminalRenderer(opts) });
|
|
127
|
+
const formattedMessage = (0, marked_1.marked)(util.format.apply(null, args));
|
|
128
128
|
this.info(formattedMessage, { [constants_1.LoggerConfigData.skipNewLine]: true });
|
|
129
129
|
}
|
|
130
130
|
isVerbose() {
|
|
@@ -46,7 +46,6 @@ class AndroidDebugBridgeResultHandler {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
exports.AndroidDebugBridgeResultHandler = AndroidDebugBridgeResultHandler;
|
|
50
49
|
AndroidDebugBridgeResultHandler.ANDROID_DEBUG_BRIDGE_ERRORS = [
|
|
51
50
|
{
|
|
52
51
|
name: "device unauthorized",
|
|
@@ -329,4 +328,5 @@ AndroidDebugBridgeResultHandler.ANDROID_DEBUG_BRIDGE_ERRORS = [
|
|
|
329
328
|
resultCode: -7,
|
|
330
329
|
},
|
|
331
330
|
];
|
|
331
|
+
exports.AndroidDebugBridgeResultHandler = AndroidDebugBridgeResultHandler;
|
|
332
332
|
yok_1.injector.register("androidDebugBridgeResultHandler", AndroidDebugBridgeResultHandler);
|