diff --git a/src/lib/getPeerDependenciesFromRegistry.ts b/src/lib/getPeerDependenciesFromRegistry.ts index 96d89c8a..23bdd071 100644 --- a/src/lib/getPeerDependenciesFromRegistry.ts +++ b/src/lib/getPeerDependenciesFromRegistry.ts @@ -1,5 +1,4 @@ import ProgressBar from 'progress' -import nodeSemver from 'semver' import { Index } from '../types/IndexType' import { Options } from '../types/Options' import { Version } from '../types/Version' @@ -62,7 +61,7 @@ async function getPeerDependenciesFromRegistry(packageMap: Index, optio const peerDependencies: Index> = Object.entries(packageMap).reduce( async (accumPromise, [pkg, version]) => { - const dep = await packageManager.getPeerDependencies!(pkg, nodeSemver.coerce(version)?.version ?? version) + const dep = await packageManager.getPeerDependencies!(pkg, version) if (bar) { bar.tick() } diff --git a/src/lib/runLocal.ts b/src/lib/runLocal.ts index 134d71b9..d1ea876f 100644 --- a/src/lib/runLocal.ts +++ b/src/lib/runLocal.ts @@ -4,7 +4,7 @@ import get from 'lodash/get' import isEmpty from 'lodash/isEmpty' import pick from 'lodash/pick' import prompts from 'prompts-ncu' -import { satisfies } from 'semver' +import nodeSemver from 'semver' import { Index } from '../types/IndexType' import { Maybe } from '../types/Maybe' import { Options } from '../types/Options' @@ -183,7 +183,14 @@ async function runLocal( } if (options.peer) { - options.peerDependencies = await getPeerDependenciesFromRegistry(current, options) + options.peerDependencies = await getPeerDependenciesFromRegistry( + Object.fromEntries( + Object.entries(current).map(([packageName, versionSpec]) => { + return [packageName, nodeSemver.minVersion(versionSpec)?.version ?? versionSpec] + }), + ), + options, + ) } const [upgraded, latestResults, upgradedPeerDependencies] = await upgradePackageDefinitions(current, options) @@ -210,7 +217,9 @@ async function runLocal( // filter out satisfied deps when using --minimal const filteredUpgraded = options.minimal - ? keyValueBy(upgraded, (dep, version) => (!satisfies(latest[dep], current[dep]) ? { [dep]: version } : null)) + ? keyValueBy(upgraded, (dep, version) => + !nodeSemver.satisfies(latest[dep], current[dep]) ? { [dep]: version } : null, + ) : upgraded const ownersChangedDeps = (options.format || []).includes('ownerChanged')