This repository was archived by the owner on Feb 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Cherry-pick commits for {N} CLI 3.3.1 release #1027
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Currently unit tests fail on Windows as the `type` command used in the tests is not a real executable - it is integrated in the `cmd`. So spawning `type` fails and the tests fail as well. In order to fix this, pass `shell` option to child process, so the child process will spawn CMD and after that type command will succeed.
In case iOS Device is detached, the `IOSDevice` instance is kept alive. The reason is the handler for device logs, that `IOSDevice` passes to `iOSDeviceOperations`. As `iOSDeviceOperations` is still alive, the `IOSDevice` instance is also alive. Reattaching the same device will cause duplicate logs. Detaching and attaching it again will lead to additional logs. In order to fix the issue, convert `iOSDeviceOpertations` to event emitter and emit event when there's data for logging. Each `IOSDevice` will add handler for the event and will do its logic. In case device is detached (i.e. `DeviceLost` event is fired in `DevicesService`), call a newly added method to the specific `IDevice` instance. It's purpose is to clean the used resource. For iOS device, this method will remove the handler for `devceLogData` event of `iOSDeviceOperations`.
In case any command fails, we execute help command in order to show the help content. This leads to multiple trackings, i.e. - user executes only one command, but in Analytics we see two commands. Instead of executing help command, introduce new method in htmlHelpService, that prints the help to the terminal and call it instead. Use the same method in the help command itself. Rename htmlHelpService to helpService - it has been incorrectly named from the beginning. Remove `helpTextPath` from staticConfig interface - this property is not used for more than 2 years. Introduce tests for `helpService` - get the tests from AppBuilder CLI.
As the injected dependency, class and interface have been renamed, rename the file as well.
Currently CLI's configuration directory is used from `$options.profileDir`. When user passes `--profileDir <path>`, the `$options.profileDir` value is populated. In case user does not pass anything, a default value is set. All services that require configuration directory use the `$options.profileDir`. However, this causes several issues: - `$options` is intended for use only when CLI is used as a standalone command line. In case you are using it as a library, the `$options` object will not be populated. - Unable to test local installations of extensions when CLI is used as library - there's no way to set the custom profileDir when using CLI as a library. So the extensions are always loaded from the default location. In order to resolve these issues, move the logic for profileDir in `settingsService` and introduce a new method to get the profileDir. In order to ensure code is backwards compatible (i.e. extensions that use `$options.profileDir` should still work), modify `$options` to set the value of `profileDir` in `settingsService`. Whenever you want to test local extensions you can use: ```JavaScript const tns = require("nativescript"); tns.settingsService.setSettings({ profileDir: "my custom dir" }); Promise.all(tns.extensibilityService.loadExtensions()) .then((result) => { console.log("Loaded extensions:", result); // write your code here }); ``` Replace all places where `$options.profileDir` is used with `$settingsService.getProfileDir()`.
In case user executes: - `tns help` - we should show the default index.html help with all commands - `tns --help` - we should show the default command line help generated from index.md file with all commands This has been broken during changing html-help-service to help-service. Fix the default behavior and add tests for it.
In case you need a hook to be executed outside of process, you should place correct shebang at the beginning of the file and CLI should spawn it. However, this is not working at the moment, as when CLI detects that the hook should be spawned, it just does nothing. The code is incorrectly placed inside the `if` for in process execution. This causes another issue - in case a hook returns a function, which returns falsey value, we decide the hook should be executed outside of process and spawn a new Node.js process to execute the hook. So we execute it twice. Fix the if-else logic, so the hooks will work correctly.
TsvetanMilanov
approved these changes
Nov 13, 2017
nadyaA
approved these changes
Nov 13, 2017
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry-picked in release: