From 487527dcffa66b352fda5f19568edf539a3ac3a4 Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Sat, 25 Jun 2022 04:04:54 +0300 Subject: [PATCH] fix: install --lockfile-only should exit early ref #4910 --- .changeset/metal-wasps-impress.md | 6 ++++++ packages/core/src/install/index.ts | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/metal-wasps-impress.md diff --git a/.changeset/metal-wasps-impress.md b/.changeset/metal-wasps-impress.md new file mode 100644 index 00000000000..6fec366c340 --- /dev/null +++ b/.changeset/metal-wasps-impress.md @@ -0,0 +1,6 @@ +--- +"@pnpm/core": patch +"pnpm": patch +--- + +Return early when the lockfile is up-to-date. diff --git a/packages/core/src/install/index.ts b/packages/core/src/install/index.ts index b2c1170e779..cdc9fb08f77 100644 --- a/packages/core/src/install/index.ts +++ b/packages/core/src/install/index.ts @@ -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`)