Skip to content

Commit

Permalink
fix: yarn getPeerDependencies doesnt work on private reporsitories wh… (
Browse files Browse the repository at this point in the history
  • Loading branch information
rbnayax authored Oct 27, 2024
1 parent ce38291 commit bc6d1e4
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/lib/getIgnoredUpgradesDueToPeerDeps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { intersects, satisfies } from 'semver'
import { intersects, minVersion, satisfies, validRange } from 'semver'
import { IgnoredUpgradeDueToPeerDeps } from '../types/IgnoredUpgradeDueToPeerDeps'
import { Index } from '../types/IndexType'
import { Options } from '../types/Options'
Expand All @@ -24,7 +24,19 @@ export async function getIgnoredUpgradesDueToPeerDeps(
peerDependencies: undefined,
loglevel: 'silent',
})
const upgradedPeerDependenciesLatest = await getPeerDependenciesFromRegistry(upgradedLatestVersions, options)
const upgradedPeerDependenciesLatest = await getPeerDependenciesFromRegistry(
Object.fromEntries(
Object.entries(upgradedLatestVersions).map(([packageName, versionSpec]) => {
return [
packageName,
// git urls and other non-semver versions are ignored.
// Make sure versionSpec is a valid semver range, otherwise minVersion will throw.
validRange(versionSpec) ? (minVersion(versionSpec)?.version ?? versionSpec) : versionSpec,
]
}),
),
options,
)
return Object.entries(upgradedLatestVersions)
.filter(([pkgName, newVersion]) => upgraded[pkgName] !== newVersion)
.reduce((accum, [pkgName, newVersion]) => {
Expand Down

0 comments on commit bc6d1e4

Please sign in to comment.