# @hannohealth/generate-licenses-list

> Generate a JSON file with the list of licenses from package.json dependencies

Latest version **1.1.0** (published 2021-02-17) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @hannohealth/generate-licenses-list
pnpm add @hannohealth/generate-licenses-list
yarn add @hannohealth/generate-licenses-list
bun add @hannohealth/generate-licenses-list
```

Provides the command `generate-licenses-list`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2021-02-17 |
| First published | 2021-02-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 24.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Hanno |
| Maintainers | hanno-bot |

## Links

- npm: https://www.npmjs.com/package/@hannohealth/generate-licenses-list
- Repository: https://github.com/wearehanno/generate-licenses-list
- Homepage: https://github.com/wearehanno/generate-licenses-list#readme
- Issues: https://github.com/wearehanno/generate-licenses-list/issues
- npm.io page: https://npm.io/package/@hannohealth/generate-licenses-list

## Dependencies (5)

- [yargs](https://npm.io/package/yargs.md) ^16.2.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.20
- [fs-extra](https://npm.io/package/fs-extra.md) ^9.1.0
- [read-pkg-up](https://npm.io/package/read-pkg-up.md) ^7.0.1
- [license-checker-rseidelsohn](https://npm.io/package/license-checker-rseidelsohn.md) ^1.1.2

## Recent versions

- 1.1.0 (latest) — 2021-02-17
- 1.0.1 — 2021-02-02
- 1.0.0 — 2021-02-01

## README

# generate-licenses-list

A tool to generate a list of licenses from your `node_modules`. When it runs, it will create a JSON file with licenses information from all the dependencies and sub-dependencies in your tree.

A fork of [license-checker-rseidelsohn](https://github.com/RSeidelsohn/license-checker-rseidelsohn) which is itself a fork of [license-checker](https://github.com/davglass/license-checker). Our version tweaks the behaviour to suit our own requirements.

## Installation

To install the package locally:

```
yarn add -D @hannohealth/generate-licenses-list
npm install --save-dev @hannohealth/generate-licenses-list
```

## Usage

Generate a list of licenses from your repository's `package.json` by running:

```
yarn run generate-licenses-list
npm run generate-licenses-list
```

## Configuration

### Adding custom licenses and replacement licenses

In your `package.json`, you can additionally configure custom licenses that need to be added to that list, or licenses that you want to replace. The name of the replacement only has to match up until the `@` before the version number.

```
{
   licensesConfig: {
      "customLicenses": [
         {
            "name": "custom-package"
            "license": "Unlicensed"
            "url": "https://github.com/custom-package"
         }
      ],
      replacementLicenses: [
         {
            "name": "lodash" // used for matching, will replace the package: lodash@4.17.20
            "license": "Custom" // replaces the existing license with this one
            "url": "" // replaces the URL of the matching license
         }
      ]
  },
}
```

### Only including production dependencies

To exclude licenses from the `devDependencies` field you can pass in the `productionOnly` flag. By default, this is set to `false`, so all `devDependencies` will be included.

```
yarn run generate-licenses-list --productionOnly
```

### Remove version number string

To cut off the version number from each package, pass in the `removeVersions` flag. Packages with different version numbers will only show up once.

```
yarn run generate-licenses-list --removeVersions
```

### Customising the output path

The default path is `reports/licenses.json`. Pass in the `outputPath` to customise this:

```
yarn run generate-licenses-list --outputPath=customPath/licenses.json
```

## Development

- Run `yarn start` to scan this module's own package.json.
- Run `yarn test` to run unit tests.

## License

MIT

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