
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
dependency-info
Advanced tools
Read useful info from your dependency tree. It supports both npm and bower.
npm install dependency-info
First af all, you have to retrieve your dependency tree.
var dependencyInfo = require('dependency-info');
dependencyInfo.readTree({
manager: 'npm'
})
.then(function (tree) {
...
})
.catch(function (err) {
...
});
var dependencyInfo = require('dependency-info')
list,
tree;
tree = dependencyInfo.readTreeSync({
manager: 'npm'
});
readTreeand readTreeSync accept the same options param:
{
path: {String} path to module whose dependencies will be fetched.
Default: process.cwd()
manager: {String} Package manager: 'npm' or 'bower'
type: {String} All dependencies: 'all' (default)
or
{Array} Accepted values: 'dependencies' and 'devDependencies'
deep: {Boolean} If true it search for all dependencies, not only the direct ones.
Default value: false
filterBy:
{
keyword: {Array} List of keywords the dependency must have
}
}
Tree object provides you a method to get a sorted Array of the information you need.
This method looks over the tree and returns an ordered array of key value objects filled with the specified fields, which will be taken from each dependency json file.
fields {Array}
Property names form json files. You can also use 'path', which will contain the full path to dependency directory.
order {String}
Sort dependencies in ascending ('asc') or descending order ('desc')
var dependencyInfo = require('dependency-info');
dependencyInfo.readTree({
manager: 'npm',
filterBy: {
keyword: 'gulpplugin'
}
})
.then(function (tree) {
var list = tree.list(['name', 'path', 'main', 'files'], 'asc');
})
As a result, list and the following structure will be alike.
[ { name: 'gulp-autoprefixer',
path: '/var/my-project/node_modules/gulp-autoprefixer',
main: undefined,
files: [ 'index.js' ] },
{ name: 'gulp-copy',
path: '/var/my-project/node_modules/gulp-copy',
main: 'index.js',
files: undefined },
{ name: 'gulp-minify-css',
path: '/var/my-project/node_modules/gulp-minify-css',
main: undefined,
files: [ 'index.js' ] },
{ name: 'gulp-prettify',
path: '/var/my-project/node_modules/gulp-prettify',
main: 'index.js',
files: undefined },
{ name: 'gulp-rename',
path: '/var/my-project/node_modules/gulp-rename',
main: './index.js',
files: [ 'index.js' ] },
{ name: 'gulp-sass',
path: '/var/my-project/node_modules/gulp-sass',
main: 'index.js',
files: undefined },
{ name: 'gulp-strip-css-comments',
path: '/var/my-project/node_modules/gulp-strip-css-comments',
main: undefined,
files: [ 'index.js' ] } ]
var dependencyInfo = require('dependency-info')
list,
tree;
tree = dependencyInfo.readTreeSync({
manager: 'npm'
});
list = tree.list(['name', 'version'], 'asc');
console.log(list);
This code will output a message like this:
[ { name: 'connect-livereload', version: '0.5.3' },
{ name: 'express', version: '4.12.3' },
{ name: 'gulp', version: '3.8.11' },
{ name: 'gulp-autoprefixer', version: '2.2.0' },
{ name: 'gulp-copy', version: '0.0.2' },
{ name: 'gulp-kit', version: '0.1.1' },
{ name: 'gulp-minify-css', version: '1.1.0' },
{ name: 'gulp-prettify', version: '0.3.0' },
{ name: 'gulp-rename', version: '1.2.2' },
{ name: 'gulp-sass', version: '1.3.3' },
{ name: 'gulp-strip-css-comments', version: '1.1.0' },
{ name: 'tiny-lr', version: '0.1.5' } ]
MIT. See LICENSE for details.
FAQs
Get your project dependency tree from npm as well as from bower
We found that dependency-info demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.