fix: install --lockfile-only should exit early (#4932)

ref #4910
This commit is contained in:
Zoltan Kochan
2022-06-25 15:21:13 +03:00
committed by GitHub
parent f48d46ef6f
commit 12aa1e2e19
2 changed files with 9 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/core": patch
"pnpm": patch
---
Return early when the lockfile is up-to-date.

View File

@@ -265,7 +265,6 @@ export async function mutateModules (
opts.frozenLockfileIfExists && ctx.existsWantedLockfile
if (
!ctx.lockfileHadConflicts &&
!opts.lockfileOnly &&
!opts.update &&
!opts.fixLockfile &&
installsOnly &&
@@ -289,6 +288,9 @@ export async function mutateModules (
hint: 'Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile"',
})
}
if (opts.lockfileOnly) {
return projects
}
if (!ctx.existsWantedLockfile) {
if (ctx.projects.some((project) => pkgHasDependencies(project.manifest))) {
throw new Error(`Headless installation requires a ${WANTED_LOCKFILE} file`)