node-rsync icon indicating copy to clipboard operation
node-rsync copied to clipboard

Modernize the rsync project

Open jhundley9109 opened this issue 4 years ago • 1 comments

This a fairly large rewrite of the project, mostly done by boneskull (https://github.com/boneskull/rsync) to move Rsync from an object to a more modern class based layout. However, I found the changes over there addressed a few of the open issues on this project and I fixed up a few other small issues and bugs with boneskull's changes. Additionally, I've updated all the npm dependencies to the latest versions and ran the semistandard code standards across the project.

Open issues addressed in these changes include: #69 #66 #61 #58 (Though this one was already solved and actually is set via the executable() function or as a parameter to new Rsync()) and #47

The API has changed in two major ways with these changes: 1: flags() has now become .setFlags() and .unsetFlags(). 2: the .execute() function parameters and return have changed. It always returns a Promise now however, there is no way to return the original spawn process to the caller now. I'm not 100% sure it is necessary to have the ability to pass it up, but if it is that could be worked around as boneskull had it before I was in there mucking about. If this is necessary functionality, I'd be curious to look into how other projects have solved this without a kludgy use of callbacks. Perhaps that's the only real way to solve it...

My main objective with this pull request is to get feedback on the changes. If this project is abandoned perhaps I should submit a new npm rsync2 module or better yet I can just be a contributor on this project if any maintainers/admins are still active and create a version 2 release with these changes. Please let me know your thoughts.

I am using my forked version of boneskull's fork for my jsyncd project over here (https://github.com/jhundley9109/jsyncd).

jhundley9109 avatar Aug 17 '21 20:08 jhundley9109

I have improved the .set() function to also accept an array of arrays for long options. As it stands now, each long option has to be set via rsync.set('no-perms') rsync.set('no-group') rsync.set('chmod', 'Dg+s')

This does not work with the Rsync.build() command (which just so happens to be the way I want to use the library)

So now you can do something like this rsync.set([['no-perms'], ['no-group'], ['chmod', 'Dg+s']) or Rsync.build( set: [['no-perms'], ['no-group'], ['chmod', 'Dg+s']], etc... )

This change would be backwards compatible.

jhundley9109 avatar Sep 28 '21 19:09 jhundley9109