www.jsdelivr.com icon indicating copy to clipboard operation
www.jsdelivr.com copied to clipboard

Stats/index page for authors/organisations

Open lewisgoddard opened this issue 7 years ago • 9 comments

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

lewisgoddard avatar Oct 24 '17 15:10 lewisgoddard

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 avatar Oct 24 '17 15:10 MartinKolarik

@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')).

MartinKolarik avatar Dec 01 '17 18:12 MartinKolarik

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)

Haroenv avatar Dec 02 '17 13:12 Haroenv

@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).

MartinKolarik avatar Dec 02 '17 13:12 MartinKolarik

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

Haroenv avatar Dec 02 '17 14:12 Haroenv

Ok, thanks!

MartinKolarik avatar Dec 02 '17 14:12 MartinKolarik

@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 ?

MartinKolarik avatar Nov 20 '19 20:11 MartinKolarik

Yeah first one sounds much cleaner and better

jimaek avatar Nov 21 '19 11:11 jimaek

I'd love to see this as well ❤️

franciscop avatar Jan 13 '20 05:01 franciscop