moiva icon indicating copy to clipboard operation
moiva copied to clipboard

NPM: 'cordova' turns up 'cordova-plugin-device'

Open redbar0n opened this issue 5 years ago • 4 comments

BUG on npm search:

Trying to add 'cordova' https://www.npmjs.com/package/cordova

Instead turns up 'cordova-plugin-device' https://www.npmjs.com/package/cordova-plugin-device

Also, adding 'cordova-cli' from the Github search doesn't link it up to its npm counterpart 'cordova' on Moiva, even though they are linked in reality:

https://www.npmjs.com/package/cordova links to https://github.com/apache/cordova-cli

redbar0n avatar Apr 02 '21 10:04 redbar0n

I proxy results of the official npm search API. I also noticed its limitations in the past and not being able to find certain packages. I was already in contact with npm team on this matter, but don't remember how exactly it was settled. Will probably raise the issue again In the meantime, I suggest specify package names directly in the URL https://moiva.io/?npm=cordova I'm thinking of adding such hint in the search results

aantipov avatar Apr 02 '21 20:04 aantipov

Also, adding 'cordova-cli' from the Github search doesn't link it up to its npm counterpart 'cordova' on Moiva, even though they are linked in reality:

it's not that easy. When you search for an npm package, then getting a corresponding GitHub repo is straightforward you get it from the npm API (though there are some cases when the provided GitHub repo is not the correct one). In other direction it doesn't work that way - you can't unambiguously derive the npm package from a GitHub repo, because

  1. a repo can be a source of many npm packages
  2. a repo can define root npm package.json as private and have a public npm package in some other folder
  3. I saw some popular repos publishing their npm packages in a totally separate repositories

The only reliable solution I came up with was to maintain a catalog where I specify all the relationships between npm and github https://github.com/aantipov/moiva-catalog

Long story short,

  • I try my best and maintain a catalog of popular libraries to make Moiva smart and show npm stats when a user uses GitHub search
  • If you want to see npm stats and you know the name of a package, then use npm search

aantipov avatar Apr 02 '21 21:04 aantipov

Thanks for the good explanations!

  1. Great, thanks for the workaround!

  2. Ah, ofc. Makes sense! Maybe the catalog could be automatically updated by users manually linking when coming across such scenarios?

redbar0n avatar Apr 02 '21 22:04 redbar0n

Maybe the catalog could be automatically updated by users manually linking when coming across such scenarios?

Interesting idea. I'll think about it

aantipov avatar Apr 03 '21 19:04 aantipov