New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rush] PNPM Overrides with more advanced syntax will cause Rush to always complain that shrinkwrap file need to be updated #4675
Comments
There's a TODO in the code just above where you linked to consider using rushstack/libraries/rush-lib/src/logic/pnpm/PnpmShrinkwrapFile.ts Lines 1007 to 1009 in 0c41a82
The basis for this is that Enforcing the installed version dependency in workspace packages is the domain of |
I see... so this should throw an error I guess. At the moment, there's no "hint" of what went wrong and users will keep retrying to |
Hi @kenrick95
You are right. The initial implementation doesn't cover the advanced syntax, as it was a quick fix for the urgent issues in our company's monorepo. I just checked this requirement again to see whether I can quickly support it. However, It seems to me a little bit complicated to support the advance syntax. Technically,
Further, to make it 100% accurate, there are other configurations should be supported as well. Related pnpm code is |
We discussed this and I think arrived at two separate decisions:
Thus, the proposed common library for accurate package.json transforms is really only needed by These two actions are separate work items that can be implemented in any order. #2 is probably the quickest fix for #4675. |
Summary
Using PNPM Overrides feature with a more advanced syntax like
<pkg-name>@^<ver>
in the keys will causerush install
to always failRepro steps
At
common/config/rush/pnpm-config.json
, I have:At
meow/package.json
, I have:Then I run:
Expected result:
rush install
runs successfullyActual result:
rush install
failed with:Repo: https://github.com/kenrick95/rush-repro-pnpm-overrides
Details
I found that this code:
rushstack/libraries/rush-lib/src/logic/pnpm/PnpmShrinkwrapFile.ts
Line 948 in 0c41a82
only handle case where
importerPackageName
exist exactly in theoverrides
map.However, from PNPM Overrides docs, we can specify overrides like:
or
but it seems like it is not handled when it is first implemented in the PR: #4252 ( cc @chengcyber )
As for why pnpm overrides is used, for my case, it is from migrating from a repo that plainly uses PNPM Workspaces to Rush, so naturally we'll migrate those overrides config. For this case, the intention was to make sure everyone (whether projects within same workspace or external dependencies) are on the same react-router version without changing too many codes that isn't "owned" by the "platform-level" team.
Update 2024-05-06: I saw the TODO there and it actually makes sense to throw error too... So I'm not sure whether this should be fixed by adding override parsing, or fixed by throwing error when this case occurred.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
@microsoft/rush
globally installed version?rushVersion
from rush.json?useWorkspaces
from rush.json?node -v
)?The text was updated successfully, but these errors were encountered: