mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-10 18:18:56 -04:00
fix: prefer headless install when lockfile is up-to-date (#3422)
Prefer headless install, when the lockfile is up-to-date and some packages are linked using relative path via `workspace:<path>`.
This commit is contained in:
5
.changeset/smooth-bags-shave.md
Normal file
5
.changeset/smooth-bags-shave.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"supi": patch
|
||||
---
|
||||
|
||||
Prefer headless install, when the lockfile is up-to-date and some packages are linked using relative path via `workspace:<path>`.
|
||||
@@ -83,7 +83,8 @@ async function linkedPackagesAreUpToDate (
|
||||
isLinked &&
|
||||
(
|
||||
currentSpec.startsWith('link:') ||
|
||||
currentSpec.startsWith('file:')
|
||||
currentSpec.startsWith('file:') ||
|
||||
currentSpec.startsWith('workspace:.')
|
||||
)
|
||||
) {
|
||||
continue
|
||||
|
||||
@@ -13,6 +13,44 @@ const workspacePackages = {
|
||||
},
|
||||
}
|
||||
|
||||
test('allProjectsAreUpToDate(): works with packages linked through the workspace protocol using relative path', async () => {
|
||||
expect(await allProjectsAreUpToDate([
|
||||
{
|
||||
id: 'bar',
|
||||
manifest: {
|
||||
dependencies: {
|
||||
foo: 'workspace:../foo',
|
||||
},
|
||||
},
|
||||
rootDir: 'bar',
|
||||
},
|
||||
{
|
||||
id: 'foo',
|
||||
manifest: fooManifest,
|
||||
rootDir: 'foo',
|
||||
},
|
||||
], {
|
||||
linkWorkspacePackages: true,
|
||||
wantedLockfile: {
|
||||
importers: {
|
||||
bar: {
|
||||
dependencies: {
|
||||
foo: 'link:../foo',
|
||||
},
|
||||
specifiers: {
|
||||
foo: 'workspace:../foo',
|
||||
},
|
||||
},
|
||||
foo: {
|
||||
specifiers: {},
|
||||
},
|
||||
},
|
||||
lockfileVersion: 5,
|
||||
},
|
||||
workspacePackages,
|
||||
})).toBeTruthy()
|
||||
})
|
||||
|
||||
test('allProjectsAreUpToDate(): works with aliased local dependencies', async () => {
|
||||
expect(await allProjectsAreUpToDate([
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user