jsdelivr / www.jsdelivr.com

The official jsDelivr website
https://www.jsdelivr.com
Open Software License 3.0
137 stars 62 forks source link

Stats/index page for authors/organisations #140

Open lewisgoddard opened 6 years ago

lewisgoddard commented 6 years ago

Similar to #86 showing stats for the whole CDN, I'd love a page that shows total requests in the last month for an author, all the packages they have and how popular each one is, that sort of thing.

I guess you'd have to split authors by NPM or GitHub though.

Package page: https://www.jsdelivr.com/package/gh/eustasy/colors.css Proposed author page: https://www.jsdelivr.com/author/gh/eustasy

MartinKolarik commented 6 years ago

This would be relatively easy to add for GitHub, not so easy for npm. Either way, I like this idea and we'll consider it for the next API version.

MartinKolarik commented 6 years ago

@Haroenv getting a list of packages by author name from npm is extremely slow so I'm wondering if it's possible to make a query like that using your index.

There's owners field which contains all package owners so the JS equivalent of what we need would be pkgs.filter(pkg => pkg.owners.find(owner => owner.name === 'thejameskyle')).

Haroenv commented 6 years ago
const packages = await index.search({
  filters: `owner.name:${'thejameskyle'}`,
  attributesToRetrieve: [`name`],
  attributesToHighlight: [],
});

That should do it @MartinKolarik

That's only using the "canonical author", not everyone in "owners" field though, for owners field I'd need to add it to attributesForFaceting in the index settings (doable if needed)

MartinKolarik commented 6 years ago

@Haroenv I knew about that but I need anyone in "owners", especially because "owner" sometimes points to GitHub (but even if it didn't, any in "owners" would still be better).

Haroenv commented 6 years ago

okay, for that to work, it needs to be added to attributesForFaceting, feel free to do a PR, and then will be owners.name in the filter

MartinKolarik commented 6 years ago

Ok, thanks!

MartinKolarik commented 4 years ago

@lewisgoddard looks like we might be finally able to do this. I'm currently considering two approaches:

  1. Make it only work for GitHub and npm packages hosted on GitHub and use GitHub user/org as package author. In this case, we could show both GitHub and npm projects on one page. E.g. /author/MartinKolarik would show all my repos and all npm packages pointing to my repos.

  2. For GitHub, use GitHub usernames, for npm packages, use the maintainers field - in this case, the package would show for all people that have publish rights for the package.

I'm thinking the first option makes more sense. @jimaek ?

jimaek commented 4 years ago

Yeah first one sounds much cleaner and better

franciscop commented 4 years ago

I'd love to see this as well ❤️