# nodemodules2schema

> node_modules to json schema

Latest version **1.0.3** (published 2020-10-28) · MIT license · 0 weekly downloads

## Install

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

## 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.3 |
| Published | 2020-10-28 |
| First published | 2020-10-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | ibeizhu |
| Maintainers | frontmoment |
| Keywords | node_modules, packages, schema, json, packages2schema, packages2json, nodemodules2schema, nodemodules2json |

## Links

- npm: https://www.npmjs.com/package/nodemodules2schema
- Repository: https://github.com/ibeizhu/nodemodules2schema
- Issues: https://github.com/ibeizhu/nodemodules2schema/issues
- npm.io page: https://npm.io/package/nodemodules2schema

## Dependencies (2)

- [fs-extra](https://npm.io/package/fs-extra.md) ^9.0.1
- [set-value](https://npm.io/package/set-value.md) ^3.0.2

## 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.3 (latest) — 2020-10-28
- 1.0.2 — 2020-10-28
- 1.0.1 — 2020-10-28
- 1.0.0 — 2020-10-28

## README

## nodemodules2schema [![NPM version](https://img.shields.io/npm/v/nodemodules2schema.svg?style=flat)](https://www.npmjs.com/package/nodemodules2schema) [![NPM monthly downloads](https://img.shields.io/npm/dm/nodemodules2schema.svg?style=flat)](https://npmjs.org/package/nodemodules2schema) [![NPM total downloads](https://img.shields.io/npm/dt/nodemodules2schema.svg?style=flat)](https://npmjs.org/package/nodemodules2schema)

traverse node_modules and look up all packages to json schema

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save nodemodules2schema
```

## Usage

```js
const nodemodules2schema = require('nodemodules2schema');
const projectDir = "/my/project1";
const options = { 
  depth: 5, // traverse node_modules max depth
  // dependenciesKey: "children", // Customize schema key
};
const schema = nodemodules2schema(projectDir, options);
```

schema 
```json

{
  "dependencies": [
    {
      "dependencies": [
        {
          "dependencies": [
            {
              "dependencies": [],
              "name": "isobject",
              "version": "3.0.1"
            }
          ],
          "name": "is-plain-object",
          "version": "2.0.4"
        }
      ],
      "name": "set-value",
      "version": "3.0.2"
    },
    {
      "dependencies": [],
      "name": "universalify",
      "version": "1.0.0"
    }
  ],
  "name": "nodemodules2schema",
  "version": "1.0.0"
}
```

### Params

* `projectDir` **{string}**: the project directory to traverse 
* `options` **{object}**: options for nodemodules2schema
  - `depth` **{number}**: traverse node_modules max depth, default value `8`
    - **Attention:** node_modules is a black hole, sometimes may be positive infinity and lead to memory overflow
  - `dependenciesKey` **{string}**: schema key, default value `'dependencies'`

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