I want to programmatically, via Node.js, get a flat array instead of a dependency tree; e.g.:

["[email protected]", "[email protected]", "[email protected]"]

In ascending dependency order, e.g.: if y relies on x, then x is the first package in the array:

Is there a NPM package for this? E.g.:

// path/to/package contains a package.json and node_modules
let deps = getDependencies('path/to/package');


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.