yalc icon indicating copy to clipboard operation
yalc copied to clipboard

how to use yalc remotely with rsync

Open dkebler opened this issue 4 years ago • 2 comments

Just need some input/clarification on how to use yalc in my use case.

which is

I have an extensive library of packages/modules I use nodemon -x '\''yalc push'\'' in any library package I may be working on. that keeps ~/.yalc up to date as I work on the package Then in an app which depends on that package I use yalc link

That all works great...as expected. As I make changes to the library package the app using it gets the update and restarts with nodemon. Within my dev machine it works great.

Now I need to develop on a remote machine that has uses hardware dependent packages in my library (so I can't run it on my dev machine). I need to edit all code running there and the dependencies on my dev machine and sync it there. I've been doing that with rscync and inotifywait in a script I wrote, syncd. That works but it's kludgey to set up then I had a better idea... use yalc!

So I syncd ~/.yalc from dev machine to remote (except installation.json) Then in my app on remote machine (also syncd' from dev machine) I run yalc link. It all seems ok. yalc creates a link to .yalc in root of app. But then as the remote copy of ~/.yalc is updated the .yalc folder in the root of the app(remote) is not updated as it is when I run this all on the dev machine.

If I understood better the fine points of what yalc is doing maybe I can figure out what why it is not working.

What I don't understand is why yalc link creates another .yalc folder in the root of the app and grabs a copy from ~/.yalc and links the node_modules package to that and not directly to the one in ~/.yalc Given that, how is yalc supposed to know to go grab the changes in ~/.yalc and copy them to .yalc in root of app???? This is not what I expected yalc link` to do

dkebler avatar Mar 18 '20 17:03 dkebler

I am thinking that yalc push actually does the work of pushing from ~/.yalc to .yalc local. It does that by checking the installations.json file and pushes to any local packages listed there. Since my nodemon/yalc push is not running on the remote machine that would explain why this is not working remotely.

Looks like yalc update will manually pull from ~./yalc. I suppose I could set up a nodemon on the remote ~/.yalc folder and run the yalc update on that.

So I have then an enhancement proposal. Add a flag to yalc link --direct which will bypass the local .yalc and link directly to copy in ~/.yalc It would only be really needed for this use case.

My plug is that there are more and more sbc's out there with gpio busses and code that is hardware dependent and we can't be editing code and their dependencies on all these machines directly.

I'll take a shot a PR

dkebler avatar Mar 18 '20 17:03 dkebler

In the meantime I came up with this hammer. Need an extra terminal/process running on the remote with npm run yalcu

that will pull to local whenever remote ~/.yalc is changed

scripts in package.json

    "yalcu":"./node_modules/.bin/nodemon --watch /home/<user>/.yalc/**/*.js --exec <your global npm path>/bin/yalc update",

dkebler avatar Mar 18 '20 18:03 dkebler