wclr / yalc

Work with yarn/npm packages locally like a boss.
MIT License
5.64k stars 147 forks source link

bin symlink goes to .yalc instead of node_modules copy #156

Open jasonkuhrt opened 3 years ago

jasonkuhrt commented 3 years ago

I'm working on a package that has a generated aspect.

It has a CLI to run the generation.

When generation runs, the package expects to find itself within node_modules.

The problem is that the node_modules/.bin file symlinks (it seems) to the .yalc location, rather than the node_modules/... location.

In turn this breaks my current case since the generated library parts are going into the wrong directory now:

image

In the above .yalc should be node_modules.

wclr commented 3 years ago

Sorry, I'm not following. Try to explain the steps you make to get the issue, or maybe there could be a repro example.

jasonkuhrt commented 3 years ago
  1. Create a package A with a bin specified in package.json
  2. yalc add A in some other project B
  3. yalc push A
  4. A gets put into B like normal, but its bin script is symlinked into B/.yalc/A/... it should be pointing toward B/node_modules/A.
wclr commented 3 years ago

Right. There seems not need bin sysmlinks are created while add operation. Will fix it soon.

jasonkuhrt commented 3 years ago

Also @wclr I am seeing issues with regard to needing to run chmod +x over the bin file. Maybe related to https://github.com/wclr/yalc/issues/21. I assume package managers do this chmod +x automatically and its just that yalc is not right now?

wclr commented 3 years ago

I am seeing issues with regard to needing to run chmod +x over the bin file.

What bin file? Where it is located?

Actually, I'm a little bit confused with this thing with .bin scripts, which was added but a contributor's PR. I generally never use linking and never run into those issue, cause I generally use --pure adding. I believe linking of bin script from .yalc folder need only if yalc link or yalc add --link (yarn's link: protocol), if just yalc add is used then PM should take care of installing bin scripts.

jasonkuhrt commented 3 years ago

I used yalc push --force and yalc add.

What bin file? Where it is located?

In the package where run yalc push --force. The script is listed in package.json bin field. Location should not matter. Whatever the value of bin in package.json is.

wclr commented 3 years ago

Location should not matter. Whatever the value of bin in package.json is.

I mean is it related to this code?

Do you have the stack trace?

jasonkuhrt commented 3 years ago

I mean is it related to this code?

Yep seems it would be!

devinrhode2 commented 2 years ago

I've found in this situation where you are exclusively working on some ./node_modules/.bin/{foo,bar}, npm link (6/7/?) works better than yalc.

One reason I say this is that I found yalc was not installing dependencies from the external library/npm package. I think with npm link it's irrelevant. Your libraries deps are not mixed into your primary projects node_modules.