nativescript 8.6.0-vision.4 → 8.6.0-vision.6

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 (108) hide show
  1. package/README.md +1 -1
  2. package/docs/man_pages/cloud/cloud-setup.md +9 -9
  3. package/docs/man_pages/device/device-android.md +3 -3
  4. package/docs/man_pages/device/device-ios.md +5 -5
  5. package/docs/man_pages/device/device-list-applications.md +4 -4
  6. package/docs/man_pages/device/device-log.md +4 -4
  7. package/docs/man_pages/device/device-run.md +5 -5
  8. package/docs/man_pages/device/device.md +5 -5
  9. package/docs/man_pages/env-configuration/setup.md +3 -3
  10. package/docs/man_pages/general/autocomplete-disable.md +3 -3
  11. package/docs/man_pages/general/autocomplete-enable.md +3 -3
  12. package/docs/man_pages/general/autocomplete-status.md +3 -3
  13. package/docs/man_pages/general/autocomplete.md +6 -6
  14. package/docs/man_pages/general/error-reporting.md +3 -3
  15. package/docs/man_pages/general/extension-install.md +3 -3
  16. package/docs/man_pages/general/extension-uninstall.md +3 -3
  17. package/docs/man_pages/general/extension.md +3 -3
  18. package/docs/man_pages/general/help.md +6 -6
  19. package/docs/man_pages/general/info.md +3 -3
  20. package/docs/man_pages/general/migrate.md +3 -3
  21. package/docs/man_pages/general/package-manager-get.md +3 -3
  22. package/docs/man_pages/general/package-manager-set.md +3 -3
  23. package/docs/man_pages/general/package-manager.md +3 -3
  24. package/docs/man_pages/general/proxy-clear.md +3 -3
  25. package/docs/man_pages/general/proxy-set.md +3 -3
  26. package/docs/man_pages/general/proxy.md +3 -3
  27. package/docs/man_pages/general/update.md +5 -5
  28. package/docs/man_pages/general/usage-reporting.md +3 -3
  29. package/docs/man_pages/lib-management/plugin-add.md +4 -4
  30. package/docs/man_pages/lib-management/plugin-build.md +3 -3
  31. package/docs/man_pages/lib-management/plugin-create.md +7 -7
  32. package/docs/man_pages/lib-management/plugin-install.md +4 -4
  33. package/docs/man_pages/lib-management/plugin-remove.md +4 -4
  34. package/docs/man_pages/lib-management/plugin-update.md +3 -3
  35. package/docs/man_pages/lib-management/plugin.md +4 -4
  36. package/docs/man_pages/project/configuration/generate.md +3 -3
  37. package/docs/man_pages/project/configuration/install.md +6 -6
  38. package/docs/man_pages/project/configuration/platform-add.md +11 -11
  39. package/docs/man_pages/project/configuration/platform-clean.md +6 -6
  40. package/docs/man_pages/project/configuration/platform-remove.md +5 -5
  41. package/docs/man_pages/project/configuration/platform-update.md +11 -11
  42. package/docs/man_pages/project/configuration/platform.md +3 -3
  43. package/docs/man_pages/project/configuration/prepare.md +5 -5
  44. package/docs/man_pages/project/configuration/resources/resources-generate-icons.md +4 -4
  45. package/docs/man_pages/project/configuration/resources/resources-generate-splashes.md +4 -4
  46. package/docs/man_pages/project/configuration/resources/resources-update.md +5 -5
  47. package/docs/man_pages/project/creation/create.md +4 -4
  48. package/docs/man_pages/project/testing/build-android.md +4 -4
  49. package/docs/man_pages/project/testing/build-ios.md +6 -6
  50. package/docs/man_pages/project/testing/build.md +5 -5
  51. package/docs/man_pages/project/testing/debug-android.md +9 -9
  52. package/docs/man_pages/project/testing/debug-ios.md +11 -11
  53. package/docs/man_pages/project/testing/debug.md +4 -4
  54. package/docs/man_pages/project/testing/deploy.md +8 -8
  55. package/docs/man_pages/project/testing/dev-test-android.md +5 -5
  56. package/docs/man_pages/project/testing/dev-test-ios.md +7 -7
  57. package/docs/man_pages/project/testing/preview.md +4 -4
  58. package/docs/man_pages/project/testing/run-android.md +7 -7
  59. package/docs/man_pages/project/testing/run-ios.md +11 -11
  60. package/docs/man_pages/project/testing/run.md +7 -7
  61. package/docs/man_pages/project/testing/test-android.md +7 -7
  62. package/docs/man_pages/project/testing/test-init.md +3 -3
  63. package/docs/man_pages/project/testing/test-ios.md +9 -9
  64. package/docs/man_pages/project/testing/test.md +4 -4
  65. package/docs/man_pages/publishing/apple-login.md +3 -3
  66. package/docs/man_pages/publishing/appstore-upload.md +7 -7
  67. package/docs/man_pages/publishing/appstore.md +5 -5
  68. package/docs/man_pages/publishing/publish-ios.md +7 -7
  69. package/docs/man_pages/publishing/publish.md +6 -6
  70. package/docs/man_pages/start.md +2 -1
  71. package/lib/.d.ts +8 -0
  72. package/lib/bootstrap.js +4 -0
  73. package/lib/color.js +6 -1
  74. package/lib/commands/clean.js +4 -4
  75. package/lib/commands/run.js +7 -3
  76. package/lib/commands/start.js +33 -0
  77. package/lib/commands/typings.js +3 -3
  78. package/lib/common/definitions/config.d.ts +1 -0
  79. package/lib/common/definitions/key-commands.d.ts +61 -0
  80. package/lib/common/definitions/yok.d.ts +5 -0
  81. package/lib/common/header.js +30 -0
  82. package/lib/common/mobile/mobile-core/devices-service.js +11 -13
  83. package/lib/common/yok.js +25 -0
  84. package/lib/config.js +1 -0
  85. package/lib/controllers/migrate-controller.js +5 -5
  86. package/lib/controllers/prepare-controller.js +41 -4
  87. package/lib/controllers/run-controller.js +5 -0
  88. package/lib/definitions/livesync.d.ts +3 -0
  89. package/lib/definitions/prepare.d.ts +3 -0
  90. package/lib/definitions/project.d.ts +2 -0
  91. package/lib/definitions/run.d.ts +4 -1
  92. package/lib/definitions/start-service.d.ts +13 -0
  93. package/lib/helpers/key-command-helper.js +119 -0
  94. package/lib/helpers/livesync-command-helper.js +49 -18
  95. package/lib/key-commands/bootstrap.js +15 -0
  96. package/lib/key-commands/index.js +291 -0
  97. package/lib/services/android-plugin-build-service.js +6 -5
  98. package/lib/services/apple-portal/apple-portal-session-service.js +1 -1
  99. package/lib/services/build-artifacts-service.js +1 -1
  100. package/lib/services/ios-project-service.js +10 -10
  101. package/lib/services/livesync/android-livesync-tool.js +1 -1
  102. package/lib/services/plugins-service.js +2 -1
  103. package/lib/services/start-service.js +104 -0
  104. package/lib/services/webpack/webpack-compiler-service.js +9 -4
  105. package/node_modules/@npmcli/move-file/node_modules/mkdirp/CHANGELOG.md +15 -0
  106. package/node_modules/rimraf/CHANGELOG.md +65 -0
  107. package/node_modules/stringify-package/CHANGELOG.md +16 -0
  108. package/package.json +3 -2
