2016-07-31 0:19 GMT+02:00 Ludovic Courtès <l...@gnu.org>: > Jelle Licht <jli...@fsfe.org> skribis: > > > On Jul 29, 2016 16:53, "Catonano" <caton...@gmail.com> wrote: > > [...] > > >> For example: which are the packages with less or no dependencies (and a > >> lot of dependants) ? > >> Because those should be imported first, in my opinion. > > [...] > > > ^ This, I like. Does anyone have any suggestions on tools that could help > > me do this in guile? > > I understand you want to perform these queries on NPM packages, not Guix > packages, but if you could hook your NPM package representation in (guix > graph)¹, you could do the same as this: > > --8<---------------cut here---------------start------------->8--- > scheme@(guile-user)> ,use(guix graph) > scheme@(guile-user)> ,use(guix scripts graph) > scheme@(guile-user)> ,use(gnu packages) > scheme@(guile-user)> ,use(guix monad-repl) > scheme@(guile-user)> ,enter-store-monad > store-monad@(guile-user) [1]> (node-back-edges %bag-node-type > (fold-packages cons '())) > $4 = #<procedure 59ac880 at guix/graph.scm:87:17 (node)> > store-monad@(guile-user) [1]> ,q > scheme@(guile-user)> ,use(srfi srfi-1) > scheme@(guile-user)> (filter (lambda (p) > (> (node-reachable-count (list p) $4) > 600)) > (fold-packages cons '())) >
My concern, here, would be an equivalent of "fold-packages" for registry.npmjs.com. The API seems a bit cloudy to me. See this question https://stackoverflow.com/questions/34071621/query-npmjs-registry-via-api