You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Separate preparation of JS from native code (#2983)
* Separate preparation of JS from native code
* Introduce new parameter prepareNative to indicate that native code preparation is explicitly required.
* Cache additional data in .nsprepareinfo file:
* nativePlatformStatus - indicates whether native platform should be added, prepared or there's no need to do so;
* projectFileHash - saves package.json file's contents hash for the current platform. We use this for better heuristics for checking whether package.json is changed.
* Re-factoring i.e. extract common code to methods
* Fix debug command and unit tests
* Fix npm support tests
Fix the tests by modifying current logic:
- stop using ensurePrepareInfo for setting `nativePlatformStatus` property - introduce new method for setting it. The problem with using `ensurePrepareInfo` is that it saves the prepareInfo and calling checkForChanges after that is incorrect in case we modify the `bundle` option. Check test: `Ensures that tns_modules absent when bundling` - the last case was failing because when we call ensurePrepareInfo last time, bundle is false, we overwrite the prepareInfo in the file and checkForChanges says that bundle is currently false and has been false in the previous case.
- in case prepareInfo is missing, we should not call addPlatform again - the else in `ensurePlatformInstalled` is not correct in case we execute `tns platform add <platform>` and then try `tns run/build/prepare <platform>` - in this case we do not have prepareInfo, so we try adding platform again. However, due to current implementation, we are sure that when we do not have prepareInfo, we've called platform add from CLI, so the platform is already added correctly.
- fix a strange if inside `preparePlatformCoreNative` - we must prepare the node_modules in case `--bundle` is passed or the modulesChanged property of `changesInfo` is true.
* Fix tests requiring package.json at the root of the project
As projectChangesService now checks the package.json at the root of the project, several tests are failing as they are mocking the project creation and there's no package.json at the specified place.
Fix this by creating the package.json in the tests.
* Remove incorrect passing of skipNativePrepare
* Cache instances of "base" commands in debug and run
* Fix run android and run ios - set the platform correctly
* Fix run command
Fix run command by setting correct platform.
* Update common lib
* Fix PR comments
// Do not dispose ios-device-lib, so the process will remain alive and the debug application (NativeScript Inspector or Chrome DevTools) will be able to connect to the socket.
170
139
// In case we dispose ios-device-lib, the socket will be closed and the code will fail when the debug application tries to read/send data to device socket.
171
140
// That's why the `$ tns debug ios --justlaunch` command will not release the terminal.
172
141
// In case we do not set it to false, the dispose will be called once the command finishes its execution, which will prevent the debugging.
0 commit comments