yarnpkg / berry

📦🐈 Active development trunk for Yarn ⚒
https://yarnpkg.com
BSD 2-Clause "Simplified" License
7.46k stars 1.12k forks source link

Prevents a workspace from depending on itself #6572

Open ReDrUm opened 1 month ago

ReDrUm commented 1 month ago

What's the problem this PR addresses?

Within a monorepo I've encountered a few package.json files that erroneously depend on themselves. Obviously an accident. This seems like an easy thing for the automatic package.json sanitization to cleanup, alongside the other checks it performs.

...

How did you fix it?

Updated the manifest to delete self referencing dependencies to the existing package name. When Workspace.persistManifest is called the package.json will be rewritten to remove them.

Similar to #421, except this will cleanup files that were manually added (rather than via yarn add), and handle cleaning up preexisting matches.

...

Checklist