fix(node): use semver sort

This commit is contained in:
Rhys Arkins 2018-05-29 15:17:41 +02:00
parent 1da997dbe6
commit 5475e567d7

View file

@ -3,8 +3,9 @@ const {
getMinor,
isGreaterThan,
isPinnedVersion,
sortVersions,
} = require('../../../versioning/semver');
const { getRepoTags, sortVersions } = require('../../../datasource/github');
const { getRepoTags } = require('../../../datasource/github');
async function getPackageUpdates(config) {
logger.debug('getPackageUpdates()');
@ -28,8 +29,8 @@ async function getPackageUpdates(config) {
const newReleases = (await getRepoTags('nodejs/node'))
.map(release => release.replace(/^v/, ''))
.filter(release => getMajor(currentVersion) === getMajor(release))
.filter(release => isGreaterThan(release, currentVersion))
.sort(sortVersions);
.filter(release => isGreaterThan(release, currentVersion));
newReleases.sort(sortVersions);
// istanbul ignore if
if (endpoint) {
logger.debug('Restoring GHE token and endpoint');
@ -41,7 +42,7 @@ async function getPackageUpdates(config) {
} else {
return [];
}
const newVersion = newReleases.pop();
const newVersion = newReleases[newReleases.length - 1];
return [
{
type: getMajor(newVersion) > getMajor(currentVersion) ? 'major' : 'minor',