mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-28 20:11:48 -04:00
fix: keep existing deps during named install with no shrinkwrap
ref pnpm/pnpm#1029
This commit is contained in:
@@ -18,6 +18,7 @@ import {PackageJson} from '@pnpm/types'
|
||||
import normalizePath = require('normalize-path')
|
||||
import removeAllExceptOuterLinks = require('remove-all-except-outer-links')
|
||||
import logger from '@pnpm/logger'
|
||||
import R = require('ramda')
|
||||
import checkCompatibility from './checkCompatibility'
|
||||
import {packageJsonLogger} from '../loggers'
|
||||
|
||||
@@ -83,12 +84,13 @@ export default async function getContext (
|
||||
readCurrentShrinkwrap(root, shrOpts),
|
||||
mkdirp(storePath),
|
||||
])
|
||||
const currentShrinkwrap = files[2] || createShrinkwrap(opts.registry)
|
||||
const ctx: PnpmContext = {
|
||||
pkg: files[0],
|
||||
root,
|
||||
storePath,
|
||||
wantedShrinkwrap: files[1] || createShrinkwrap(opts.registry),
|
||||
currentShrinkwrap: files[2] || createShrinkwrap(opts.registry),
|
||||
wantedShrinkwrap: files[1] || !opts.shrinkwrap && currentShrinkwrap && R.clone(currentShrinkwrap) || createShrinkwrap(opts.registry),
|
||||
currentShrinkwrap,
|
||||
existsWantedShrinkwrap: !!files[1],
|
||||
existsCurrentShrinkwrap: !!files[2],
|
||||
skipped: new Set(modules && modules.skipped || []),
|
||||
|
||||
@@ -824,3 +824,13 @@ test('fail when installing with shrinkwrap: false and shrinkwrapOnly: true', asy
|
||||
t.equal(err.message, 'Cannot generate a shrinkwrap.yaml because shrinkwrap is set to false')
|
||||
}
|
||||
})
|
||||
|
||||
test("don't remove packages during named install when shrinkwrap: false", async (t: tape.Test) => {
|
||||
const project = prepare(t)
|
||||
|
||||
await installPkgs(['is-positive'], await testDefaults({shrinkwrap: false}))
|
||||
await installPkgs(['is-negative'], await testDefaults({shrinkwrap: false}))
|
||||
|
||||
await project.has('is-positive')
|
||||
await project.has('is-negative')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user