Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
redbar0n opened this issue Apr 2, 2021 · 4 comments
Open

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

redbar0n opened this issue Apr 2, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@redbar0n
Copy link

redbar0n commented Apr 2, 2021

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

@aantipov
Copy link
Owner

aantipov commented Apr 2, 2021

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 aantipov added the bug Something isn't working label Apr 2, 2021
@aantipov
Copy link
Owner

aantipov commented Apr 2, 2021

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

@redbar0n
Copy link
Author

redbar0n commented Apr 2, 2021

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?

@aantipov
Copy link
Owner

aantipov commented Apr 3, 2021

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

Interesting idea. I'll think about it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants