mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-18 05:42:27 -04:00
feat: remove shrinkwrap.yaml when no deps left in package.json
This commit is contained in:
@@ -148,7 +148,7 @@ async function installInContext (installType: string, packagesToInstall: Depende
|
||||
}
|
||||
}
|
||||
|
||||
if (pkgs && pkgs.length && newPkg) {
|
||||
if (newPkg) {
|
||||
ctx.shrinkwrap.dependencies = ctx.shrinkwrap.dependencies || {}
|
||||
|
||||
const deps = newPkg.dependencies || {}
|
||||
|
||||
@@ -85,6 +85,28 @@ test('shrinkwrap not created when no deps in package.json', async t => {
|
||||
t.ok(!await project.loadShrinkwrap(), 'shrinkwrap file not created')
|
||||
})
|
||||
|
||||
test('shrinkwrap removed when no deps in package.json', async t => {
|
||||
const project = prepare(t)
|
||||
|
||||
await writeYamlFile('shrinkwrap.yaml', {
|
||||
version: 1,
|
||||
dependencies: {
|
||||
'is-negative@2.1.0': 'localhost+4873/is-negative/2.1.0',
|
||||
},
|
||||
packages: {
|
||||
'localhost+4873/is-negative/2.1.0': {
|
||||
resolution: {
|
||||
tarball: 'http://localhost:4873/is-negative/-/is-negative-2.1.0.tgz',
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
await install(testDefaults())
|
||||
|
||||
t.ok(!await project.loadShrinkwrap(), 'shrinkwrap file removed')
|
||||
})
|
||||
|
||||
test('respects shrinkwrap.yaml for top dependencies', async t => {
|
||||
const project = prepare(t)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user