Skip to content

Commit

Permalink
fix: install --lockfile-only should exit early
Browse files Browse the repository at this point in the history
ref #4910
  • Loading branch information
zkochan committed Jun 25, 2022
1 parent f48d46e commit 487527d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/metal-wasps-impress.md
@@ -0,0 +1,6 @@
---
"@pnpm/core": patch
"pnpm": patch
---

Return early when the lockfile is up-to-date.
4 changes: 3 additions & 1 deletion packages/core/src/install/index.ts
Expand Up @@ -265,7 +265,6 @@ export async function mutateModules (
opts.frozenLockfileIfExists && ctx.existsWantedLockfile
if (
!ctx.lockfileHadConflicts &&
!opts.lockfileOnly &&
!opts.update &&
!opts.fixLockfile &&
installsOnly &&
Expand All @@ -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`)
Expand Down

0 comments on commit 487527d

Please sign in to comment.