Reputation: 168
I have a multirepo project. It has an "app" repository that has multiple dependencies. These other dependencies have dependencies themselves.
I would like to migrate from a multirepo to a monorepo setup and I saw that yarn workspaces offer the architecture I would like to achieve (a real world example that I found is the jest repository which defines workspaces in its package.json file)
The specific problem I encounter is that I haven't found a way to perform an incremental migration to workspaces.
e.g
// app repository package.json
"workspaces": [
"packages/*"
],
"dependencies": {
dependency-a: "workspace:packages/dependency-a"
dependency-b: 1.2.3
// ...other dependencies
}
Under the packages
folder I have migrated dependency-a
. Ideally, I want to see that dependency-a
no longer exists in the node_modules
and instead only exists under thepackages
folder.
The problem is the following:
dependency-a
is also an internal dependency of dependency-b
and dependency-b
is used in various other modules. I think I am supposed to migrate dependency-b
to a workspace as well, but since other modules link to it, it will continue to exist as a node module inside app
until I have migrated everything (that is: dependency-b
and all the modules that also list it).
Of course this creates a chain reaction. If migrating a module to a workspace means I also have to migrate its internal modules (that I wrote) to workspaces, there is no way to achieve an incremental migration, my only option is to migrate everything at once.
Am I understanding it correctly? Is there a resource / guide I can follow?
Upvotes: 0
Views: 104