# @jchpro/nest-librarian

> CLI for simplifying Nest.js library publishing

Latest version **0.5.0** (published 2025-04-12) · LGPL-3.0-only license · 0 weekly downloads

## Install

```sh
npm install @jchpro/nest-librarian
pnpm add @jchpro/nest-librarian
yarn add @jchpro/nest-librarian
bun add @jchpro/nest-librarian
```

Provides the command `nestlib`.

## Health

**Score 40/100 (D)** — status: stable.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2025-04-12 |
| First published | 2024-01-20 |
| Weekly downloads | 0 |
| License | LGPL-3.0-only |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=20 |
| Dependencies | 6 |
| Unpacked size | 64.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | https://github.com/jchpro |
| Maintainers | jchpro |
| Keywords | nest.js, library, cli |

## Links

- npm: https://www.npmjs.com/package/@jchpro/nest-librarian
- Repository: https://github.com/jchpro/nest
- Issues: https://github.com/jchpro/nest/issues
- npm.io page: https://npm.io/package/@jchpro/nest-librarian

## Dependencies (6)

- [glob](https://npm.io/package/glob.md) ^10.4.5
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [rimraf](https://npm.io/package/rimraf.md) ^5.0.10
- [semver](https://npm.io/package/semver.md) ^7.7.1
- [commander](https://npm.io/package/commander.md) ^13.1.0
- [find-package-json](https://npm.io/package/find-package-json.md) ^1.2.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 0.5.0 (latest) — 2025-04-12
- 0.4.0 — 2025-03-12
- 0.3.0 — 2025-03-12
- 0.2.2 — 2024-11-13
- 0.2.1 — 2024-03-17
- 0.2.0 — 2024-03-16
- 0.1.0 — 2024-01-20

## README

# Nest librarian

Helps with preparing built Nest.js libraries for publishing, very simple stuff.

## Description

The CLI is a simple wrapper around Nest's build command, performing some common additional post-build steps.

Exported components might help you with building your own Nest CLIs.

## Installation

```shell
npm i -D @jchpro/nest-librarian
```

I'm not a fan of installing too many CLIs globally, so in this document I'll be showing example commands run using `npx`, assuming that the package is installed locally in your project.

## CLI usage

### `package.lib.json`

Put this in your library root if you want to build the library using the CLI. The schema is the one of `package.json`, the name is changed in order to not confuse your IDE.

The file will serve as the base for creating output `package.json`. Whatever you put there will be present in the output file, with some caveats which will be described below.

### Building libraries

```shell
npx nestlib build <libraryProject> <options...> 
```

Running `npx nestlib help build` will give you more information about the options, here's what the command does:

1. Builds the library using nest CLI;
2. Copies assets to the output library;
3. Merges paths from the root `package.json` to the output one;
4. Creates output `package.json`, reads dependency versions from the root one if that's what you want (described below);
5. Deletes the `tsbuildinfo` file.

#### Reading dependency versions from root

If you'd like the dependency versions to be read from the root `package.json`, just set them to `0.0.0` in the `package.lib.json`:

```json
{
  "dependencies": {
    "lodash": "0.0.0",
    "commander": "^13.1.0"
  }
}
```

In this example `lodash` will use the version from root, and `commander` will have `^13.1.0`.

## Exported components

Please refer to the code comments for additional information.

### `Library`

Represents the library defined in the `nest-cli.json` file. Contains paths to significant files and some parsed configuration.

### `Project`

Wrapper around `nest-cli.json` file, focusing on the libraries defined in the file. Contains instances of `Library` for each library in your workspace. 

### Utilities

There are few filesystem and other utilities available, once again - please refer to the code :)

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