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:
Zoltan Kochan
2021-05-07 11:45:47 +03:00
committed by GitHub
parent 84654221fc
commit 0e69ad4403
3 changed files with 45 additions and 1 deletions

View 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>`.

View File

@@ -83,7 +83,8 @@ async function linkedPackagesAreUpToDate (
isLinked &&
(
currentSpec.startsWith('link:') ||
currentSpec.startsWith('file:')
currentSpec.startsWith('file:') ||
currentSpec.startsWith('workspace:.')
)
) {
continue

View File

@@ -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([
{