Skip to content

Commit

Permalink
chore: fix last version when the list have more than 9 versions (#1845)
Browse files Browse the repository at this point in the history
  • Loading branch information
manolo authored Jun 24, 2021
1 parent b7090f1 commit fba76a3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/lib/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ async function getLatestNpmVersion(package, version, major, minor) {
if (!cachedNpmVersions[package]) {
cmd = `npm view ${package} versions --json`;
const json = await JSON.parse(await run(cmd))
const versions = json.filter(version => version.startsWith(`${major}.${minor}`));
const versions = json
.filter(version => version.startsWith(`${major}.${minor}`))
.map(a => a.replace(/\d+$/, n => +n+900000))
.sort()
.map(a => a.replace(/\d+$/, n => +n-900000));
const next = versions.pop();
console.log(`Checking next Npm version for ${package} ${version} ${next}`);
cachedNpmVersions[package] = next;
Expand Down

0 comments on commit fba76a3

Please sign in to comment.