microsoft / rushstack

Monorepo for tools developed by the Rush Stack community
https://rushstack.io/
Other
5.74k stars 587 forks source link

[rush] Fix an edge case for workspace peer dependencies when calculating packageJsonInjectedDependenciesHash to improve its accuracy #4809

Closed g-chao closed 1 week ago

g-chao commented 1 week ago

Summary

If you declare a workspace package in peerDependencies, though you put the version range there, PNPM does not respect it. Below is an example: peerDependencies section in @rushstack/heft-api-extractor-plugin project package.json

"peerDependencies": {
    "@rushstack/heft": "0.66.18"
  },

The actual pnpm-lock.yaml img_v3_02c8_154f1501-0d30-4138-a2ce-b5e78bf2775h

So, we don't need to take these packages into consideration when calculating packageJsonInjectedDependenciesHash.

How it was tested

Manually tested with Monorepo locally.