npm -ls for remote packages
npm install johnny-dependencynpm -ls for remote packages
johnny-dependency fetches the dependency tree metadata for a remote npm package.
Additionally johnny-dependency fetches information about the latest version of dependency packages
so that you have information about the health of a package's dependency tree
(ie how out of date dependencies are).
``js
$ npm install johnny-dependency
// only required for accessing private packages
const pacoteOptions = {
auth: {
},
};
var jd = require('johnny-dependency');
jd('johhny-dependency@latest', pacoteOptions).then((res) => {
/*
{
"name":"johnny-dependency",
"version":"0.3.0",
"latestVersion":"0.3.0",
"children":[
{
"name":"lodash",
"version":"4.17.4",
"latestVersion":"4.17.4",
"children":[],
},
{
"name":"rxjs",
"version":"5.4.2",
"latestVersion":"5.4.2",
"children":[
...
],
},
...
*/
});
`
johnny-dependency will prune any circular dependencies in its return data
johnny-dependency also ships with a cli script that allows you to get info about a remote package from the command-line
`bash`
johnny-dependency johnny-dependency@latest
johnny-dependency works for private packages as well -pacoteOptions
you just need to provide an auth token in the optional argument.
See usage for an example.
If using the cli johnny-dependency will look for a token in .npmrc` in your home dir.
A big thank you to the following for their help: