feat: add an identifier for pnpmSyncPrepare #34
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Support an optional parameter
lockfileId
when calling thepnpmSyncPrepareAsync
API.The purpose of this parameter is let
pnpm-sync
to recognize the entries in the.pnpm-config.json
file, so that thepnpm-sync
can update these entries correctly, also be able to remove invalid entiresDetails
When calling the
pnpmSyncPrepareAsync
API, how doespnpm-sync
know which entries need to be update in the.pnpm-config.json
? Especially in a large Monorepo with Rush subspace feature enabled where there could have tens ofpnpm-lock.yaml
files.Previously, when generating the
.pnpm-config.json
,pnpm-sync
read the existing entries, only append new unique entires there. This is to ensure the tool doesn't delete entries where could belong to otherpnpm-lock.yaml
. But, it has a drawback where, since it does not delete any entries, it is possible, in your local development, there could be some invalid entries in the.pnpm-config.json
due to frequentlypnpm-lock.yaml
changes. It might cause issue as time goes by, and when it happens, you will need to manually delete.pnpm-config.json
file ornode_modules
to regenerate them. It brings inconvenience.In this PR, we add a optional parameter
identifier
when calling thepnpmSyncPrepareAsync
API. So that, thepnpm-sync
could recognize thepnpm-lock.yaml
file it processed, then it able to delete the invalid entries in the.pnpm-config.json
to avoid unnecessary or invalid sync actions in the later steps.