
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
effective-dependency-tree
Advanced tools
A tool to generate the effective list of dependencies of any project.
Forked from @automattic/effective-module-tree
, hosted in https://github.com/Automattic/wp-calypso/tree/trunk/packages/effective-module-tree
CLI tool that generates an ASCII tree with the representation of packages in node_modules
and
their dependencies. This works over the actual node_modules
files, so you need to install your
dependencies first (i.e. npm install
or yarn install
).
It generates the logical representation of the tree. A package may appear multiple times if it is depended on by multiple packages, even if all point to the same file on the filesystem. In other words, it "un-hoists" hoisted/deduped packages.
It will traverse regular dependencies
, devDependencies
and peerDependencies
, but will ignore
optional peerDependencies
(as specified in peerDependenciesMeeta
).
Usually, the package manger has a way to list the dependencies (npm ls
or yarn list
). However
this includes deduplicated packages, and requires the presence of the lock file to generate the
tree. This is the package manager's vision of the tree.
System tools like ls
, find
or tree
can generate a similar output, but those represent the
filesystem view of the tree. Depending on how effective the package manager is hoisting dependencies,
this view may not be comparable.
effective-dependency-tree
generates node's vision of the dependency tree. Is what node will find when
requiring dependencies, ignoring where the package physically live in the file system. This tree
should be consistent across package managers and different hoisting capabilities. As such, it can
be used to verify that the dependeny tree remains constant when migrating to a different package
manager.
Run effective-dependency-tree
in the root of your project.
Use effective-dependency-tree --root <path>
to print the tree in a different project. Example:
effective-dependency-tree --root "./src/package.json"
This tool can generate either an ascii tree, or a list (easier to visualize dependency chains in
big trees). It can be specified with the flags -o tree
or -o list
.
If you are using this tool to analyze many packages (e.g. in a monorepo), you can pass --root
multiple
times. Discovered trees will be reused and cached across packages, significatively speeding it up:
effective-dependency-tree --root "./packages/a/package.json" --root "./packages/b/package.json"
Check out effective-dependency-tree --help
for other flags and examples.
Invoke the command with DEBUG=effective-dependency-tree ./effective-dependency-tree
to get a verbose
log of what is going on.
FAQs
A tool to generate the effective list of dependencies of any project.
The npm package effective-dependency-tree receives a total of 2 weekly downloads. As such, effective-dependency-tree popularity was classified as not popular.
We found that effective-dependency-tree 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.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.