nativescript 8.5.1-dev.0 → 8.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/config/config.json +5 -0
  2. package/lib/.d.ts +37 -2
  3. package/lib/base-package-manager.js +1 -3
  4. package/lib/bootstrap.js +12 -1
  5. package/lib/commands/build.js +6 -2
  6. package/lib/commands/clean.js +1 -2
  7. package/lib/commands/config.js +5 -6
  8. package/lib/commands/create-project.js +11 -12
  9. package/lib/commands/debug.js +11 -10
  10. package/lib/commands/plugin/list-plugins.js +2 -3
  11. package/lib/commands/post-install.js +5 -3
  12. package/lib/commands/preview.js +3 -4
  13. package/lib/commands/run.js +19 -17
  14. package/lib/commands/test-init.js +15 -14
  15. package/lib/commands/test.js +3 -0
  16. package/lib/commands/update.js +1 -1
  17. package/lib/common/bootstrap.js +1 -0
  18. package/lib/common/child-process.js +3 -3
  19. package/lib/common/codeGeneration/code-printer.js +1 -1
  20. package/lib/common/commands/device/device-log-stream.js +1 -1
  21. package/lib/common/commands/device/list-devices.js +8 -7
  22. package/lib/common/commands/generate-messages.js +1 -1
  23. package/lib/common/constants.js +11 -11
  24. package/lib/common/declarations.d.ts +53 -1
  25. package/lib/common/definitions/byline.d.ts +4 -0
  26. package/lib/common/definitions/colors.d.ts +24 -0
  27. package/lib/common/definitions/commands-service.d.ts +1 -0
  28. package/lib/common/definitions/commands.d.ts +1 -0
  29. package/lib/common/definitions/google-analytics.d.ts +5 -0
  30. package/lib/common/definitions/marked.d.ts +125 -0
  31. package/lib/common/definitions/open.d.ts +5 -0
  32. package/lib/common/definitions/osenv.d.ts +4 -0
  33. package/lib/common/definitions/plist.d.ts +7 -0
  34. package/lib/common/definitions/rimraf.d.ts +9 -0
  35. package/lib/common/definitions/shelljs.d.ts +583 -0
  36. package/lib/common/definitions/simple-plist.d.ts +7 -0
  37. package/lib/common/definitions/xmlhttprequest.d.ts +29 -0
  38. package/lib/common/dispatchers.js +5 -0
  39. package/lib/common/file-system.js +22 -18
  40. package/lib/common/host-info.js +4 -4
  41. package/lib/common/http-client.js +2 -2
  42. package/lib/common/logger/layouts/cli-layout.js +2 -6
  43. package/lib/common/logger/logger.js +7 -7
  44. package/lib/common/mobile/android/android-debug-bridge-result-handler.js +1 -1
  45. package/lib/common/mobile/android/android-log-filter.js +5 -5
  46. package/lib/common/mobile/android/android-virtual-device-service.js +2 -2
  47. package/lib/common/mobile/android/genymotion/genymotion-service.js +2 -2
  48. package/lib/common/mobile/android/logcat-helper.js +1 -1
  49. package/lib/common/mobile/device-log-provider.js +8 -8
  50. package/lib/common/mobile/ios/device/ios-device-file-system.js +1 -1
  51. package/lib/common/mobile/ios/simulator/ios-emulator-services.js +1 -1
  52. package/lib/common/mobile/ios/simulator/ios-sim-resolver.js +1 -1
  53. package/lib/common/mobile/mobile-helper.js +1 -1
  54. package/lib/common/mobile/wp8/wp8-emulator-services.js +4 -4
  55. package/lib/common/opener.js +1 -5
  56. package/lib/common/plist-parser.js +3 -3
  57. package/lib/common/project-helper.js +2 -2
  58. package/lib/common/services/analytics/google-analytics-custom-dimensions.d.ts +7 -7
  59. package/lib/common/services/auto-completion-service.js +2 -2
  60. package/lib/common/services/commands-service.js +114 -5
  61. package/lib/common/services/help-service.js +16 -16
  62. package/lib/common/services/hooks-service.js +2 -3
  63. package/lib/common/services/json-file-settings-service.js +3 -3
  64. package/lib/common/services/lock-service.js +5 -5
  65. package/lib/common/services/messages-service.js +6 -6
  66. package/lib/common/services/net-service.js +1 -1
  67. package/lib/common/services/project-files-manager.js +2 -2
  68. package/lib/common/services/settings-service.js +2 -2
  69. package/lib/common/test/definitions/mocha.d.ts +86 -0
  70. package/lib/common/validators/project-name-validator.js +1 -1
  71. package/lib/common/validators/validation-result.js +1 -1
  72. package/lib/common/verify-node-version.js +2 -2
  73. package/lib/config.js +8 -3
  74. package/lib/constants.js +32 -18
  75. package/lib/controllers/build-controller.js +5 -5
  76. package/lib/controllers/company-insights-controller.js +78 -0
  77. package/lib/controllers/debug-controller.js +2 -2
  78. package/lib/controllers/migrate-controller.js +20 -21
  79. package/lib/controllers/preview-app-controller.js +251 -0
  80. package/lib/controllers/update-controller.js +4 -5
  81. package/lib/declarations.d.ts +24 -0
  82. package/lib/definitions/build.d.ts +1 -1
  83. package/lib/definitions/company-insights-controller.d.ts +59 -0
  84. package/lib/definitions/email-validator.d.ts +8 -0
  85. package/lib/definitions/libnpmconfig.d.ts +3 -0
  86. package/lib/definitions/livesync.d.ts +10 -0
  87. package/lib/definitions/npm.d.ts +12 -0
  88. package/lib/definitions/preview-app-livesync.d.ts +116 -0
  89. package/lib/definitions/project.d.ts +6 -0
  90. package/lib/definitions/xcode.d.ts +1 -1
  91. package/lib/device-sockets/ios/app-debug-socket-proxy-factory.js +4 -15
  92. package/lib/device-sockets/ios/notification.js +1 -1
  93. package/lib/helpers/android-bundle-validator-helper.js +1 -1
  94. package/lib/helpers/network-connectivity-validator.js +1 -1
  95. package/lib/helpers/options-track-helper.js +1 -1
  96. package/lib/nativescript-cli.js +10 -8
  97. package/lib/options.js +21 -61
  98. package/lib/package-installation-manager.js +4 -5
  99. package/lib/project-data.js +10 -9
  100. package/lib/providers/project-files-provider.js +3 -3
  101. package/lib/services/analytics/analytics-broker-process.js +3 -0
  102. package/lib/services/analytics/analytics-broker.js +5 -5
  103. package/lib/services/analytics/analytics-service.js +4 -0
  104. package/lib/services/analytics/analytics.d.ts +8 -1
  105. package/lib/services/analytics/google-analytics-provider.js +21 -1
  106. package/lib/services/analytics-settings-service.js +11 -3
  107. package/lib/services/android-device-debug-service.js +3 -3
  108. package/lib/services/android-plugin-build-service.js +36 -3
  109. package/lib/services/android-resources-migration-service.js +1 -1
  110. package/lib/services/assets-generation/assets-generation-service.js +5 -5
  111. package/lib/services/{build-artifacts-service.js → build-artefacts-service.js} +4 -4
  112. package/lib/services/cocoapods-service.js +1 -1
  113. package/lib/services/device/device-install-app-service.js +3 -3
  114. package/lib/services/doctor-service.js +9 -10
  115. package/lib/services/extensibility-service.js +8 -8
  116. package/lib/services/ios-entitlements-service.js +1 -1
  117. package/lib/services/ios-project-service.js +5 -5
  118. package/lib/services/ios-provision-service.js +7 -7
  119. package/lib/services/ios-watch-app-service.js +1 -1
  120. package/lib/services/ip-service.js +4 -2
  121. package/lib/services/itmstransporter-service.js +2 -2
  122. package/lib/services/livesync/android-device-livesync-sockets-service.js +1 -1
  123. package/lib/services/livesync/android-livesync-tool.js +5 -5
  124. package/lib/services/livesync/ios-device-livesync-service.js +2 -2
  125. package/lib/services/livesync/platform-livesync-service-base.js +1 -2
  126. package/lib/services/livesync/playground/devices/preview-devices-service.js +67 -0
  127. package/lib/services/livesync/playground/preview-app-constants.js +23 -0
  128. package/lib/services/livesync/playground/preview-app-files-service.js +83 -0
  129. package/lib/services/livesync/playground/preview-app-log-provider.js +14 -0
  130. package/lib/services/livesync/playground/preview-app-plugins-service.js +134 -0
  131. package/lib/services/livesync/playground/preview-qr-code-service.js +109 -0
  132. package/lib/services/livesync/playground/preview-schema-service.js +57 -0
  133. package/lib/services/livesync/playground/preview-sdk-service.js +112 -0
  134. package/lib/services/log-parser-service.js +5 -1
  135. package/lib/services/log-source-map-service.js +7 -10
  136. package/lib/services/npm-config-service.js +9 -23
  137. package/lib/services/performance-service.js +3 -3
  138. package/lib/services/platform-environment-requirements.js +1 -1
  139. package/lib/services/playground-service.js +65 -0
  140. package/lib/services/plugins-service.js +19 -19
  141. package/lib/services/project-backup-service.js +3 -4
  142. package/lib/services/project-cleanup-service.js +2 -3
  143. package/lib/services/test-execution-service.js +2 -2
  144. package/lib/services/timeline-profiler-service.js +1 -4
  145. package/lib/services/user-settings-service.js +4 -4
  146. package/lib/tools/config-manipulation/config-transformer.js +3 -3
  147. package/lib/tools/node-modules/node-modules-builder.js +1 -1
  148. package/lib/xml-validator.js +47 -0
  149. package/package.json +90 -88
  150. package/vendor/gradle-plugin/build.gradle +28 -176
  151. package/vendor/gradle-plugin/gradle.properties +16 -1
  152. package/lib/color.js +0 -5
  153. package/node_modules/@npmcli/move-file/LICENSE.md +0 -22
  154. package/node_modules/@npmcli/move-file/README.md +0 -69
  155. package/node_modules/@npmcli/move-file/lib/index.js +0 -185
  156. package/node_modules/@npmcli/move-file/node_modules/mkdirp/CHANGELOG.md +0 -15
  157. package/node_modules/@npmcli/move-file/node_modules/mkdirp/LICENSE +0 -21
  158. package/node_modules/@npmcli/move-file/node_modules/mkdirp/bin/cmd.js +0 -68
  159. package/node_modules/@npmcli/move-file/node_modules/mkdirp/index.js +0 -31
  160. package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/find-made.js +0 -29
  161. package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/mkdirp-manual.js +0 -64
  162. package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/mkdirp-native.js +0 -39
  163. package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/opts-arg.js +0 -23
  164. package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/path-arg.js +0 -29
  165. package/node_modules/@npmcli/move-file/node_modules/mkdirp/lib/use-native.js +0 -10
  166. package/node_modules/@npmcli/move-file/node_modules/mkdirp/package.json +0 -44
  167. package/node_modules/@npmcli/move-file/node_modules/mkdirp/readme.markdown +0 -266
  168. package/node_modules/@npmcli/move-file/package.json +0 -47
  169. package/node_modules/balanced-match/.npmignore +0 -5
  170. package/node_modules/balanced-match/LICENSE.md +0 -21
  171. package/node_modules/balanced-match/README.md +0 -91
  172. package/node_modules/balanced-match/index.js +0 -59
  173. package/node_modules/balanced-match/package.json +0 -49
  174. package/node_modules/brace-expansion/LICENSE +0 -21
  175. package/node_modules/brace-expansion/README.md +0 -129
  176. package/node_modules/brace-expansion/index.js +0 -201
  177. package/node_modules/brace-expansion/package.json +0 -47
  178. package/node_modules/concat-map/.travis.yml +0 -4
  179. package/node_modules/concat-map/LICENSE +0 -18
  180. package/node_modules/concat-map/README.markdown +0 -62
  181. package/node_modules/concat-map/example/map.js +0 -6
  182. package/node_modules/concat-map/index.js +0 -13
  183. package/node_modules/concat-map/package.json +0 -43
  184. package/node_modules/concat-map/test/map.js +0 -39
  185. package/node_modules/fs.realpath/LICENSE +0 -43
  186. package/node_modules/fs.realpath/README.md +0 -33
  187. package/node_modules/fs.realpath/index.js +0 -66
  188. package/node_modules/fs.realpath/old.js +0 -303
  189. package/node_modules/fs.realpath/package.json +0 -26
  190. package/node_modules/inflight/LICENSE +0 -15
  191. package/node_modules/inflight/README.md +0 -37
  192. package/node_modules/inflight/inflight.js +0 -54
  193. package/node_modules/inflight/package.json +0 -29
  194. package/node_modules/inherits/LICENSE +0 -16
  195. package/node_modules/inherits/README.md +0 -42
  196. package/node_modules/inherits/inherits.js +0 -9
  197. package/node_modules/inherits/inherits_browser.js +0 -27
  198. package/node_modules/inherits/package.json +0 -29
  199. package/node_modules/once/LICENSE +0 -15
  200. package/node_modules/once/README.md +0 -79
  201. package/node_modules/once/once.js +0 -42
  202. package/node_modules/once/package.json +0 -33
  203. package/node_modules/path-is-absolute/index.js +0 -20
  204. package/node_modules/path-is-absolute/license +0 -21
  205. package/node_modules/path-is-absolute/package.json +0 -43
  206. package/node_modules/path-is-absolute/readme.md +0 -59
  207. package/node_modules/rimraf/CHANGELOG.md +0 -65
  208. package/node_modules/rimraf/LICENSE +0 -15
  209. package/node_modules/rimraf/README.md +0 -101
  210. package/node_modules/rimraf/bin.js +0 -68
  211. package/node_modules/rimraf/node_modules/glob/LICENSE +0 -21
  212. package/node_modules/rimraf/node_modules/glob/README.md +0 -378
  213. package/node_modules/rimraf/node_modules/glob/common.js +0 -238
  214. package/node_modules/rimraf/node_modules/glob/glob.js +0 -790
  215. package/node_modules/rimraf/node_modules/glob/package.json +0 -55
  216. package/node_modules/rimraf/node_modules/glob/sync.js +0 -486
  217. package/node_modules/rimraf/node_modules/minimatch/LICENSE +0 -15
  218. package/node_modules/rimraf/node_modules/minimatch/README.md +0 -230
  219. package/node_modules/rimraf/node_modules/minimatch/minimatch.js +0 -947
  220. package/node_modules/rimraf/node_modules/minimatch/package.json +0 -33
  221. package/node_modules/rimraf/package.json +0 -32
  222. package/node_modules/rimraf/rimraf.js +0 -360
  223. package/node_modules/stringify-package/CHANGELOG.md +0 -16
  224. package/node_modules/stringify-package/LICENSE +0 -13
  225. package/node_modules/stringify-package/README.md +0 -55
  226. package/node_modules/stringify-package/index.js +0 -18
  227. package/node_modules/stringify-package/package.json +0 -38
  228. package/node_modules/wrappy/LICENSE +0 -15
  229. package/node_modules/wrappy/README.md +0 -36
  230. package/node_modules/wrappy/package.json +0 -29
  231. package/node_modules/wrappy/wrappy.js +0 -33
