diff --git a/lib/in/create-package-summary.js b/lib/in/create-package-summary.js index bd449659..de21cbda 100644 --- a/lib/in/create-package-summary.js +++ b/lib/in/create-package-summary.js @@ -57,7 +57,14 @@ function createPackageSummary(moduleName, currentState) { .then(fromRegistry => { const installedVersion = modulePackageJson.version; - const latest = installedVersion && fromRegistry.latest && fromRegistry.next && semver.gt(installedVersion, fromRegistry.latest) ? fromRegistry.next : fromRegistry.latest; + let latest = fromRegistry.latest; + if (semver.gt(installedVersion, fromRegistry.latest)) { + Object.entries(fromRegistry.tags).map(([tag, version]) => { + if (semver.gt(version, installedVersion)) { + latest = version; + } + }); + } const versions = fromRegistry.versions || []; const versionWanted = semver.maxSatisfying(versions, packageJsonVersion); diff --git a/lib/in/get-latest-from-registry.js b/lib/in/get-latest-from-registry.js index 795d6a4c..1da85dab 100644 --- a/lib/in/get-latest-from-registry.js +++ b/lib/in/get-latest-from-registry.js @@ -19,13 +19,13 @@ function getNpmInfo(packageName) { .valueOf(); const latest = rawData['dist-tags'].latest; - const next = rawData['dist-tags'].next; + const tags = rawData['dist-tags']; const latestStableRelease = semver.satisfies(latest, '*') ? latest : semver.maxSatisfying(sortedVersions, '*'); return { latest: latestStableRelease, - next: next, + tags: tags, versions: sortedVersions, homepage: bestGuessHomepage(rawData) }; diff --git a/lib/out/interactive-update.js b/lib/out/interactive-update.js index 71174d22..a1b5e1b5 100644 --- a/lib/out/interactive-update.js +++ b/lib/out/interactive-update.js @@ -32,6 +32,10 @@ const UI_GROUPS = [ { title: `${chalk.magenta.underline.bold('Non-Semver')} ${chalk.magenta('Versions less than 1.0.0, caution.')}`, filter: {bump: 'nonSemver'} + }, + { + title: `${chalk.magenta.underline.bold('Prerelease')} ${chalk.magenta('Unstable version, caution.')}`, + filter: {bump: 'prerelease'} } ];