@@ -1,13 +1,13 @@
1
1
  <% if (isJekyll) { %>---
2
- title: tns test
2
+ title: ns test
3
3
  position: 23
4
4
  ---<% } %>
5
5
 
6
- # tns test
6
+ # ns test
7
7
 
8
8
  ### Description
9
9
 
10
- Runs unit tests on the selected mobile platform.<% if(isConsole) { %> Your project must already be configured for unit testing by running `$ tns test init`.<% } %>
10
+ Runs unit tests on the selected mobile platform.<% if(isConsole) { %> Your project must already be configured for unit testing by running `$ ns test init`.<% } %>
11
11
 
12
12
  <% if(isHtml) { %>
13
13
  #### How file changes are handled
@@ -23,7 +23,7 @@ Runs unit tests on the selected mobile platform.<% if(isConsole) { %> Your proje
23
23
 
24
24
  Usage | Synopsis
25
25
  ------|-------
26
- <% if((isConsole && isMacOS) || isHtml) { %>General | `$ tns test <Platform>`<% } %><% if(isConsole && (isLinux || isWindows)) { %>General | `$ tns test android`<% } %>
26
+ <% if((isConsole && isMacOS) || isHtml) { %>General | `$ ns test <Platform>`<% } %><% if(isConsole && (isLinux || isWindows)) { %>General | `$ ns test android`<% } %>
27
27
 
28
28
  <% if((isConsole && isMacOS) || isHtml) { %>### Arguments
29
29
  `<Platform>` is the target mobile platform on which you want to run the tests. You can set the following target platforms.
@@ -1,9 +1,9 @@
1
1
  <% if (isJekyll) { %>---
2
- title: tns apple-login
2
+ title: ns apple-login
3
3
  position: 5
4
4
  ---<% } %>
5
5
 
6
- # tns apple-login
6
+ # ns apple-login
7
7
 
8
8
  ### Description
9
9
 
@@ -13,7 +13,7 @@ Uses the provided Apple credentials to obtain Apple session which can be used wh
13
13
 
14
14
  Usage | Synopsis
15
15
  ---|---
16
- General | `$ tns apple-login [<Apple ID>] [<Password>]`
16
+ General | `$ ns apple-login [<Apple ID>] [<Password>]`
17
17
 
18
18
  ### Arguments
19
19
 
@@ -1,24 +1,24 @@
1
1
  <% if (isJekyll) { %>---
2
- title: tns appstore upload
2
+ title: ns appstore upload
3
3
  position: 1
4
4
  ---<% } %>
5
5
 
6
- # tns appstore upload
6
+ # ns appstore upload
7
7
 
8
8
  ### Description
9
9
 
10
10
  Uploads project to iTunes Connect. The command either issues a production build and uploads it to iTunes Connect, or uses an already built package to upload.
11
- The user will be prompted interactively for verification code when two-factor authentication enabled account is used. As on non-interactive console (CI), you will not be prompt for verification code. In this case, you need to generate a login session for your apple's account in advance using `tns apple-login` command. The generated value must be provided via the `--appleSessionBase64` option and is only valid for up to a month. Meaning you'll need to create a new session every month.
11
+ The user will be prompted interactively for verification code when two-factor authentication enabled account is used. As on non-interactive console (CI), you will not be prompt for verification code. In this case, you need to generate a login session for your apple's account in advance using `ns apple-login` command. The generated value must be provided via the `--appleSessionBase64` option and is only valid for up to a month. Meaning you'll need to create a new session every month.
12
12
 
13
- <% if(isConsole && (isLinux || isWindows)) { %>WARNING: You can run this command only on macOS systems. To view the complete help for this command, run `$ tns help appstore upload`<% } %>
13
+ <% if(isConsole && (isLinux || isWindows)) { %>WARNING: You can run this command only on macOS systems. To view the complete help for this command, run `$ ns help appstore upload`<% } %>
14
14
  <% if((isConsole && isMacOS) || isHtml) { %>
15
15
 
16
16
  ### Commands
17
17
 
18
18
  Usage | Synopsis
19
19
  ---|---
20
- Build and upload package | `$ tns appstore upload [<Apple ID> [<Password> [<Mobile Provisioning Profile Identifier> [<Code Sign Identity>]]]]]`
21
- Upload package | `$ tns appstore upload [<Apple ID> [<Password>]] --ipa <Ipa File Path>`
20
+ Build and upload package | `$ ns appstore upload [<Apple ID> [<Password> [<Mobile Provisioning Profile Identifier> [<Code Sign Identity>]]]]]`
21
+ Upload package | `$ ns appstore upload [<Apple ID> [<Password>]] --ipa <Ipa File Path>`
22
22
 
23
23
  ### Options
24
24
 
@@ -36,7 +36,7 @@ Upload package | `$ tns appstore upload [<Apple ID> [<Password>]] --ipa <Ipa Fil
36
36
 
37
37
  ### Command Limitations
38
38
 
39
- * You can run `$ tns appstore upload` only on macOS systems.
39
+ * You can run `$ ns appstore upload` only on macOS systems.
40
40
 
41
41
  ### Related Commands
42
42
 
@@ -1,9 +1,9 @@
1
1
  <% if (isJekyll) { %>---
2
- title: tns appstore
2
+ title: ns appstore
3
3
  position: 2
4
4
  ---<% } %>
5
5
 
6
- # tns appstore
6
+ # ns appstore
7
7
 
8
8
  ### Description
9
9
 
@@ -13,8 +13,8 @@ Lists all application records in iTunes Connect. The list contains name, version
13
13
 
14
14
  Usage | Synopsis
15
15
  ---|---
16
- List applications | `$ tns appstore [<Apple ID> [<Password>]]`
17
- <% if((isConsole && isMacOS) || isHtml) { %>Upload | `$ tns appstore upload`<% } %>
16
+ List applications | `$ ns appstore [<Apple ID> [<Password>]]`
17
+ <% if((isConsole && isMacOS) || isHtml) { %>Upload | `$ ns appstore upload`<% } %>
18
18
 
19
19
  ### Arguments
20
20
 
@@ -27,7 +27,7 @@ List applications | `$ tns appstore [<Apple ID> [<Password>]]`
27
27
 
28
28
  ### Command Limitations
29
29
 
30
- * You can run `$ tns appstore upload` only on macOS systems.
30
+ * You can run `$ ns appstore upload` only on macOS systems.
31
31
 
32
32
  ### Related Commands
33
33
 
@@ -1,23 +1,23 @@
1
1
  <% if (isJekyll) { %>---
2
- title: tns publish ios
2
+ title: ns publish ios
3
3
  position: 3
4
4
  ---<% } %>
5
5
 
6
- # tns publish ios
6
+ # ns publish ios
7
7
 
8
8
  ### Description
9
9
 
10
10
  Uploads project to iTunes Connect. The command either issues a production build and uploads it to iTunes Connect, or uses an already built package to upload.
11
- The user will be prompted interactively for verification code when two-factor authentication enabled account is used. As on non-interactive console (CI), you will not be prompt for verification code. In this case, you need to generate a login session for your apple's account in advance using `tns apple-login` command. The generated value must be provided via the `--appleSessionBase64` option and is only valid for up to a month. Meaning you'll need to create a new session every month.
11
+ The user will be prompted interactively for verification code when two-factor authentication enabled account is used. As on non-interactive console (CI), you will not be prompt for verification code. In this case, you need to generate a login session for your apple's account in advance using `ns apple-login` command. The generated value must be provided via the `--appleSessionBase64` option and is only valid for up to a month. Meaning you'll need to create a new session every month.
12
12
 
13
- <% if(isConsole && (isLinux || isWindows)) { %>WARNING: You can run this command only on macOS systems. To view the complete help for this command, run `$ tns help publish ios`<% } %>
13
+ <% if(isConsole && (isLinux || isWindows)) { %>WARNING: You can run this command only on macOS systems. To view the complete help for this command, run `$ ns help publish ios`<% } %>
14
14
 
15
15
  ### Commands
16
16
 
17
17
  Usage | Synopsis
18
18
  ---|---
19
- Build and upload package | `$ tns publish ios [<Apple ID> [<Password> [<Mobile Provisioning Profile Identifier> [<Code Sign Identity>]]]]]`
20
- Upload package | `$ tns publish ios [<Apple ID> [<Password>]] --ipa <Ipa File Path>`
19
+ Build and upload package | `$ ns publish ios [<Apple ID> [<Password> [<Mobile Provisioning Profile Identifier> [<Code Sign Identity>]]]]]`
20
+ Upload package | `$ ns publish ios [<Apple ID> [<Password>]] --ipa <Ipa File Path>`
21
21
 
22
22
  <% if((isConsole && isMacOS) || isHtml) { %>
23
23
 
@@ -38,7 +38,7 @@ Upload package | `$ tns publish ios [<Apple ID> [<Password>]] --ipa <Ipa File Pa
38
38
 
39
39
  ### Command Limitations
40
40
 
41
- * You can run `$ tns publish ios` only on macOS systems.
41
+ * You can run `$ ns publish ios` only on macOS systems.
42
42
 
43
43
  ### Related Commands
44
44
 
@@ -1,28 +1,28 @@
1
1
  <% if (isJekyll) { %>---
2
- title: tns publish
2
+ title: ns publish
3
3
  position: 4
4
4
  ---<% } %>
5
5
 
6
- # tns publish
6
+ # ns publish
7
7
 
8
8
  ### Description
9
9
 
10
10
  Uploads project to an application store.
11
11
 
12
- <% if(isConsole && (isLinux || isWindows)) { %>WARNING: You can run this command only on macOS systems. To view the complete help for this command, run `$ tns help publish ios`<% } %>
12
+ <% if(isConsole && (isLinux || isWindows)) { %>WARNING: You can run this command only on macOS systems. To view the complete help for this command, run `$ ns help publish ios`<% } %>
13
13
 
14
14
  ### Commands
15
15
 
16
16
  Usage | Synopsis
17
17
  ---|---
18
- General | `$ tns publish ios`
18
+ General | `$ ns publish ios`
19
19
 
20
20
  <% if(isHtml) { %>
21
21
 
22
22
  ### Command Limitations
23
23
 
24
- * You can run `$ tns publish` only on macOS systems.
25
- * Currently, you can use `$ tns publish` only to publish iOS applications.
24
+ * You can run `$ ns publish` only on macOS systems.
25
+ * Currently, you can use `$ ns publish` only to publish iOS applications.
26
26
 
27
27
  ### Related Commands
28
28
 
@@ -7,8 +7,9 @@ position: 1
7
7
 
8
8
  Usage | Synopsis
9
9
  ------|-------
10
- General | `$ tns <Command> [Command Parameters] [--command <Options>]`
10
+ General | `$ ns <Command> [Command Parameters] [--command <Options>]`
11
11
  Alias | `$ nativescript <Command> [Command Parameters] [--command <Options>]`
12
+ Alias | `$ tns <Command> [Command Parameters] [--command <Options>]`
12
13
 
13
14
  ## General Commands
14
15
 
package/lib/.d.ts CHANGED
@@ -39,6 +39,7 @@
39
39
  /// <reference path="commands/resources/resources-update.ts" />
40
40
  /// <reference path="commands/run.ts" />
41
41
  /// <reference path="commands/setup.ts" />
42
+ /// <reference path="commands/start.ts" />
42
43
  /// <reference path="commands/test-init.ts" />
43
44
  /// <reference path="commands/test.ts" />
44
45
  /// <reference path="commands/typings.ts" />
@@ -83,6 +84,7 @@
83
84
  /// <reference path="common/definitions/extensibility.d.ts" />
84
85
  /// <reference path="common/definitions/google-analytics.d.ts" />
85
86
  /// <reference path="common/definitions/json-file-settings-service.d.ts" />
87
+ /// <reference path="common/definitions/key-commands.d.ts" />
86
88
  /// <reference path="common/definitions/logger.d.ts" />
87
89
  /// <reference path="common/definitions/mobile.d.ts" />
88
90
  /// <reference path="common/definitions/validator.d.ts" />
@@ -91,6 +93,7 @@
91
93
  /// <reference path="common/doctor.d.ts" />
92
94
  /// <reference path="common/errors.ts" />
93
95
  /// <reference path="common/file-system.ts" />
96
+ /// <reference path="common/header.ts" />
94
97
  /// <reference path="common/helpers.ts" />
95
98
  /// <reference path="common/host-info.ts" />
96
99
  /// <reference path="common/http-client.ts" />
@@ -272,6 +275,7 @@
272
275
  /// <reference path="definitions/qr-code.d.ts" />
273
276
  /// <reference path="definitions/require.d.ts" />
274
277
  /// <reference path="definitions/run.d.ts" />
278
+ /// <reference path="definitions/start-service.d.ts" />
275
279
  /// <reference path="definitions/subscription-service.d.ts" />
276
280
  /// <reference path="definitions/system-warnings.d.ts" />
277
281
  /// <reference path="definitions/temp-service.d.ts" />
@@ -289,12 +293,15 @@
289
293
  /// <reference path="device-sockets/ios/socket-request-executor.ts" />
290
294
  /// <reference path="helpers/android-bundle-validator-helper.ts" />
291
295
  /// <reference path="helpers/deploy-command-helper.ts" />
296
+ /// <reference path="helpers/key-command-helper.ts" />
292
297
  /// <reference path="helpers/livesync-command-helper.ts" />
293
298
  /// <reference path="helpers/network-connectivity-validator.ts" />
294
299
  /// <reference path="helpers/options-track-helper.ts" />
295
300
  /// <reference path="helpers/package-path-helper.ts" />
296
301
  /// <reference path="helpers/platform-command-helper.ts" />
297
302
  /// <reference path="helpers/version-validator-helper.ts" />
303
+ /// <reference path="key-commands/bootstrap.ts" />
304
+ /// <reference path="key-commands/index.ts" />
298
305
  /// <reference path="nativescript-cli-lib-bootstrap.ts" />
299
306
  /// <reference path="nativescript-cli-lib.ts" />
300
307
  /// <reference path="nativescript-cli.ts" />
@@ -398,6 +405,7 @@
398
405
  /// <reference path="services/project-templates-service.ts" />
399
406
  /// <reference path="services/qr-code-terminal-service.ts" />
400
407
  /// <reference path="services/require-service.ts" />
408
+ /// <reference path="services/start-service.ts" />
401
409
  /// <reference path="services/temp-service.ts" />
402
410
  /// <reference path="services/terminal-spinner-service.ts" />
403
411
  /// <reference path="services/test-execution-service.ts" />
package/lib/bootstrap.js CHANGED
@@ -194,3 +194,7 @@ yok_1.injector.require("markingModeService", "./services/marking-mode-service");
194
194
  yok_1.injector.require("metadataFilteringService", "./services/metadata-filtering-service");
195
195
  yok_1.injector.require("tempService", "./services/temp-service");
196
196
  yok_1.injector.require("sharedEventBus", "./shared-event-bus");
197
+ yok_1.injector.require("keyCommandHelper", "./helpers/key-command-helper");
198
+ yok_1.injector.requireCommand("start", "./commands/start");
199
+ yok_1.injector.require("startService", "./services/start-service");
200
+ require("./key-commands/bootstrap");
package/lib/color.js CHANGED
@@ -1,5 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.color = void 0;
3
+ exports.color = exports.stripColors = void 0;
4
+ const ansi = require("ansi-colors");
4
5
  const chalk = require("chalk");
6
+ function stripColors(formatStr) {
7
+ return ansi.stripColor(formatStr);
8
+ }
9
+ exports.stripColors = stripColors;
5
10
  exports.color = chalk;
@@ -17,7 +17,6 @@ const os = require("os");
17
17
  const path_1 = require("path");
18
18
  const promises_1 = require("fs/promises");
19
19
  const helpers_1 = require("../common/helpers");
20
- const CLIPath = (0, path_1.resolve)(__dirname, "..", "..", "bin", "nativescript.js");
21
20
  function bytesToHumanReadable(bytes) {
22
21
  const units = ["B", "KB", "MB", "GB", "TB"];
23
22
  let unit = 0;
@@ -52,7 +51,7 @@ function promiseMap(values, mapper, concurrency = 10) {
52
51
  });
53
52
  }
54
53
  class CleanCommand {
55
- constructor($projectCleanupService, $projectConfigService, $terminalSpinnerService, $projectService, $prompter, $logger, $options, $childProcess) {
54
+ constructor($projectCleanupService, $projectConfigService, $terminalSpinnerService, $projectService, $prompter, $logger, $options, $childProcess, $staticConfig) {
56
55
  this.$projectCleanupService = $projectCleanupService;
57
56
  this.$projectConfigService = $projectConfigService;
58
57
  this.$terminalSpinnerService = $terminalSpinnerService;
@@ -61,6 +60,7 @@ class CleanCommand {
61
60
  this.$logger = $logger;
62
61
  this.$options = $options;
63
62
  this.$childProcess = $childProcess;
63
+ this.$staticConfig = $staticConfig;
64
64
  this.allowedParameters = [];
65
65
  }
66
66
  execute(args) {
@@ -136,7 +136,7 @@ class CleanCommand {
136
136
  const projects = new Map();
137
137
  yield promiseMap(paths, (p) => {
138
138
  return this.$childProcess
139
- .exec(`node ${CLIPath} clean --dry-run --json --disable-analytics`, {
139
+ .exec(`node ${this.$staticConfig.cliBinPath} clean --dry-run --json --disable-analytics`, {
140
140
  cwd: p,
141
141
  })
142
142
  .then((res) => {
@@ -190,7 +190,7 @@ class CleanCommand {
190
190
  const currentPath = pathsToClean[i];
191
191
  spinner.start(`Cleaning ${color_1.color.cyan(currentPath)}... ${i + 1}/${pathsToClean.length}`);
192
192
  const ok = yield this.$childProcess
193
- .exec(`node ${CLIPath} clean ${this.$options.dryRun ? "--dry-run" : ""} --json --disable-analytics`, {
193
+ .exec(`node ${this.$staticConfig.cliBinPath} clean ${this.$options.dryRun ? "--dry-run" : ""} --json --disable-analytics`, {
194
194
  cwd: currentPath,
195
195
  })
196
196
  .then((res) => {
@@ -17,12 +17,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.RunVisionOSCommand = exports.RunAndroidCommand = exports.RunIosCommand = exports.RunCommandBase = void 0;
19
19
  const constants_1 = require("../common/constants");
20
- const constants_2 = require("../constants");
21
20
  const decorators_1 = require("../common/decorators");
22
21
  const helpers_1 = require("../common/helpers");
23
22
  const yok_1 = require("../common/yok");
23
+ const constants_2 = require("../constants");
24
24
  class RunCommandBase {
25
- constructor($devicePlatformsConstants, $errors, $hostInfo, $liveSyncCommandHelper, $migrateController, $options, $projectData) {
25
+ constructor($devicePlatformsConstants, $errors, $hostInfo, $liveSyncCommandHelper, $migrateController, $options, $projectData, $keyCommandHelper) {
26
26
  this.$devicePlatformsConstants = $devicePlatformsConstants;
27
27
  this.$errors = $errors;
28
28
  this.$hostInfo = $hostInfo;
@@ -30,12 +30,16 @@ class RunCommandBase {
30
30
  this.$migrateController = $migrateController;
31
31
  this.$options = $options;
32
32
  this.$projectData = $projectData;
33
+ this.$keyCommandHelper = $keyCommandHelper;
33
34
  this.liveSyncCommandHelperAdditionalOptions = {};
34
35
  this.allowedParameters = [];
35
36
  }
36
37
  execute(args) {
37
38
  return __awaiter(this, void 0, void 0, function* () {
38
- return this.$liveSyncCommandHelper.executeCommandLiveSync(this.platform, this.liveSyncCommandHelperAdditionalOptions);
39
+ yield this.$liveSyncCommandHelper.executeCommandLiveSync(this.platform, this.liveSyncCommandHelperAdditionalOptions);
40
+ if (process.env.NS_IS_INTERACTIVE) {
41
+ this.$keyCommandHelper.attachKeyCommands(this.platform, "run");
42
+ }
39
43
  });
40
44
  }
41
45
  canExecute(args) {
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.StartCommand = void 0;
13
+ const header_1 = require("../common/header");
14
+ const yok_1 = require("../common/yok");
15
+ class StartCommand {
16
+ constructor($startService) {
17
+ this.$startService = $startService;
18
+ }
19
+ execute(args) {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ (0, header_1.printHeader)();
22
+ this.$startService.start();
23
+ return;
24
+ });
25
+ }
26
+ canExecute(args) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ return true;
29
+ });
30
+ }
31
+ }
32
+ exports.StartCommand = StartCommand;
33
+ yok_1.injector.registerCommand("start", StartCommand);
@@ -13,7 +13,7 @@ exports.TypingsCommand = void 0;
13
13
  const yok_1 = require("../common/yok");
14
14
  const path = require("path");
15
15
  class TypingsCommand {
16
- constructor($logger, $options, $fs, $projectData, $mobileHelper, $childProcess, $hostInfo) {
16
+ constructor($logger, $options, $fs, $projectData, $mobileHelper, $childProcess, $hostInfo, $staticConfig) {
17
17
  this.$logger = $logger;
18
18
  this.$options = $options;
19
19
  this.$fs = $fs;
@@ -21,6 +21,7 @@ class TypingsCommand {
21
21
  this.$mobileHelper = $mobileHelper;
22
22
  this.$childProcess = $childProcess;
23
23
  this.$hostInfo = $hostInfo;
24
+ this.$staticConfig = $staticConfig;
24
25
  this.allowedParameters = [];
25
26
  }
26
27
  execute(args) {
@@ -95,8 +96,7 @@ class TypingsCommand {
95
96
  this.$logger.warn("--filter flag is not supported yet.");
96
97
  }
97
98
  this.$fs.ensureDirectoryExists(path.resolve(this.$projectData.projectDir, "typings", "ios"));
98
- const nsPath = path.resolve(__dirname, "../../bin/nativescript.js");
99
- yield this.$childProcess.spawnFromEvent("node", [nsPath, "build", "ios"], "exit", {
99
+ yield this.$childProcess.spawnFromEvent("node", [this.$staticConfig.cliBinPath, "build", "ios"], "exit", {
100
100
  env: Object.assign(Object.assign({}, process.env), { TNS_TYPESCRIPT_DECLARATIONS_PATH: path.resolve(this.$projectData.projectDir, "typings", "ios") }),
101
101
  stdio: "inherit",
102
102
  });
@@ -10,6 +10,7 @@ declare module Config {
10
10
  TRACK_FEATURE_USAGE_SETTING_NAME: string;
11
11
  ERROR_REPORT_SETTING_NAME: string;
12
12
  version: string;
13
+ cliBinPath: string;
13
14
  getAdbFilePath(): Promise<string>;
14
15
  disableAnalytics?: boolean;
15
16
  disableCommandHooks?: boolean;
@@ -0,0 +1,61 @@
1
+ export type IKeyCommandPlatform = "Android" | "iOS" | "all";
2
+ export type IKeysLowerCase =
3
+ | "a"
4
+ | "b"
5
+ | "c"
6
+ | "d"
7
+ | "e"
8
+ | "f"
9
+ | "g"
10
+ | "h"
11
+ | "i"
12
+ | "j"
13
+ | "k"
14
+ | "l"
15
+ | "m"
16
+ | "n"
17
+ | "o"
18
+ | "p"
19
+ | "q"
20
+ | "r"
21
+ | "s"
22
+ | "t"
23
+ | "u"
24
+ | "v"
25
+ | "w"
26
+ | "x"
27
+ | "y"
28
+ | "z";
29
+
30
+ export type IKeysUpperCase = Uppercase<IKeysLowerCase>;
31
+
32
+ export const enum SpecialKeys {
33
+ CtrlC = "\u0003",
34
+ QuestionMark = "?",
35
+ }
36
+
37
+ export type IKeysSpecial = `${SpecialKeys}`;
38
+
39
+ export type IValidKeyName = IKeysLowerCase | IKeysUpperCase | IKeysSpecial;
40
+
41
+ export interface IKeyCommandHelper {
42
+ attachKeyCommands: (
43
+ platform: IKeyCommandPlatform,
44
+ processType: SupportedProcessType
45
+ ) => void;
46
+
47
+ addOverride(key: IValidKeyName, execute: () => Promise<boolean>);
48
+ removeOverride(key: IValidKeyName);
49
+ printCommands(platform: IKeyCommandPlatform): void;
50
+ }
51
+
52
+ export type SupportedProcessType = "start" | "run";
53
+
54
+ export interface IKeyCommand {
55
+ key: IValidKeyName;
56
+ platform: IKeyCommandPlatform;
57
+ description: string;
58
+ willBlockKeyCommandExecution?: boolean;
59
+ execute(platform: string): Promise<void>;
60
+ canExecute?: (processType: SupportedProcessType) => boolean;
61
+ }
@@ -1,5 +1,6 @@
1
1
  import { IDisposable, IDictionary } from "../declarations";
2
2
  import { ICommand } from "./commands";
3
+ import { IKeyCommand, IValidKeyName } from "./key-commands";
3
4
 
4
5
  interface IInjector extends IDisposable {
5
6
  require(name: string, file: string): void;
@@ -8,6 +9,7 @@ interface IInjector extends IDisposable {
8
9
  requirePublicClass(names: string | string[], file: string): void;
9
10
  requireCommand(name: string, file: string): void;
10
11
  requireCommand(names: string[], file: string): void;
12
+ requireKeyCommand(name: IValidKeyName, file: string): void;
11
13
  /**
12
14
  * Resolves an implementation by constructor function.
13
15
  * The injector will create new instances for every call.
@@ -22,10 +24,13 @@ interface IInjector extends IDisposable {
22
24
  resolve<T>(name: string, ctorArguments?: IDictionary<any>): T;
23
25
 
24
26
  resolveCommand(name: string): ICommand;
27
+ resolveKeyCommand(key: string): IKeyCommand;
25
28
  register(name: string, resolver: any, shared?: boolean): void;
26
29
  registerCommand(name: string, resolver: any): void;
27
30
  registerCommand(names: string[], resolver: any): void;
31
+ registerKeyCommand(key: IValidKeyName, resolver: any): void;
28
32
  getRegisteredCommandsNames(includeDev: boolean): string[];
33
+ getRegisteredKeyCommandsNames(): string[];
29
34
  dynamicCallRegex: RegExp;
30
35
  dynamicCall(call: string, args?: any[]): Promise<any>;
31
36
  isDefaultCommand(commandName: string): boolean;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.printHeader = void 0;
4
+ const color_1 = require("../color");
5
+ const yok_1 = require("./yok");
6
+ function printHeader() {
7
+ if (process.env.HIDE_HEADER)
8
+ return;
9
+ const $staticConfig = yok_1.injector.resolve("$staticConfig");
10
+ const version = $staticConfig.version;
11
+ const header = [
12
+ color_1.color.dim("│ "),
13
+ color_1.color.cyanBright.bold("{N} NativeScript "),
14
+ color_1.color.whiteBright.bold("CLI"),
15
+ color_1.color.dim(` [v${version}] `),
16
+ ].join("");
17
+ const tagLine = [
18
+ color_1.color.dim("│ "),
19
+ color_1.color.dim(" → "),
20
+ color_1.color.whiteBright.bold("Empower JavaScript with native APIs "),
21
+ ].join("");
22
+ const headerLength = (0, color_1.stripColors)(header).length;
23
+ const tagLineLength = (0, color_1.stripColors)(tagLine).length;
24
+ const width = Math.max(headerLength, tagLineLength);
25
+ console.info(" " + color_1.color.dim("┌" + "─".repeat(width - 1) + "┐"));
26
+ console.info(" " + header + " ".repeat(width - headerLength) + color_1.color.dim("│"));
27
+ console.info(" " + tagLine + " ".repeat(width - tagLineLength) + color_1.color.dim("│"));
28
+ console.info(" " + color_1.color.dim("└" + "─".repeat(width - 1) + "┘"));
29
+ }
30
+ exports.printHeader = printHeader;
@@ -16,19 +16,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
16
16
  };
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.DevicesService = void 0;
19
- const util = require("util");
20
- const helpers = require("../../helpers");
21
19
  const assert = require("assert");
20
+ const events_1 = require("events");
22
21
  const _ = require("lodash");
22
+ const os_1 = require("os");
23
+ const util = require("util");
24
+ const constants_1 = require("../../../constants");
23
25
  const constants = require("../../constants");
26
+ const constants_2 = require("../../constants");
24
27
  const decorators_1 = require("../../decorators");
28
+ const helpers = require("../../helpers");
25
29
  const helpers_1 = require("../../helpers");
26
- const events_1 = require("events");
27
- const os_1 = require("os");
28
- const constants_1 = require("../../constants");
29
- const helpers_2 = require("../../helpers");
30
- const constants_2 = require("../../../constants");
31
- const decorators_2 = require("../../decorators");
32
30
  const yok_1 = require("../../yok");
33
31
  class DevicesService extends events_1.EventEmitter {
34
32
  constructor($logger, $errors, $iOSSimulatorDiscovery, $iOSDeviceDiscovery, $androidDeviceDiscovery, $staticConfig, $messages, $mobileHelper, $deviceLogProvider, $hostInfo, $injector, $options, $androidProcessService, $iOSEmulatorServices, $androidEmulatorServices, $androidEmulatorDiscovery, $emulatorHelper, $prompter, $devicePlatformsConstants) {
@@ -68,13 +66,13 @@ class DevicesService extends events_1.EventEmitter {
68
66
  pickSingleDevice(options) {
69
67
  return __awaiter(this, void 0, void 0, function* () {
70
68
  if (options.onlyDevices && options.onlyEmulators) {
71
- this.$errors.fail(constants_2.DebugCommandErrors.UNABLE_TO_USE_FOR_DEVICE_AND_EMULATOR);
69
+ this.$errors.fail(constants_1.DebugCommandErrors.UNABLE_TO_USE_FOR_DEVICE_AND_EMULATOR);
72
70
  }
73
71
  if (options.deviceId) {
74
72
  const device = yield this.getDevice(options.deviceId);
75
73
  return device;
76
74
  }
77
- const availableDevicesAndEmulators = this.getDeviceInstances().filter((d) => d.deviceInfo.status === constants_1.CONNECTED_STATUS &&
75
+ const availableDevicesAndEmulators = this.getDeviceInstances().filter((d) => d.deviceInfo.status === constants_2.CONNECTED_STATUS &&
78
76
  (!this.platform ||
79
77
  d.deviceInfo.platform.toLowerCase() === this.platform.toLowerCase()));
80
78
  const selectedDevices = availableDevicesAndEmulators.filter((d) => options.onlyEmulators
@@ -83,7 +81,7 @@ class DevicesService extends events_1.EventEmitter {
83
81
  ? !d.isEmulator
84
82
  : true);
85
83
  if (selectedDevices.length > 1) {
86
- if ((0, helpers_2.isInteractive)()) {
84
+ if ((0, helpers_1.isInteractive)()) {
87
85
  const choices = selectedDevices.map((e) => `${e.deviceInfo.identifier} - ${e.deviceInfo.displayName}`);
88
86
  const selectedDeviceString = yield this.$prompter.promptForChoice("Select device for debugging", choices);
89
87
  const selectedDevice = _.find(selectedDevices, (d) => `${d.deviceInfo.identifier} - ${d.deviceInfo.displayName}` ===
@@ -114,7 +112,7 @@ class DevicesService extends events_1.EventEmitter {
114
112
  else if (selectedDevices.length === 1) {
115
113
  return _.head(selectedDevices);
116
114
  }
117
- this.$errors.fail(constants_2.DebugCommandErrors.NO_DEVICES_EMULATORS_FOUND_FOR_OPTIONS);
115
+ this.$errors.fail(constants_1.DebugCommandErrors.NO_DEVICES_EMULATORS_FOUND_FOR_OPTIONS);
118
116
  });
119
117
  }
120
118
  getEmulatorImages(options) {
@@ -802,7 +800,7 @@ class DevicesService extends events_1.EventEmitter {
802
800
  DevicesService.DEVICE_LOOKING_INTERVAL = 200;
803
801
  DevicesService.EMULATOR_IMAGES_DETECTION_INTERVAL = 60 * 1000;
804
802
  __decorate([
805
- (0, decorators_2.performanceLog)()
803
+ (0, decorators_1.performanceLog)()
806
804
  ], DevicesService.prototype, "pickSingleDevice", null);
807
805
  __decorate([
808
806
  (0, decorators_1.exported)("devicesService")