@@ -14,7 +14,6 @@ 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");
18
17
  class TestInitCommand {
19
18
  constructor($packageManager, $projectData, $errors, $options, $prompter, $fs, $resources, $pluginsService, $logger, $testInitializationService) {
20
19
  this.$packageManager = $packageManager;
@@ -100,11 +99,11 @@ class TestInitCommand {
100
99
  let shouldCreateSampleTests = true;
101
100
  if (this.$fs.exists(testsDir)) {
102
101
  const specFilenamePattern = `<filename>.spec${projectFilesExtension}`;
103
- bufferedLogs.push(color_1.color.yellow([
102
+ bufferedLogs.push([
104
103
  `Note: The "${projectTestsDir}" directory already exists, will not create example tests in the project.`,
105
104
  `You may create "${specFilenamePattern}" files anywhere you'd like.`,
106
105
  "",
107
- ].join("\n")));
106
+ ].join("\n").yellow);
108
107
  shouldCreateSampleTests = false;
109
108
  }
110
109
  this.$fs.ensureDirectoryExists(testsDir);
@@ -125,40 +124,42 @@ class TestInitCommand {
125
124
  if (shouldCreateSampleTests && this.$fs.exists(exampleFilePath)) {
126
125
  this.$fs.copyFile(exampleFilePath, targetExampleTestPath);
127
126
  const targetExampleTestRelativePath = path.relative(projectDir, targetExampleTestPath);
128
- bufferedLogs.push(`Added example test: ${color_1.color.yellow(targetExampleTestRelativePath)}`);
127
+ bufferedLogs.push(`Added example test: ${targetExampleTestRelativePath.yellow}`);
129
128
  }
130
129
  const testMainResourcesPath = this.$resources.resolvePath(`test/test-main${projectFilesExtension}`);
131
130
  const testMainPath = path.join(this.$projectData.appDirectoryPath, `test${projectFilesExtension}`);
132
131
  if (!this.$fs.exists(testMainPath)) {
133
132
  this.$fs.copyFile(testMainResourcesPath, testMainPath);
134
133
  const testMainRelativePath = path.relative(projectDir, testMainPath);
135
- bufferedLogs.push(`Main test entrypoint created: ${color_1.color.yellow(testMainRelativePath)}`);
134
+ bufferedLogs.push(`Main test entrypoint created: ${testMainRelativePath.yellow}`);
136
135
  }
137
136
  const testTsConfigTemplate = this.$resources.readText("test/tsconfig.spec.json");
138
137
  const testTsConfig = _.template(testTsConfigTemplate)({
139
138
  basePath: this.$projectData.getAppDirectoryRelativePath(),
140
139
  });
141
140
  this.$fs.writeFile(path.join(projectDir, "tsconfig.spec.json"), testTsConfig);
142
- bufferedLogs.push(`Added/replaced ${color_1.color.yellow("tsconfig.spec.json")}`);
143
- const greyDollarSign = color_1.color.grey("$");
141
+ bufferedLogs.push(`Added/replaced ${"tsconfig.spec.json".yellow}`);
142
+ const greyDollarSign = "$".grey;
144
143
  this.$logger.info([
145
144
  [
146
- color_1.color.green(`Tests using`),
147
- color_1.color.cyan(frameworkToInstall),
148
- color_1.color.green(`were successfully initialized.`),
145
+ `Tests using`.green,
146
+ frameworkToInstall.cyan,
147
+ `were successfully initialized.`.green,
149
148
  ].join(" "),
150
149
  "",
151
150
  ...bufferedLogs,
152
151
  "",
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.`),
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,
154
154
  "",
155
- color_1.color.yellow(`For production you may want to move to "devDependencies" and manage the settings yourself.`),
155
+ `For production you may want to move to "devDependencies" and manage the settings yourself.`
156
+ .yellow,
156
157
  "",
157
158
  "",
158
159
  `You can now run your tests:`,
159
160
  "",
160
- ` ${greyDollarSign} ${color_1.color.green("ns test ios")}`,
161
- ` ${greyDollarSign} ${color_1.color.green("ns test android")}`,
161
+ ` ${greyDollarSign} ${"ns test ios".green}`,
162
+ ` ${greyDollarSign} ${"ns test android".green}`,
162
163
  "",
163
164
  ].join("\n"));
164
165
  });
@@ -70,6 +70,9 @@ class TestCommandBase {
70
70
  platform: this.platform,
71
71
  projectDir: this.$projectData.projectDir,
72
72
  options: this.$options,
73
+ notConfiguredEnvOptions: {
74
+ hideSyncToPreviewAppOption: true,
75
+ },
73
76
  });
74
77
  const canStartKarmaServer = yield this.$testExecutionService.canStartKarmaServer(this.$projectData);
75
78
  if (!canStartKarmaServer) {
@@ -64,7 +64,7 @@ class UpdateCommand {
64
64
  });
65
65
  }
66
66
  }
67
+ exports.UpdateCommand = UpdateCommand;
67
68
  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.';
68
69
  UpdateCommand.PROJECT_UP_TO_DATE_MESSAGE = "This project is up to date.";
69
- exports.UpdateCommand = UpdateCommand;
70
70
  yok_1.injector.registerCommand("update", UpdateCommand);
@@ -4,6 +4,7 @@ const yok_1 = require("./yok");
4
4
  const _ = require("lodash");
5
5
  global._ = _;
6
6
  global.$injector = yok_1.injector;
7
+ require("colors");
7
8
  yok_1.injector.require("errors", "./errors");
8
9
  yok_1.injector.requirePublic("fs", "./file-system");
9
10
  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.trace("execFile: %s %s", command, this.getArgumentsAsQuotedString(args));
47
+ this.$logger.debug("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.trace("spawn: %s %s", command, this.getArgumentsAsQuotedString(args));
66
+ this.$logger.debug("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.trace("fork: %s %s", modulePath, this.getArgumentsAsQuotedString(args));
70
+ this.$logger.debug("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;
43
44
  CodePrinter.INDENT_CHAR = "\t";
44
45
  CodePrinter.NEW_LINE_CHAR = os_1.EOL;
45
46
  CodePrinter.START_BLOCK_CHAR = " {";
46
47
  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
- OpenDeviceLogStreamCommand.NOT_SPECIFIED_DEVICE_ERROR_MESSAGE = "More than one device found. Specify device explicitly.";
43
42
  exports.OpenDeviceLogStreamCommand = OpenDeviceLogStreamCommand;
43
+ OpenDeviceLogStreamCommand.NOT_SPECIFIED_DEVICE_ERROR_MESSAGE = "More than one device found. Specify device explicitly.";
44
44
  yok_1.injector.registerCommand(["device|log", "devices|log"], OpenDeviceLogStreamCommand);
@@ -13,7 +13,6 @@ 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");
17
16
  class ListDevicesCommand {
18
17
  constructor($devicesService, $errors, $emulatorHelper, $logger, $stringParameter, $mobileHelper, $options) {
19
18
  this.$devicesService = $devicesService;
@@ -39,10 +38,12 @@ class ListDevicesCommand {
39
38
  const emulators = this.$emulatorHelper.getEmulatorsFromAvailableEmulatorsOutput(availableEmulatorsOutput);
40
39
  devices.available = emulators;
41
40
  if (!this.$options.json) {
42
- this.$logger.info(color_1.color.bold("\n Available emulators"));
43
- this.printEmulators(emulators);
41
+ this.printEmulators("\nAvailable emulators", emulators);
44
42
  }
45
43
  }
44
+ if (!this.$options.json) {
45
+ this.$logger.info("\nConnected devices & emulators");
46
+ }
46
47
  let index = 1;
47
48
  yield this.$devicesService.initialize({
48
49
  platform: args[0],
@@ -52,9 +53,6 @@ class ListDevicesCommand {
52
53
  skipEmulatorStart: true,
53
54
  fullDiscovery: true,
54
55
  });
55
- if (!this.$options.json) {
56
- this.$logger.info(color_1.color.bold("\n Connected devices & emulators"));
57
- }
58
56
  const table = (0, helpers_1.createTable)([
59
57
  "#",
60
58
  "Device Name",
@@ -96,13 +94,15 @@ class ListDevicesCommand {
96
94
  }
97
95
  });
98
96
  }
99
- printEmulators(emulators) {
97
+ printEmulators(title, emulators) {
98
+ this.$logger.info(title);
100
99
  const table = (0, helpers_1.createTable)([
101
100
  "Device Name",
102
101
  "Platform",
103
102
  "Version",
104
103
  "Device Identifier",
105
104
  "Image Identifier",
105
+ "Error Help",
106
106
  ], []);
107
107
  for (const info of emulators) {
108
108
  table.push([
@@ -111,6 +111,7 @@ class ListDevicesCommand {
111
111
  info.version,
112
112
  info.identifier || "",
113
113
  info.imageIdentifier || "",
114
+ info.errorHelp || "",
114
115
  ]);
115
116
  }
116
117
  this.$logger.info(table.toString());
@@ -39,7 +39,7 @@ class GenerateMessages {
39
39
  });
40
40
  }
41
41
  }
42
+ exports.GenerateMessages = GenerateMessages;
42
43
  GenerateMessages.MESSAGES_DEFINITIONS_FILE_NAME = "messages.interface.d.ts";
43
44
  GenerateMessages.MESSAGES_IMPLEMENTATION_FILE_NAME = "messages.ts";
44
- exports.GenerateMessages = GenerateMessages;
45
45
  yok_1.injector.registerCommand("dev-generate-messages", GenerateMessages);
@@ -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;
6
7
  ProvisionType.Development = "Development";
7
8
  ProvisionType.AdHoc = "AdHoc";
8
9
  ProvisionType.AppStore = "AppStore";
9
10
  ProvisionType.Enterprise = "Enterprise";
10
- exports.ProvisionType = ProvisionType;
11
11
  class DeviceTypes {
12
12
  }
13
+ exports.DeviceTypes = DeviceTypes;
13
14
  DeviceTypes.Emulator = "Emulator";
14
15
  DeviceTypes.Simulator = "Simulator";
15
16
  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;
30
31
  LiveSyncPaths.SYNC_DIR_NAME = "sync";
31
32
  LiveSyncPaths.REMOVEDSYNC_DIR_NAME = "removedsync";
32
33
  LiveSyncPaths.FULLSYNC_DIR_NAME = "fullsync";
33
34
  LiveSyncPaths.IOS_DEVICE_PROJECT_ROOT_PATH = "Library/Application Support/LiveSync";
34
35
  LiveSyncPaths.IOS_DEVICE_SYNC_ZIP_PATH = "Library/Application Support/LiveSync/sync.zip";
35
36
  LiveSyncPaths.ANDROID_TMP_DIR_NAME = "/data/local/tmp";
36
- exports.LiveSyncPaths = LiveSyncPaths;
37
37
  class HmrConstants {
38
38
  }
39
+ exports.HmrConstants = HmrConstants;
39
40
  HmrConstants.HMR_ERROR_STATUS = 3;
40
41
  HmrConstants.HMR_SUCCESS_STATUS = 2;
41
- exports.HmrConstants = HmrConstants;
42
42
  class DeviceDiscoveryEventNames {
43
43
  }
44
+ exports.DeviceDiscoveryEventNames = DeviceDiscoveryEventNames;
44
45
  DeviceDiscoveryEventNames.DEVICE_FOUND = "deviceFound";
45
46
  DeviceDiscoveryEventNames.DEVICE_UPDATED = "deviceUpdated";
46
47
  DeviceDiscoveryEventNames.DEVICE_LOST = "deviceLost";
47
- exports.DeviceDiscoveryEventNames = DeviceDiscoveryEventNames;
48
48
  class EmulatorDiscoveryNames {
49
49
  }
50
+ exports.EmulatorDiscoveryNames = EmulatorDiscoveryNames;
50
51
  EmulatorDiscoveryNames.EMULATOR_IMAGE_FOUND = "emulatorImageFound";
51
52
  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;
63
64
  Configurations.Debug = "Debug";
64
65
  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;
70
71
  FileExtensions.TYPESCRIPT_DEFINITION_FILE = ".d.ts";
71
72
  FileExtensions.TYPESCRIPT_FILE = ".ts";
72
73
  FileExtensions.PNG_FILE = ".png";
73
74
  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;
80
81
  Proxy.CACHE_FILE_NAME = "proxy-cache.json";
81
82
  Proxy.USE_PROXY = "USE_PROXY";
82
83
  Proxy.PROXY_PORT = "PROXY_PORT";
83
84
  Proxy.PROXY_HOSTNAME = "PROXY_HOSTNAME";
84
- exports.Proxy = Proxy;
85
85
  class HttpStatusCodes {
86
86
  }
87
+ exports.HttpStatusCodes = HttpStatusCodes;
87
88
  HttpStatusCodes.SEE_OTHER = 303;
88
89
  HttpStatusCodes.NOT_MODIFIED = 304;
89
90
  HttpStatusCodes.PAYMENT_REQUIRED = 402;
90
91
  HttpStatusCodes.PROXY_AUTHENTICATION_REQUIRED = 407;
91
92
  HttpStatusCodes.CONFLICTING_RESOURCE = 409;
92
- exports.HttpStatusCodes = HttpStatusCodes;
93
93
  exports.HttpProtocolToPort = {
94
94
  "http:": 80,
95
95
  "https:": 443,
@@ -99,6 +99,7 @@ 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;
102
103
  AndroidVirtualDevice.ANDROID_DIR_NAME = ".android";
103
104
  AndroidVirtualDevice.AVD_DIR_NAME = "avd";
104
105
  AndroidVirtualDevice.ENCODING_MASK = /^avd\.ini\.encoding=(.*)$/;
@@ -118,5 +119,4 @@ AndroidVirtualDevice.AVD_VENDOR_NAME = "Avd";
118
119
  AndroidVirtualDevice.TIMEOUT_SECONDS = 120;
119
120
  AndroidVirtualDevice.GENYMOTION_DEFAULT_STDERR_STRING = "Logging activities to file";
120
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.";
121
- exports.AndroidVirtualDevice = AndroidVirtualDevice;
122
122
  exports.SOCKET_CONNECTION_TIMEOUT_MS = 30000;
@@ -217,6 +217,11 @@ 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
+
220
225
  /**
221
226
  * Defines that the broker process should send all the pending information to Analytics.
222
227
  * After that the process should send information it has finished tracking and die gracefully.
@@ -550,7 +555,7 @@ interface IFileSystem {
550
555
  */
551
556
  getFileShasum(
552
557
  fileName: string,
553
- options?: { algorithm?: string; encoding?: "hex" | "base64" }
558
+ options?: { algorithm?: string; encoding?: "latin1" | "hex" | "base64" }
554
559
  ): Promise<string>;
555
560
 
556
561
  // shell.js wrappers
@@ -668,6 +673,7 @@ interface IFutureDispatcher {
668
673
 
669
674
  interface ICommandDispatcher {
670
675
  dispatchCommand(): Promise<void>;
676
+ completeCommand(): Promise<boolean>;
671
677
  }
672
678
 
673
679
  interface ICancellationService extends IDisposable {
@@ -802,6 +808,11 @@ interface IAnalyticsService {
802
808
  */
803
809
  trackEventActionInGoogleAnalytics(data: IEventActionData): Promise<void>;
804
810
 
811
+ /**
812
+ * Tracks preview's app data to Google Analytics project.
813
+ */
814
+ trackPreviewAppData(platform: string, projectDir: string): Promise<void>;
815
+
805
816
  /**
806
817
  * Defines if the instance should be disposed.
807
818
  * @param {boolean} shouldDispose Defines if the instance should be disposed and the child processes should be disconnected.
@@ -867,6 +878,37 @@ interface IAnalyticsSettingsService {
867
878
  * @returns {string} The user agent string.
868
879
  */
869
880
  getUserAgentString(identifier: string): string;
881
+
882
+ /**
883
+ * Gets information for projects that are exported from playground
884
+ * @param projectDir Project directory path
885
+ */
886
+ getPlaygroundInfo(projectDir?: string): Promise<IPlaygroundInfo>;
887
+ }
888
+
889
+ /**
890
+ * Designed for getting information for projects that are exported from playground.
891
+ */
892
+ interface IPlaygroundService {
893
+ /**
894
+ * Gets information for projects that are exported from playground
895
+ * @return {Promise<IPlaygroundInfo>} collected info
896
+ * @param projectDir Project directory path
897
+ */
898
+ getPlaygroundInfo(projectDir?: string): Promise<IPlaygroundInfo>;
899
+ }
900
+ /**
901
+ * Describes information about project that is exported from playground.
902
+ */
903
+ interface IPlaygroundInfo {
904
+ /**
905
+ * The unique client identifier
906
+ */
907
+ id: string;
908
+ /**
909
+ * Whether the user comes from tutorial page. Can be true or false
910
+ */
911
+ usedTutorial: boolean;
870
912
  }
871
913
 
872
914
  interface IAutoCompletionService {
@@ -1690,6 +1732,16 @@ interface IiOSNotificationService {
1690
1732
  ): Promise<number>;
1691
1733
  }
1692
1734
 
1735
+ // declare module "stringify-package" {
1736
+ // function stringifyPackage(data: any, indent: any, newline: string): string
1737
+ // export = stringifyPackage
1738
+ // }
1739
+
1740
+ // declare module "detect-newline" {
1741
+ // function detectNewline(data: string): string | null;
1742
+ // export = detectNewline
1743
+ // }
1744
+
1693
1745
  /**
1694
1746
  * Describes information for application.
1695
1747
  */
@@ -0,0 +1,4 @@
1
+ declare module "byline" {
2
+ function lineStream(stream: any): any;
3
+ export = lineStream;
4
+ }
@@ -0,0 +1,24 @@
1
+ declare module "colors" {
2
+ export function setTheme(theme: any): void;
3
+ export function addSequencer(name: string, callback: Function): void;
4
+
5
+ // none, browser, console
6
+ export var mode: string;
7
+ }
8
+
9
+ interface String {
10
+ // In ES6 there's a method called `bold` in String interface.
11
+ // bold: String;
12
+ italic: String;
13
+ underline: String;
14
+ inverse: String;
15
+ white: String;
16
+ grey: String;
17
+ black: String;
18
+ blue: String;
19
+ cyan: String;
20
+ green: String;
21
+ magenta: String;
22
+ red: String;
23
+ yellow: String;
24
+ }
@@ -9,6 +9,7 @@ interface ICommandsService {
9
9
  commandName: string,
10
10
  commandArguments: string[]
11
11
  ): Promise<boolean>;
12
+ completeCommand(): Promise<boolean>;
12
13
  }
13
14
 
14
15
  /**
@@ -30,6 +30,7 @@ interface ICanExecuteCommandOptions {
30
30
  }
31
31
 
32
32
  interface INotConfiguredEnvOptions {
33
+ hideSyncToPreviewAppOption?: boolean;
33
34
  hideCloudBuildOption?: boolean;
34
35
  }
35
36
 
@@ -15,6 +15,11 @@ interface IGoogleAnalyticsData {
15
15
  customDimensions?: IStringDictionary;
16
16
  }
17
17
 
18
+ interface IPreviewAppGoogleAnalyticsData {
19
+ platform: string;
20
+ additionalData?: string;
21
+ }
22
+
18
23
  /**
19
24
  * Describes information about event that should be tracked.
20
25
  */
@@ -0,0 +1,125 @@
1
+ // Type definitions for Marked
2
+ // Project: https://github.com/chjj/marked
3
+ // Definitions by: William Orr <https://github.com/worr>
4
+ // Definitions: https://github.com/borisyankov/DefinitelyTyped
5
+
6
+ interface MarkedStatic {
7
+ /**
8
+ * Compiles markdown to HTML.
9
+ *
10
+ * @param src String of markdown source to be compiled
11
+ * @param callback Function called when the markdownString has been fully parsed when using async highlighting
12
+ * @return String of compiled HTML
13
+ */
14
+ (src: string, callback?: Function): string;
15
+
16
+ /**
17
+ * Compiles markdown to HTML.
18
+ *
19
+ * @param src String of markdown source to be compiled
20
+ * @param options Hash of options
21
+ * @param callback Function called when the markdownString has been fully parsed when using async highlighting
22
+ * @return String of compiled HTML
23
+ */
24
+ (src: string, options?: MarkedOptions, callback?: Function): string;
25
+
26
+ /**
27
+ * @param src String of markdown source to be compiled
28
+ * @param options Hash of options
29
+ */
30
+ lexer(src: string, options?: MarkedOptions): any[];
31
+
32
+ /**
33
+ * Compiles markdown to HTML.
34
+ *
35
+ * @param src String of markdown source to be compiled
36
+ * @param callback Function called when the markdownString has been fully parsed when using async highlighting
37
+ * @return String of compiled HTML
38
+ */
39
+ parse(src: string, callback: Function): string;
40
+
41
+ /**
42
+ * Compiles markdown to HTML.
43
+ *
44
+ * @param src String of markdown source to be compiled
45
+ * @param options Hash of options
46
+ * @param callback Function called when the markdownString has been fully parsed when using async highlighting
47
+ * @return String of compiled HTML
48
+ */
49
+ parse(src: string, options?: MarkedOptions, callback?: Function): string;
50
+
51
+ /**
52
+ * @param options Hash of options
53
+ */
54
+ parser(src: any[], options?: MarkedOptions): string;
55
+
56
+ /**
57
+ * Sets the default options.
58
+ *
59
+ * @param options Hash of options
60
+ */
61
+ setOptions(options: MarkedOptions): void;
62
+ }
63
+
64
+ interface MarkedOptions {
65
+ /**
66
+ * Enable GitHub flavored markdown.
67
+ */
68
+ gfm?: boolean;
69
+
70
+ /**
71
+ * Enable GFM tables. This option requires the gfm option to be true.
72
+ */
73
+ tables?: boolean;
74
+
75
+ /**
76
+ * Enable GFM line breaks. This option requires the gfm option to be true.
77
+ */
78
+ breaks?: boolean;
79
+
80
+ /**
81
+ * Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior.
82
+ */
83
+ pedantic?: boolean;
84
+
85
+ /**
86
+ * Sanitize the output. Ignore any HTML that has been input.
87
+ */
88
+ sanitize?: boolean;
89
+
90
+ /**
91
+ * Use smarter list behavior than the original markdown. May eventually be default with the old behavior moved into pedantic.
92
+ */
93
+ smartLists?: boolean;
94
+
95
+ /**
96
+ * Shows an HTML error message when rendering fails.
97
+ */
98
+ silent?: boolean;
99
+
100
+ /**
101
+ * A function to highlight code blocks. The function takes three arguments: code, lang, and callback.
102
+ */
103
+ highlight?(code: string, lang: string, callback?: Function): string;
104
+
105
+ /**
106
+ * Set the prefix for code block classes.
107
+ */
108
+ langPrefix?: string;
109
+
110
+ /**
111
+ * Use "smart" typograhic punctuation for things like quotes and dashes.
112
+ */
113
+ smartypants?: boolean;
114
+
115
+ /**
116
+ * An object containing functions to render tokens to HTML.
117
+ */
118
+ renderer?: any;
119
+ }
120
+
121
+ declare module "marked" {
122
+ export = marked;
123
+ }
124
+
125
+ declare var marked: MarkedStatic;
@@ -0,0 +1,5 @@
1
+ declare module "open" {
2
+ function open(target: string, appname: string): void;
3
+
4
+ export = open;
5
+ }
@@ -0,0 +1,4 @@
1
+ declare module "osenv" {
2
+ function home(): string;
3
+ function shell(): string;
4
+ }
@@ -0,0 +1,7 @@
1
+ // import { IDictionary } from "../declarations";
2
+
3
+ // declare module "plist" {
4
+ // export function parse(data: any): IDictionary<any>;
5
+ // export function build(data: any): string;
6
+ // }
7
+ export const blah = 0;
@@ -0,0 +1,9 @@
1
+ declare module "rimraf" {
2
+ function rimraf(path: string, callback: (error: Error) => void): void;
3
+ namespace rimraf {
4
+ export function sync(path: string): void;
5
+ export var EMFILE_MAX: number;
6
+ export var BUSYTRIES_MAX: number;
7
+ }
8
+ export = rimraf;
9
+ }