microsoft / rushstack

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

Refactor workspace peer dependencies declaration #4808

Closed g-chao closed 1 week ago

g-chao commented 1 week ago

Summary

This is PR involves an improvement when declare a workspace project as the peer dependency.

We don't need to declare a actual version number when using a workspace project as the peer dependency. Since when using workspace: protocol, PNPM will always using the symlink installation (or hardlink in injected installation case) for that project. Also, when publish projects that including workspace: protocol to NPM registry, PNPM will also replace it with actual version number. (Learn more: https://pnpm.io/workspaces#publishing-workspace-packages)

How it was tested

Manually tested with Monorepo locally. Also, run pnpm pack locally, to check that workspace: protocol can be replaced with a actual version number during publishing process.