diff --git a/.changeset/spicy-dragons-fly.md b/.changeset/spicy-dragons-fly.md new file mode 100644 index 0000000000..e89da29a93 --- /dev/null +++ b/.changeset/spicy-dragons-fly.md @@ -0,0 +1,5 @@ +--- +"supi": patch +--- + +This fixes a regression introduced in pnpm v5.0.0. Direct local tarball dependencies should always be reanalized on install. diff --git a/packages/supi/src/install/index.ts b/packages/supi/src/install/index.ts index 8a8e65ffc2..9d221e37b5 100644 --- a/packages/supi/src/install/index.ts +++ b/packages/supi/src/install/index.ts @@ -851,9 +851,18 @@ async function toResolveImporter ( updateDepth: opts.defaultUpdateDepth, })) } else { + // Direct local tarballs are always checked, + // so their update depth should be at least 0 + const updateLocalTarballs = (dep: WantedDependency) => ({ + ...dep, + updateDepth: prefIsLocalTarball(dep.pref) ? 0 : -1, + }) wantedDependencies = [ - ...project.wantedDependencies.map((dep) => ({ ...dep, updateDepth: opts.defaultUpdateDepth })), - ...existingDeps.map((dep) => ({ ...dep, updateDepth: -1 })), + ...project.wantedDependencies.map( + opts.defaultUpdateDepth < 0 + ? updateLocalTarballs + : (dep) => ({ ...dep, updateDepth: opts.defaultUpdateDepth })), + ...existingDeps.map(updateLocalTarballs), ] } return { @@ -865,6 +874,10 @@ async function toResolveImporter ( } } +function prefIsLocalTarball (pref: string) { + return pref.startsWith('file:') && pref.endsWith('.tgz') +} + const limitLinking = pLimit(16) function linkBinsOfImporter ({ modulesDir, binsDir, rootDir }: ProjectToLink) { diff --git a/packages/supi/test/install/local.ts b/packages/supi/test/install/local.ts index e318d1e97a..f1ea0575eb 100644 --- a/packages/supi/test/install/local.ts +++ b/packages/supi/test/install/local.ts @@ -164,7 +164,7 @@ test('tarball local package from project directory', async (t: tape.Test) => { }, `a snapshot of the local dep tarball added to ${WANTED_LOCKFILE}`) }) -test.skip('update tarball local package when its integrity changes', async (t) => { +test('update tarball local package when its integrity changes', async (t) => { const project = prepareEmpty(t) await copyFixture('tar-pkg-with-dep-1/tar-pkg-with-dep-1.0.0.tgz', path.resolve('..', 'tar.tgz'))