feat: merge manifest resolutions and pnpm.overrides (#7174)

* feat: merge manifest `resolutions` and `pnpm.overrides`

As someone currently migrating from Yarn, I would find it extremely
helpful to be able to give Yarn and pnpm different override
instructions.

By merging these two, migration from Yarn is even easier, because you
can fix pnpm-specific overrides inside `pnpm.overrides` without
affecting the existing Yarn setup.

* style: make changeset just one line

* Update .changeset/twenty-walls-sit.md

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
Steven Petryk
2023-10-08 12:32:03 -07:00
committed by GitHub
parent 3ad2ec63eb
commit b1dd0ee58f
2 changed files with 10 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/config": patch
"pnpm": patch
---
Instead of `pnpm.overrides` replacing `resolutions`, the two are now merged. This is intended to make it easier to migrate from Yarn by allowing one to keep using `resolutions` for Yarn, but adding additional changes just for pnpm using `pnpm.overrides`.

View File

@@ -26,7 +26,10 @@ export function getOptionsFromRootManifest (manifestDir: string, manifest: Proje
// so we cannot call it resolutions
const overrides = mapValues(
createVersionReferencesReplacer(manifest),
manifest.pnpm?.overrides ?? manifest.resolutions ?? {}
{
...manifest.resolutions,
...manifest.pnpm?.overrides,
}
)
const neverBuiltDependencies = manifest.pnpm?.neverBuiltDependencies
const onlyBuiltDependencies = manifest.pnpm?.onlyBuiltDependencies