fix: don't ignore the overrides field on partial install/update

This commit is contained in:
Zoltan Kochan
2020-10-31 14:12:19 +02:00
parent 23c735c00d
commit c4ec56eeb2
2 changed files with 11 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
---
"supi": patch
---
Don't ignore the "overrides" field when install/update doesn't include the root project.

View File

@@ -137,12 +137,15 @@ export async function mutateModules (
const installsOnly = projects.every((project) => project.mutation === 'install')
opts['forceNewModules'] = installsOnly
const ctx = await getContext(projects, opts)
const rootProject = ctx.projects.find(({ id }) => id === '.')
const rootProjectManifest = ctx.projects.find(({ id }) => id === '.')?.manifest ??
// When running install/update on a subset of projects, the root project might not be included,
// so reading its manifest explicitly hear.
await safeReadProjectManifestOnly(opts.lockfileDir)
// We read Yarn's resolutions field for compatibility
// but we really replace the version specs to any other version spec, not only to exact versions,
// so we cannot call it resolutions
const overrides = rootProject
? rootProject.manifest.pnpm?.overrides ?? rootProject.manifest.resolutions
const overrides = rootProjectManifest
? rootProjectManifest.pnpm?.overrides ?? rootProjectManifest.resolutions
: undefined
if (!R.isEmpty(overrides ?? {})) {
const versionsOverrider = createVersionsOverrider(overrides!)