Comments (9)
@ctrlplusb It's pretty easy getting yalc to working sustainably for a monorepo.
For example I have a postinstall script setup:
"scripts": {
"postinstall": "yarn workspaces foreach exec yalc publish --push",
},
Then you yalc add
in the projects you need it in and commit the yalc.lock file and ignore the .yalc folder.
Now whenever you make a change in a sibling package you would yarn
to propagate the change.
from yalc.
@wclr workspace symlinks/hoisting aren't great because often times multiple versions of a library can't coexist together. For example I have a monorepo package that has React as a dev dependency but Yarn workspace will symlink along the node_modules folder too when I use the package elsewhere and that causes all kinds of problems.
from yalc.
In most cases I commit yalced packages into git. So, I use yalc as a way to install some "permanent" stuff in (usually monorepo) projects, the stuff that is managed by me, that is in dev mode and not published for a shared consumption.
from yalc.
Ah I see, so the .yalc
folders that are local to each package, along with their yalc.lock
files will be committed to git? I guess I could live with that yeah.
So it would be something like this right;
my-mono-repo
|- .git
|
|- apps
| |
| |- @my/mobile-app
| |- .yalc
| | |- @my/components
| |- src
| |- package.json
| |- yalc.lock
|
|- packages
| |
| |- @my/components
| |- src
| |- package.json
|
|- package.json
What about rehydrating a user's global yalc store? Say another team member does a fresh checkout. They would need to rehydrate the store right and somehow rebuild the installation tree so that they can do subsequent yalc push'es. Do you have a workflow around this too?
I feel like I almost want the yalc store to be local to the monorepo root, but then I am apprehensive to commit that to git too. 😅
from yalc.
Ah I see, so the .yalc folders that are local to each package, along with their yalc.lock files will be committed to git?
I prefer a single .yalc
folder for a project.
What about rehydrating a user's global yalc store? Say another team member does a fresh checkout.
I don't think that yalc plays nicely with team's workflows.
I'm not sure what you are trying to accopmlish. For using packages across a monorepo I use workspaces
feature. Yalc is for installing external stuff.
from yalc.
For using packages across a monorepo I use workspaces feature. Yalc is for installing external stuff.
Yeah, I'm explicitly trying to avoid workspaces. I don't want to leverage hoisting. My goal is to try to enable monorepo style development whilst utilising yalc to manage the dependencies between the packages of the monorepo.
from yalc.
@wclr - I'm riffing on some ideas for a complementary CLI on top of yours, which is specific to my usecase. The readme describes this theoretical package;
https://github.com/ctrlplusb/yalcd
What do you think? Any concerns or objections?
Readme driven development ™️
from yalc.
Yeah, I'm explicitly trying to avoid workspaces. I don't want to leverage hoisting.
What is the real problem with workspaces/hoisting? I usually use PNPM for managing monorepos.
from yalc.
Although issue is resolved, i would just like to add to @robgraeber comment. I'm dealing with same issue - devDependencies. This is really painful in yarn workspaces. Ideally, yes, you would sync dependencies, however that is not feasible in big monorepos that may contain multiple packages and projects.
from yalc.
Related Issues (20)
- package version dependent? HOT 1
- yalc link across 2 monorepos not working HOT 2
- Resolve dependencies of a package with a specific value
- Import statements not resolving when using `yalc link`
- Importing `axios` is not executed crrectly
- Invalid "file:.yalc/<package name>" from the root project HOT 1
- Support push to remote and pull from local
- [Bug] I need to re-add the dependency every time it updates after I re-push it HOT 1
- Yalc add shows "Could not find package" HOT 1
- [BUG] yalc add does not include the same files as npm pack & publish HOT 1
- Allow specifying store-folder as an environment variable.
- How to render yalc add dynamically HOT 1
- How do you use `yalc` and `npm`/`yarn` in the same package?
- "yalc" is not recognized (Windows + Yarn) HOT 1
- It doesn't work..
- [Bug] Yalc broken after Node 20 HOT 1
- Yalc doesn't work in a vite project HOT 6
- yalc publish - ~/.yalc/packages/my-package is missing most of its files HOT 4
- Unclear Error Message When package.json Lacks version Key
- yalc publish removes nested node_modules HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yalc.