mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-10 18:18:56 -04:00
fix: treat the linked dependency which version type is tag as update-to-date (#6791)
* fix(core): treat the linked dependency which version type is tag as update-to-date * docs: add changeset * chore: code style
This commit is contained in:
6
.changeset/three-seas-lick.md
Normal file
6
.changeset/three-seas-lick.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/core": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Treat the linked dependency which version type is tag as update-to-date [#6592](https://github.com/pnpm/pnpm/issues/6592)
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
import pEvery from 'p-every'
|
||||
import any from 'ramda/src/any'
|
||||
import semver from 'semver'
|
||||
import getVersionSelectorType from 'version-selector-type'
|
||||
|
||||
export async function allProjectsAreUpToDate (
|
||||
projects: Array<ProjectOptions & { id: string }>,
|
||||
@@ -111,6 +112,11 @@ async function linkedPackagesAreUpToDate (
|
||||
) {
|
||||
return true
|
||||
}
|
||||
// https://github.com/pnpm/pnpm/issues/6592
|
||||
// if the dependency is linked and the specified version type is tag, we consider it to be up-to-date to skip full resolution.
|
||||
if (isLinked && getVersionSelectorType(currentSpec)?.type === 'tag') {
|
||||
return true
|
||||
}
|
||||
const linkedDir = isLinked
|
||||
? path.join(project.dir, lockfileRef.slice(5))
|
||||
: workspacePackages?.[depName]?.[lockfileRef]?.dir
|
||||
|
||||
@@ -497,3 +497,51 @@ describe('local file dependency', () => {
|
||||
})).toBeFalsy()
|
||||
})
|
||||
})
|
||||
|
||||
test('allProjectsAreUpToDate(): returns true if workspace dependency\'s version type is tag', async () => {
|
||||
const projects = [
|
||||
{
|
||||
buildIndex: 0,
|
||||
id: 'bar',
|
||||
manifest: {
|
||||
dependencies: {
|
||||
foo: 'unpublished-tag',
|
||||
},
|
||||
},
|
||||
rootDir: 'bar',
|
||||
},
|
||||
{
|
||||
buildIndex: 0,
|
||||
id: 'foo',
|
||||
manifest: fooManifest,
|
||||
rootDir: 'foo',
|
||||
},
|
||||
]
|
||||
const options = {
|
||||
autoInstallPeers: false,
|
||||
excludeLinksFromLockfile: false,
|
||||
linkWorkspacePackages: true,
|
||||
wantedLockfile: {
|
||||
importers: {
|
||||
bar: {
|
||||
dependencies: {
|
||||
foo: 'link:../foo',
|
||||
},
|
||||
specifiers: {
|
||||
foo: 'unpublished-tag',
|
||||
},
|
||||
},
|
||||
foo: {
|
||||
specifiers: {},
|
||||
},
|
||||
},
|
||||
lockfileVersion: 5,
|
||||
} as Lockfile,
|
||||
workspacePackages,
|
||||
lockfileDir: process.cwd(),
|
||||
}
|
||||
expect(await allProjectsAreUpToDate(projects, {
|
||||
...options,
|
||||
lockfileDir: process.cwd(),
|
||||
})).toBeTruthy()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user