Skip to content

Commit

Permalink
Fixed: #250 cannot install new npm versions
Browse files Browse the repository at this point in the history
The NPM project has started releasing utility libraries in
its releases feed. Instead of being named "v<version>",
they are named "<library>: v<version>". This unexpected
format causes an error like: "Invalid Version: libnpmversion-v3.0.1."
whenever you call "nodist npm add".

Solution:
Filter away the other packages when fetching the releases.
  • Loading branch information
OskiKervinen-MF committed Jan 13, 2023
1 parent 32ad8e5 commit 98a7761
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,15 @@ NPMIST.listAvailable = function(){
per_page: '100'
})
])
.then(([npm, cli]) => npm.concat(cli));
.then(([npm, cli]) => {
// The npm project has two kinds of releases: releases of npm,
// and releases of other utility libraries.
// Ignore the releases of libraries. They are named "package: version",
// while core npm releases are named just "version".
cli = cli.filter( release => release.name.indexOf(':') < 0 );

return npm.concat(cli);
});
};

/**
Expand Down

0 comments on commit 98a7761

Please sign in to comment.