ncm-analyze-tree
Get certification data for a module's dependency tree, as it is on disk.
This process is optimized by trying to get all the necessary information from
a package-lock.json
or yarn.lock
file, and a full scan of node_modules/**
is only reverted to if no lock file exists.
Usage
Print certification data for this module's dependency tree:
const analyze = const data = await for const pkg of data console for const path of pkgpaths console
$ node example.js | head -n25Analyzing 326 modules...standard@11.0.1 eslint@4.18.2 standard@11.0.1ajv@5.5.2 standard@11.0.1 > eslint@4.18.2 standard@11.0.1 > eslint@4.18.2 > table@4.0.2co@4.6.0 standard@11.0.1 > eslint@4.18.2 > ajv@5.5.2fast-deep-equal@1.1.0 standard@11.0.1 > eslint@4.18.2 > ajv@5.5.2fast-json-stable-stringify@2.0.0 standard@11.0.1 > eslint@4.18.2 > ajv@5.5.2json-schema-traverse@0.3.1 standard@11.0.1 > eslint@4.18.2 > ajv@5.5.2babel-code-frame@6.26.0 standard@11.0.1 > eslint@4.18.2chalk@1.1.3 standard@11.0.1 > eslint@4.18.2 > babel-code-frame@6.26.0ansi-styles@2.2.1 standard@11.0.1 > eslint@4.18.2 > babel-code-frame@6.26.0 > chalk@1.1.3escape-string-regexp@1.0.5 standard@11.0.1 > eslint@4.18.2 > babel-code-frame@6.26.0 > chalk@1.1.3 standard@11.0.1 > eslint@4.18.2 > chalk@2.4.1
The returned data is of this format:
{
name
version
score
paths[]
published
publishedAt
results {
severity
pass
name
test
value
}
vulnerabilities {
id,
title,
semver {
vulnerable
},
severity
}
}
Installation
$ npm install ncm-analyze-tree
API
analyze({ dir, token, onPkgs, filter, url })
dir
: The node project's directorytoken
: accounts tokenonPkgs
: Called with aSet
of package objects{ name, version }
, once the tree has been readfilter
: Called with everypkg
object, returnfalse
to remove from analysisurl
:ncm2-api
url
License & copyright
Copyright © NodeSource.
Licensed under the MIT open source license, see the LICENSE file for details.