www.jsdelivr.com
www.jsdelivr.com copied to clipboard
Stats/index page for authors/organisations
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
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.
@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'))
.
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 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).
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
Ok, thanks!
@lewisgoddard looks like we might be finally able to do this. I'm currently considering two approaches:
-
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. -
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 ?
Yeah first one sounds much cleaner and better
I'd love to see this as well ❤️