refactor: matchesSemver -> matches

This commit is contained in:
Rhys Arkins 2018-05-21 17:40:15 +02:00
parent 63f2669153
commit 7f8dd25a97
3 changed files with 6 additions and 11 deletions

View file

@ -8,7 +8,7 @@ const {
isStable, isStable,
isUnstable, isUnstable,
isPinnedVersion, isPinnedVersion,
matchesSemver, matches,
maxSatisfyingVersion, maxSatisfyingVersion,
minSatisfyingVersion, minSatisfyingVersion,
parseRange, parseRange,
@ -134,9 +134,7 @@ function determineUpgrades(npmDep, config) {
// Filter out older versions as we can't upgrade to those // Filter out older versions as we can't upgrade to those
.filter(version => isGreaterThan(version, fromVersion)) .filter(version => isGreaterThan(version, fromVersion))
// fillter out non-allowed versions if preference is set // fillter out non-allowed versions if preference is set
.reject( .reject(version => allowedVersions && !matches(version, allowedVersions))
version => allowedVersions && !matchesSemver(version, allowedVersions)
)
// Ignore unstable versions, unless the current version is unstable // Ignore unstable versions, unless the current version is unstable
.reject( .reject(
version => version =>

View file

@ -15,7 +15,7 @@ const {
minSatisfying: minSatisfyingVersion, minSatisfying: minSatisfyingVersion,
minor: getMinor, minor: getMinor,
patch: getPatch, patch: getPatch,
satisfies: matchesSemver, satisfies: matches,
valid: isPinnedVersion, valid: isPinnedVersion,
} = semver; } = semver;
@ -42,7 +42,7 @@ module.exports = {
isUnstable, isUnstable,
isValidSemver, isValidSemver,
isPinnedVersion, isPinnedVersion,
matchesSemver, matches,
maxSatisfyingVersion, maxSatisfyingVersion,
minSatisfyingVersion, minSatisfyingVersion,
parseRange, parseRange,

View file

@ -1,7 +1,4 @@
const { const { matches, isPinnedVersion } = require('../../../versioning/semver');
matchesSemver,
isPinnedVersion,
} = require('../../../versioning/semver');
const ghGot = require('../../../platform/github/gh-got-wrapper'); const ghGot = require('../../../platform/github/gh-got-wrapper');
module.exports = { module.exports = {
@ -96,7 +93,7 @@ async function getChangeLogJSON({
for (let i = 1; i < versions.length; i += 1) { for (let i = 1; i < versions.length; i += 1) {
const prev = versions[i - 1]; const prev = versions[i - 1];
const next = versions[i]; const next = versions[i];
if (matchesSemver(next.version, semverString)) { if (matches(next.version, semverString)) {
const release = { const release = {
version: next.version, version: next.version,
date: next.date, date: next.date,