Shameimaru.js
Shameimaru Aya likes to traverse node_modules and capture the tree.
Installation
$ npm install --save shameimaru
Usage
const Shameimaru = ; const shameimaru = "<YOUR_PROJ_ROOT>";
<YOUR_PROJ_ROOT>
is the root path which contains node_modules of your project.
After create the Shameimaru
instance, you can do traverse()
through it.
const ret = await shameimaru;
Then you'll get a may-flatten graph-form tree. e.g.
Each element in the result may contains keys as below:
ref
: a random referrence sign in this tree, it's unique; e.g.63bb611b-232d-4f7a-ba53-3322670ed170
name
: the name of this package (dependency); e.g.toshihiko
version
: the name of this package (dependency); e.g.2.7.0
from
: same as_from
in installed package.json; e.g.mz@^2.0.0
resolved
: same as_resolved
in installed package.json;http://registry.npm.taobao.org/mz/download/mz-2.7.0.tgz
exists
: whether it's really exist in current tree folder; e.g.true
ancestor
: if it matches a exactly the same package at any upper directory, it indicates that element'sref
; e.g.63bb611b-232d-4f7a-ba53-3322670ed170
rawSpec
: the raw spec of this package in its parent's package.json; e.g.^2.0.0
adjustHere
: this package is not need by its parent, but some package need it flatten here; e.g.true
missing
: if we can't find this package at any right path, then it will betrue
; e.g.true
Contribute
You're welcome to fork and make pull requests!