Question about using yalc with monorepo/workspaces and many apps

See original GitHub issue

Hi!

I have a monorepo with about 40 components, and I’m using yarn workspaces to deal with dependencies, my folder structure and yarn are like this:

// folder structure
packages/comp1
packages/comp1/packages.json
packages/comp2
packages/comp2/packages.json
packages/comp3
packages/comp3/packages.json

// packages.json
"workspaces":  [
    "packages/*"
],

Then I have a test application, in another directory. So to get everything working, I would link the componentes one by one running yarn link inside their folder. In the application, run yarn install and after that I used to link all the packages comp1, comp2, comp3 to the application using yarn link comp1. Finally when I’v run the application I could change the components and test them perfectly.

But with that process, I only had the package linked and not is dependencies, so if I go to comp1, and update one of they’r dependencies, the link will not find the new dependency.

After a little search I’v came across yalc, and tried to use it but without success. With this structure I have, how should I use yalc?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jchambcommented, Dec 27, 2019

@whitecolor like @lipedeitos said, I’m only using this for development purposes for a react library, that I is built with rollup before linking. In production yarn/yalc link are not used.

What you said is correct about the workspace packages, everything is being lifted up to the top level of the node_modules as you would expect with workspaces. What I was trying to point out (not very well) is that I expected yarn link and yalc link to work similarly after initial install, and create a symlink.

for example purposes if I do:

yarn link core creates symlink node_modules/core --> [LOCAL_PATH]/core yalc link core creates .yalc/core folder, DOES NOT create symlink node_modules/core --> ../.yalc/core

my work around for the above is to manually symlink my core folder to the .yalc folder. mv node_modules/core node_modules/core.bck && cd node_modules && ln -s ../.yalc/core ./core

Maybe yalc is behaving correctly, I was just basing all this off of what it does when not using workspaces. If this is case, please let me know and i’ll look for an alternative solution.

after @lipedeitos second explanation it sounds like we are actually having different issues, sorry I hijacked the thread, seemed like we were having the same issue originally.

1reaction
wclrcommented, Dec 22, 2019

The scenario os more clear now? If don’t ask me and I try to explain even more with examples.

What is yalc here for?

The problem is the application that is consuming those packages via YARN LINK are not getting this updates because the application still get the OLD package dependencies

You should update package dependencies in linked app.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Question about using yalc with monorepo/workspaces and ...
I have a monorepo with about 40 components, and I'm using yarn ... Question about using yalc with monorepo/workspaces and many apps #108....
Read more >
Yalc, the `npm link` alternative that "does" work - Divotion
The advantage of using npm link is that it uses a symbolic link to seamlessly integrate the Git repo of our library inside...
Read more >
Using local NPM packages as dependencies with yalc
yalc solves this problem by allowing you to publish your local dependencies to a local store and make them available for use in...
Read more >
How to make code changes show when using yalc
Your question is not so much clear. I would suggest to post all the code (or at least a short working piece); clearly...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found