Socket
Socket
Sign inDemoInstall

@automattic/effective-module-tree

Package Overview
Dependencies
29
Maintainers
30
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @automattic/effective-module-tree

A tool to generate the effective list of dependencies of any project


Version published
Weekly downloads
2
decreased by-75%
Maintainers
30
Install size
611 kB
Created
Weekly downloads
 

Readme

Source

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-hoist" hoisted/deduped packages.

Why?

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-module-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.

Usage

Run effective-module-tree in the root of your project.

Use effective-module-tree --root <path> to print the tree in a different project. Example:

effective-module-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.

Check out effective-module-tree --help for other flags and examples.

Troubleshooting

Invoke the command with DEBUG=effective-module-tree ./effective-module-tree to get a verbose log of what is going on.

Keywords

FAQs

Last updated on 14 Apr 2020

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc