Replies: 6 comments 30 replies
-
I understand that it is a big issue. I was thinking about it a lot and I think the only reliable solution would be to not commit the lockfile and to use some storage to upload/fetch it. We can use the specs from package.json files to create a key. And with that key we can read the lockfile from a cache. But I am not sure how would we then update the lockfile? And if we update it, will it update for all environments? Seems nondeterministic. Maybe there are other solutions to get rid of the lockfile. But I don't think it is possible to change the format of the lockfile in such a way that conflicts will forever be eliminated. cc @pnpm/collaborators |
Beta Was this translation helpful? Give feedback.
-
We see this occasionally in Rollup and with private repos that resemble the size the OP is speaking of. Whenever we get a conflict we just run |
Beta Was this translation helpful? Give feedback.
-
How often does this happen due to dependencies that are expected to be at a consistent version across all packages in a monorepo? Edit 2022-03-26: The idea below has been formalized more thoroughly at #4483 Elaborating on my team specificallyWe're a little over 700 packages in the monorepo. On my team, I'd estimate about 20% of pull requests hit The large frontend monorepo my team works on supports a backend product split into several microservices each exposing their own TypeScript API. Whenever these backend services release a new version, the pull request updating to the new version ripples through and forces a rebase on every PR making a dependency change line-adjacent to it. We're using GitHub Enterprise, so custom merge drivers aren't available. Here's where we're doing something that may be unique. The Here's a shortened example of our lockfile. overrides:
'@backend/service-a': 1.0.0
'@backend/service-b': 1.0.0
projects:
packages/foo:
specifiers:
'@backend/service-a': *
'@backend/service-b': *
react: ^17.0.0
dependencies:
'@backend/service-a': 1.0.0
'@backend/service-b': 1.0.0
react: 17.0.1 Backend developers are constantly adding new functionality, and frontend developers are updating their dependency declarations for the new API definitions. You can imagine the following changes merge conflicting with at least one other change in the list:
My ProposalPerhaps consistent dependencies across a monorepo could be a first-class pnpm feature. This would be a huge effort, but it would eliminate every merge conflict scenario listed above. I would only consider this if we think many pnpm projects would benefit from this, not just the one I work on. Here's what it would look like: The root {
"name": "some-monorepo",
"pnpm": {
"workspaceConsistent": {
"@backend/service-a": "1.0.0",
"@backend/service-b": "1.0.0",
"react": "17.0.1"
}
}
} Projects within the monorepo would use a new protocol. {
"name": "foo",
"dependencies": {
"@backend/service-a": "workspace-consistent",
"@backend/service-b": "workspace-consistent",
"react": "workspace-consistent"
}
} The # Spaces after each line are intentional to help git auto merge version changes.
'workspace-consistent':
'@backend/service-a': 1.0.0
'@backend/service-b': 1.0.0
react: 17.0.1
projects:
packages/foo:
specifiers:
'@backend/service-a': 'workspace-consistent'
'@backend/service-b': 'workspace-consistent'
react: 'workspace-consistent'
dependencies:
'@backend/service-a': 'workspace-consistent'
'@backend/service-b': 'workspace-consistent'
react: 'workspace-consistent' The caveats are:
Here's why I think every frontend project would benefit from this, not just my team.
I'd happily volunteer my weekends to work on this if others would find it valuable. I really adore pnpm. ❤️ Questions
|
Beta Was this translation helpful? Give feedback.
-
I think I'm also seeing some value in the "lockfile assembly" mentioned? If each entry in the I'm sure there's a performance cost of reading that many files from disk though. |
Beta Was this translation helpful? Give feedback.
-
This is the first thing that came to mind, something like "incremental lockfile". Instead of |
Beta Was this translation helpful? Give feedback.
-
In our team, we found the pnpm built-in conflict resolution not always work (sometimes failed to resolve and it looks like dropping the whole lockfile to create a new one). We suggest the following steps to resolve lockfile conflicts in our team:
This will force to use the baseline version of the lockfile and "pick" new packages from |
Beta Was this translation helpful? Give feedback.
-
Starting a discussion here based on #4322.
My organisation (13 teams, around 110+ monorepo modules and 160+ modules in another repo), are asking us to prioritize this, so I hope we can resolve this. I will direct them to this thread as well, but hope the rush community can pitch in as well.
Beta Was this translation helpful? Give feedback.
All reactions