yalc
yalc copied to clipboard
yalc remove does not remove yalc symlinks from packages
Removing one or more linked yalc packages with the yalc remove
command will not remove any yalc symlinks from the node_modules
directory. These packages will effectively be pointing to a directory that no longer exists, rendering them corrupt. The user will either need to manually reinstall these packages, run yarn install --check-files
or delete node_modules
& run yarn install
to fix. The latter two options will of course overwrite both linked and unlinked packages, so a yalc update
will be required to bring any active yalc symlinks back.
I believe the solution to this problem will be for yalc remove
to also reinstall the relevant packages according to their defined versions in package.json
. This could take the form of an additional argument, for example yalc remove <package> --reinstall-pkg
.
I'm not sure if there are different implications for npm users.
Ok, will check it.
@wclr Love this project so far, but wanted to touch base about this issue to see if you have a solution to yalc remove
to strip symlinks rather than yarn install --check-files
?
I suppose yalc remove
could/should just remove the symlinks leaving the user to yarn install
afterwards .. but it looks like yarn install --check-files
basically replaces the symlinks with the legit packages anyhow.
Not sure I get the problem and the use case.
@wclr yalc link
leaves me wondering, "ok after I'm done with local development, what now?".. expecting a yalc unlink
or yalc remove
or something similar to remove symlinks and cause whatever package is specified in package.json
to (re)install. A plain yarn install
didn't seem to overwrite the symlinks and left me in a position where the links were still there unexpectedly, whereas a yarn install --check-files
did replace the links with the actual node module specified in package.json
.
So, maybe I'm just too new to the utility to have understood that or I'm doing it wrong? 😄
Bottom line, yalc is awesome, thank you for it!
I don't tend to use yalc link
but yalc add
as it makes things more consistent, thus the workflow with yalc link
may be not well thought out.
To sum up yalc link
case: currently yalc remove
just removes "linked" package from .yalc and yalc.lock
and does nothing with a symlink in node_modules, and simple running after yarn
will not bring things back, though running yarn --check-files
will fix things.
So what is the proposal? Should yalc remove
run yarn --check-files
?
Yea I think yarn --check-files
would make sense for yalc remove
for the case I bumped into.
This is something we've found is also affecting us and our workflow. We use npm
and after yalc remove
the linked directory stays there. If we try to do an npm install
it will error because it's not sure what to do with that linked directory. So we have to blow away node_modules
and do a fresh install which takes a lot longer.
Could the npm
flow just remove the linked directory? npm uninstall/unlink
does that and has no concept of the --check-files
that yarn
does
Same problem when using yalc link
:
/Users/me/Sites/www/.yalc is not empty, not removing it
Not sure if yalc still under maintenance?
We are using yalc link
instead of yalc add
with npm
because yalc link
make the webpack hot reload works while yalc add
doesn't take effect. The pain is when revert the dev env, after yalc remove
, the symlink folder under node_modules
still exists, and now we have to manually remove it 'rm -rf'. npm has no command like yarn can do that.
I agree with @wclr that add
is better than link
on consistent part.
I think the fix should be straightforward:
-
yalc add --link
, oryalc link
to add the symlink. - Then
yalc add --unlink
, oryalc unlink
should remove the symlink. Pureadd
command should not be affected.
Changes should be arround here: remove.ts
any news?