yalc icon indicating copy to clipboard operation
yalc copied to clipboard

yalc link uses absolute path in sym link, reducing flexibility

Open Aaronius opened this issue 5 years ago • 4 comments

I notice when I run yalc add @adobe/reactor-turbine and npm install, the sym link within node_modules is a relative path:

12944872285 lrwxr-xr-x    1 aahardy  staff    34B Jun  4 14:03 reactor-turbine -> ../../.yalc/@adobe/reactor-turbine

but when I instead run yalc link @adobe/reactor-turbine, the sym link is an absolute path:

12944870865 lrwxr-xr-x    1 aahardy  staff    63B Jun  4 13:49 reactor-turbine -> /Users/aahardy/dev/reactor/furnace/.yalc/@adobe/reactor-turbine

In my case, the furnace directory is mounted within a docker container. Furnace is a node app. When I use yalc link on my host machine and then try to run the node app within the Docker container, the node process fails, because Docker can't follow the sym link to /Users/aahardy/dev/reactor/furnace/.yalc/@adobe/reactor-turbine because it sees /Users/aahardy/dev/reactor/ as outside of the mounted volume.

However, when I use yalk add on my host machine and then try to run the node app within the Docker container, the node process succeeds, because Docker can follow the sym link to ../../.yalc/@adobe/reactor-turbine just fine.

I would love it if yalc link used a relative path for the sym link, so that I don't have to use yalk add.

Aaronius avatar Jun 04 '20 20:06 Aaronius

I'm having this same issue, wonder if you found a way around it

cabreraalex avatar Nov 03 '23 22:11 cabreraalex

I agree that the ability to use relative paths with yalc link would be beneficial. While it would not have to be the default, perhaps adding an optional flag to link subcommand would be beneficial?

kendallroth avatar Jan 03 '24 19:01 kendallroth

While it would not have to be the default, perhaps adding an optional flag to link subcommand would be beneficial?

Maybe I dont' use yalc link at all, prefer yalc add.

wclr avatar Jan 05 '24 04:01 wclr

For those who prefer not having the additional file/link changes to package.json though, might using relative paths for yalc link be a potential positive change? There doesn't seem to be any downsides (could be missing something), but certainly is an upside in allowing support for the originally listed issue (ie. path differences between host/Docker) 🤷.

kendallroth avatar Feb 13 '24 14:02 kendallroth