fix(add): prefer version already installed in the workspace (#3616)

This commit is contained in:
Zoltan Kochan
2021-07-24 19:50:31 +03:00
committed by GitHub
parent 7aca5f17bf
commit 3c044519e3
3 changed files with 7 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
---
"supi": patch
---
When adding new dependency to a workspace, prefer versions that are already installed in the workspace.

View File

@@ -469,7 +469,6 @@ export async function mutateModules (
neverBuiltDependencies,
overrides,
pruneVirtualStore,
update: opts.update || !installsOnly,
updateLockfileMinorVersion: true,
})

View File

@@ -1311,6 +1311,6 @@ test('install the dependency that is already present in the workspace when addin
expect(currentLockfile.importers['project-1'].specifiers?.['dep-of-pkg-with-1-dep']).toBe('^100.0.0')
expect(currentLockfile.importers['project-2'].specifiers?.['dep-of-pkg-with-1-dep']).toBe('^100.0.0')
expect(currentLockfile.importers['project-1'].dependencies?.['dep-of-pkg-with-1-dep']).toBe('100.1.0')
expect(currentLockfile.importers['project-2'].dependencies?.['dep-of-pkg-with-1-dep']).toBe('100.1.0')
expect(currentLockfile.importers['project-1'].dependencies?.['dep-of-pkg-with-1-dep']).toBe('100.0.0')
expect(currentLockfile.importers['project-2'].dependencies?.['dep-of-pkg-with-1-dep']).toBe('100.0.0')
})