mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-10 18:18:56 -04:00
fix(add): prefer version already installed in the workspace (#3616)
This commit is contained in:
5
.changeset/five-ghosts-check.md
Normal file
5
.changeset/five-ghosts-check.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"supi": patch
|
||||
---
|
||||
|
||||
When adding new dependency to a workspace, prefer versions that are already installed in the workspace.
|
||||
@@ -469,7 +469,6 @@ export async function mutateModules (
|
||||
neverBuiltDependencies,
|
||||
overrides,
|
||||
pruneVirtualStore,
|
||||
update: opts.update || !installsOnly,
|
||||
updateLockfileMinorVersion: true,
|
||||
})
|
||||
|
||||
|
||||
@@ -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')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user