Help with yalc link/push
windbridges opened this issue · comments
Hi. I've run into the following problem. Suppose I have a local my-package
and a local my-app
application that uses it. my-package
is connected to my-app
using yalc link my-package
on the local machine, but my-app
also has the line "my-package":"^0.1.0"
in the dependencies in package.json
for the non-local environment.
When I do a yalc push
in my-package
, the source code is updated perfectly in my-app
. But if I add a new package to my-package
(npm i third-party-package
), it does not appear in my-app
in node_modules
. And I don't know what command to run to update my-package
dependencies inside my-app
.
It would seem to run npm install
inside my-app
, but then the symlink to the local package is overwritten, and my-package
is installed from a remote repository.
Can anyone suggest how to solve this problem?
yalc link
is quite limited in this sense (e.g., when you need to introduce new dependencies), besides it works a bit differently with npm and yarn for example (IIRC yarn doesn't replace remove linked dir without --force
flag).
I would propose while development to use yalk add
it will update package.json dependency, and then you can use yalc revert
to restore original package dependency.
As an alternative, I found a solution - I repeat npm i third-party-package
in the context of my-app
and then remove the new line added to package.json
. But then I have to do yalc link my-package
again, because the symbolic link is lost.
Thanks for the tip, but I'd like to avoid modifying package.json
as much as possible. I just thought maybe I missed something and there is some command for that.
I don't see yalc revert
...