-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1) This PR refactors how we handle the `appRoot` to allow for changing it in runtime. To make sure that the app root is unified across all the components we now store it in `project.ts` and move all objects dependent on `appRoot` to project as well. We listen for launchConfiguration changes and restart everything dependent on appRoot after it changes. 2) We refactor how appRoot is detected: after analyzing the old approach that was using `workspace.findFiles` we realized that on more elaborate setups it took almost 2 seconds to traverse all of the workspace directories. To combat that we introduce a new `findAppRootCandidates` implementation that takes only a couple of ms in most setups. *note*: the new function is not perfectly equivalent to the old one as it removes a check if `node_modules` contains `react-native` it is done on purpose as it has a following drawbacks: - generetes false positives as some not applications directories (e.g. libries) might contain `react-native` in its node modules, - mono repositories might generate false positives at top level depending on the implementation - it requires searching through `node_modules` which are usually quite large - it is not even that useful, because it requires `node_modules` to be installed and first time users could encounter problems if we relied on this check. 3) Additionally we enhance the Lunch Configuration View to allow the user for selecting the appRoot from the list. ### How has dis been tested? - Run the mono repo with 2 application and switch between them. - Run `react-native-svg` repo and select test apps in it - Run `react-native-reanimated` repo and select test apps in it, additionally check if cashes are stored properly after switching between applications. - To benchmark the `findAppRootCandidates` I added the following code to at the end of the `activate` function in the extension: ```js const start = performance.now(); await findAppRootFolder() const end = performance.now() Logger.debug("My benchmark result:", end-start); ``` note: that the benchmark make sens only if you don't have appRoot set in launchConfiguration. Results for `react-native-reanimated` repository: | old | new | | -------- | ------- | | 1479.05 ms| 1.27 ms |
- Loading branch information
1 parent
12ed4f2
commit 9b4ab57
Showing
27 changed files
with
811 additions
and
396 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.