# nmtree

> Get a (flat) tree representation of the modules in your node_modules folder

Latest version **1.0.6** (published 2020-07-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install nmtree
pnpm add nmtree
yarn add nmtree
bun add nmtree
```

Provides the command `nmtree`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2020-07-09 |
| First published | 2017-11-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 439.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Aram Drevekenin |
| Maintainers | imsnif |
| Keywords | node_modules, tree, parse, json, object |

## Links

- npm: https://www.npmjs.com/package/nmtree
- Repository: https://github.com/imsnif/nmtree
- Homepage: https://github.com/imsnif/nmtree#readme
- Issues: https://github.com/imsnif/nmtree/issues
- npm.io page: https://npm.io/package/nmtree

## Dependencies (1)

- [commander](https://npm.io/package/commander.md) ^2.11.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.6 (latest) — 2020-07-09
- 1.0.5 — 2019-06-10
- 1.0.4 — 2017-11-21
- 1.0.3 — 2017-11-17
- 1.0.2 — 2017-11-17
- 1.0.1 — 2017-11-17
- 1.0.0 — 2017-11-17

## README

# nmtree

[![Build Status](https://travis-ci.org/imsnif/nmtree.svg?branch=master)](https://travis-ci.org/imsnif/nmtree) [![Coverage Status](https://coveralls.io/repos/github/imsnif/nmtree/badge.svg?branch=master)](https://coveralls.io/github/imsnif/nmtree?branch=master) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

Get a node_modules directory with all its `package.json` files as a parsable flat tree.

![alt text](https://github.com/imsnif/nmtree/raw/master/docs/tty.gif )

### what is this?
Given an npm library, this tool would recursively go through its `node_modules` and create a flat tree with the paths of libraries as keys and their parsed `package.json` files as values.
eg.
```javascript
{
  "myLib": <myPackageJson>,
  "myLib/node_modules/myDep": <depPackageJson>,
  "myLib/node_modules/myDep/node_modules/myOtherDep": <otherDepPackageJson>
}
```
### install
`npm install -g nmtree` - for the cli tool

`npm install nmtree` for the `require`-able library

### usage
```javascript
const nmtree = require('nmtree')

const libPath = '/path/to/my/lib'
const tree = nmtree(libPath)

const installedReactVersions = Object.keys(tree).reduce((versions, libPath) => {
  const { name, version } = tree[libPath]
  if (name === 'react') versions.push(version)
  return versions
}, [])
// or whatever else you can think of!
```

### command line usage
```
nmtree /path/to/my/lib > my-lib-node-modules.json
```

### License
MIT

---
_Source: https://npm.io/package/nmtree · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
