Skip to content

Provision to watch files in symlinked directories for livesync command #2221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
shripalsoni04 opened this issue Nov 14, 2016 · 1 comment
Closed
Assignees
Milestone

Comments

@shripalsoni04
Copy link

Currently, when we execute livesync command with --watch option, if our project's app directory contains any symlinked folder, its content is not getting watched. So even if we do any changes in any file of such symlinked folder, it will not be transferred to the device. Due to that we need to always execute tns livesync ios --watch after every change in such symlinked files. This is impacting the development experience for cross platform (web and mobile) apps.

I tried to find the root cause of the issue and I found that issue is at partialSync function of lib/services/livesync/livesync-service.js file.

Currently the code is as shown below:

LiveSyncService.prototype.partialSync = function (syncWorkingDirectory, onChangedActions) {
      var that = this;
      var gazeWatcher = gaze("**/*", { cwd: syncWorkingDirectory}, function(err, watcher) {
          ...
      });
    ...
}

Here, gaze package internally uses glob package and in documentation of glob package, it is mentioned that when globstar(**) pattern is used, it does not crawl symlinked directories.

If we want to make it crawl the symlinked directories, we need to pass follow:true option in gaze options as shown below:

LiveSyncService.prototype.partialSync = function (syncWorkingDirectory, onChangedActions) {
      var that = this;
      var gazeWatcher = gaze("**/*", { cwd: syncWorkingDirectory, follow: true}, function(err, watcher) {
          ...
      });
    ...
}

By passing follow:true, we can make the files of symlinked directories to be livesynced to device. This improves the development experience and speed of development of cross platform (web and mobile) apps by great amount.

It will be great if follow:true is set in options by default or if we can pass an option in CLI like
tns livesync ios --watch --follow to have symlinked files to be livesynced.

Let me know if there is already some solution for this issue or you want any other information.

Thanks.

@tzraikov tzraikov self-assigned this Nov 15, 2016
@tzraikov tzraikov added this to the 2.5.0 milestone Nov 15, 2016
@jlooper
Copy link

jlooper commented Nov 15, 2016

Looking forward to getting this one fixed up! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants