# list-requirements

> Get a list of npm requirements for all files in a folder

Latest version **1.0.1** (published 2021-07-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install list-requirements
pnpm add list-requirements
yarn add list-requirements
bun add list-requirements
```

## 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.1 |
| Published | 2021-07-10 |
| First published | 2021-07-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 42.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | APartOfMe |
| Maintainers | apartofme |

## Links

- npm: https://www.npmjs.com/package/list-requirements
- Repository: https://github.com/APartOfMe1/list-requirements
- Homepage: https://github.com/APartOfMe1/list-requirements#readme
- Issues: https://github.com/APartOfMe1/list-requirements/issues
- npm.io page: https://npm.io/package/list-requirements

## Dependencies (3)

- [fs](https://npm.io/package/fs.md) 0.0.1-security
- [klaw](https://npm.io/package/klaw.md) ^3.0.0
- [path](https://npm.io/package/path.md) ^0.12.7

## Recent versions

- 1.0.1 (latest) — 2021-07-10
- 1.0.0 — 2021-07-08

## README

# List-Requirements

An NPM package that will read through a folder and output a sorted list of all requirements for every file in said folder.

## Installation

```bash
npm install list-requirements
```

## Usage

Basic usage:
```js
const listRequirements = require("list-requirements");

listRequirements("./folder/to/check").then(output => {
    console.log(output);
}).catch(err => {
    console.log(err);
});
```

There are also a number of options available:
```js
const listRequirements = require("list-requirements");

listRequirements("./folder/to/check", {
  //Whether to write the results to a json file
  //Defaults to "true"
  outputToFile: true,

  //The location where the output file should be placed, if enabled
  //Defaults to "./" 
  outputLocation: './',

  //An array of regex filters. If a requirement in a
  //file matches one of the filters, it will be ignored
  //Defaults to "null"
  filters: [/fs/g],

  //Whether to log local requirements
  //For example - if disabled - requirements such as "../../test.js" will be ignored
  //Defaults to "false"
  allowLocalReqs: false,

  //An array of filetypes to check. Any files that don't have one of these extensions will be ignored
  //When defining filetypes, be sure to only use the extension name without the "."
  //Defaults to "['js']"
  fileTypes: [ 'js' ]
}).then(output => {
    console.log(output);
}).catch(err => {
    console.log(err);
});

```

## Example Output
`outputPath` will only be provided if `outputToFile` is set to `true`
```
{
  outputPath: 'C:\Users\username\Desktop\requirements.json',
  totalFilesScanned: 80,
  matchingFiles: 72,
  filesWithReqs: 2,
  timeTaken: 134,
  results: [
    {
      name: 'eval',
      fullName: 'eval.js',
      filePath: 'C:\Users\username\Desktop\Test\Scan-This-Folder\eval.js',
      requirements: ["util"]
    },
    {
      name: 'reload',
      fullName: 'reload.js',
      filePath: 'C:\Users\username\Desktop\Test\Scan-This-Folder\reload.js',
      requirements: ["klaw", "system-commands", "chalk"]
    }
  ]
}
```

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

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