fix: pnpm update

Fixes a regression introduced by #2692

close #2750
This commit is contained in:
Zoltan Kochan
2020-08-05 02:12:02 +03:00
parent edf1f412e2
commit cbbbe7a43b
3 changed files with 11 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/plugin-commands-installation": patch
---
Fixes a regression introduced by <https://github.com/pnpm/pnpm/pull/2692>. `pnpm update` should update the direct dependencies of the project.

View File

@@ -235,7 +235,7 @@ async function update (
allowNew: false,
includeDirect,
update: true,
updateMatching: dependencies.every(dep => !dep.substring(1).includes('@')) && opts.depth && opts.depth > 0 && !opts.latest
updateMatching: dependencies.length && dependencies.every(dep => !dep.substring(1).includes('@')) && opts.depth && opts.depth > 0 && !opts.latest
? matcher(dependencies) : undefined,
updatePackageManifest: opts.save !== false,
}, dependencies)

View File

@@ -50,13 +50,17 @@ test('update --no-save', async function (t: tape.Test) {
})
test('update', async function (t: tape.Test) {
await addDistTag('foo', '100.1.0', 'latest')
await addDistTag('foo', '100.0.0', 'latest')
const project = prepare(t, {
dependencies: {
foo: '^100.0.0',
},
})
await execPnpm(['install', '--lockfile-only'])
await addDistTag('foo', '100.1.0', 'latest')
await execPnpm(['update'])
const lockfile = await project.readLockfile()