If you wanna do this bad boy for real, you depend on this one and the next 999 packages.
Actually, this can become a fun optimization problem. Which 1000 packages do you depend on to cover as much of NPM as possible?
Actually, this can become a fun optimization problem. Which 1000 packages do you depend on to cover as much of NPM as possible?
A new package that depends on this and anything not already downstream would have more dependencies.
Until you have 1000
Find the package not included that adds the most deps
If it adds less than everything you have
Add it
Else
Kick out anything that adds less than that
And then make that a package and repeat as desired.This problem is almost certainly NP-complete (it's basically the the "set cover" problem from Karp's 21 NP-complete problems), so for something the size of NPM it's almost certainly infeasible. Your greedy version would probably get you a pretty nice result, though.