yalc icon indicating copy to clipboard operation
yalc copied to clipboard

bin symlink goes to .yalc instead of node_modules copy

Open jasonkuhrt opened this issue 4 years ago • 9 comments

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.

jasonkuhrt avatar Feb 25 '21 19:02 jasonkuhrt

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

wclr avatar Feb 26 '21 09:02 wclr

  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.

jasonkuhrt avatar Feb 26 '21 11:02 jasonkuhrt

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

wclr avatar Feb 26 '21 15:02 wclr

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?

jasonkuhrt avatar Feb 26 '21 16:02 jasonkuhrt

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.

wclr avatar Feb 26 '21 19:02 wclr

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.

jasonkuhrt avatar Feb 26 '21 19:02 jasonkuhrt

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?

wclr avatar Feb 26 '21 19:02 wclr

I mean is it related to this code?

Yep seems it would be!

jasonkuhrt avatar Mar 03 '21 03:03 jasonkuhrt

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.

devinrhode2 avatar Oct 11 '21 20:10 devinrhode2