ecosyste-ms / packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.
https://packages.ecosyste.ms
GNU Affero General Public License v3.0
21 stars 4 forks source link

Ability to filter dependencies vs devDependencies #796

Open benmccann opened 1 week ago

benmccann commented 1 week ago

I would love the ability to filter for dependants that show up in dependencies in package.json and exclude packages where it appears in devDependencies

andrew commented 1 week ago

Deploying a version of this now for testing, not sure how performant the counting of the kind filters will be just yet, might need to add some caching.

andrew commented 1 week ago

Example: https://packages.ecosyste.ms/registries/npmjs.org/packages/deep-equal/dependent_packages

andrew commented 1 week ago

Note that there may be some crossover between kinds (a package that shows up for multiple kinds) if different versions of the package use that dependency in different ways (runtime vs dev for example).

If filtering by latest (from https://github.com/ecosyste-ms/packages/issues/794) there shouldn't be any crossover as it's only considering one version per package.

andrew commented 1 week ago

I'm also going to add an API endpoint to be able to fetch a list of kinds and counts.

benmccann commented 1 week ago

OMG, thank you! This list is exactly what I've been looking for forever!!

https://packages.ecosyste.ms/registries/npmjs.org/packages/deep-equal/dependent_packages?latest=true&order=desc&sort=downloads

benmccann commented 1 week ago

There may be some issue still. If you click the link from my last comment fast-equals and deep-diff are listed, but when I look at the package.json for those packages I only see it in devDependencies

andrew commented 1 week ago

@benmccann the latest parameter isn't persisted right now when you click on the sidebar links, so the url for that view would be https://packages.ecosyste.ms/registries/npmjs.org/packages/deep-equal/dependent_packages?kind=runtime&latest=true

I'll make sure latest sticks around though those menu clicks when I add the UI toggle shortly.

andrew commented 1 week ago

Just deployed that now.

andrew commented 1 week ago

Also added a new dependent_package_kinds api endpoint: https://packages.ecosyste.ms/api/v1/registries/npmjs.org/packages/deep-equal/dependent_package_kinds

Which also accepts latest: https://packages.ecosyste.ms/api/v1/registries/npmjs.org/packages/deep-equal/dependent_package_kinds?latest=true

cc @voxpelli as you may find this and the kind filter parameter I just added to the dependent_packages api endpoint useful.