# identify-monorepo-root

> Find the root directory of a monorepo from anywhere inside it.

Latest version **1.1.0** (published 2026-04-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install identify-monorepo-root
pnpm add identify-monorepo-root
yarn add identify-monorepo-root
bun add identify-monorepo-root
```

Provides the command `identify-monorepo-root`.

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2026-04-07 |
| First published | 2023-05-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=18 |
| Dependencies | 1 |
| Unpacked size | 10.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1 |
| Author | Markus Kurzmann |
| Maintainers | maks-io |
| Keywords | monorepo, npm, yarn, pnpm, workspaces, turbo, turborepo, cli |

## Links

- npm: https://www.npmjs.com/package/identify-monorepo-root
- Repository: https://github.com/maks-io/identify-monorepo-root
- Homepage: https://github.com/maks-io/identify-monorepo-root#readme
- Issues: https://github.com/maks-io/identify-monorepo-root/issues
- npm.io page: https://npm.io/package/identify-monorepo-root

## Dependencies (1)

- [minimist](https://npm.io/package/minimist.md) ^1.2.8

## 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

- 1.1.0 (latest) — 2026-04-07
- 1.0.9 — 2024-11-28
- 1.0.8 — 2024-10-15
- 1.0.7 — 2024-04-03
- 1.0.6 — 2024-04-03
- 1.0.5 — 2023-06-15
- 1.0.4 — 2023-05-09
- 1.0.3 — 2023-05-09
- 1.0.2 — 2023-05-08
- 1.0.1 — 2023-05-07
- 1.0.0 — 2023-05-07

## README

# identify-monorepo-root 🌱

[![Version](https://img.shields.io/npm/v/identify-monorepo-root)](https://www.npmjs.com/package/identify-monorepo-root)

Find the root directory of a monorepo from anywhere inside it.

The package works as a small CLI and as a library. It detects common monorepo root markers such as `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, `workspaces`, and `packageManager`.

## Installation

```bash
npm install identify-monorepo-root
```

You can also run it without a global install:

```bash
npx identify-monorepo-root
```

## CLI usage

Run the command from any nested directory inside the repository:

```bash
identify-monorepo-root
```

The CLI prints the detected root path and exits with status code `1` when no root can be identified.

## Library usage

```ts
import { identifyMonorepoRoot } from "identify-monorepo-root";

const monorepoRoot = identifyMonorepoRoot();
```

You may also pass a starting directory explicitly:

```ts
const monorepoRoot = identifyMonorepoRoot("/path/inside/repository");
```

## Development

This repository uses `npm`, not Yarn or pnpm.

Useful commands:

```bash
npm test
npm run build
npm run verify
```

Commits are expected to use conventional commit messages. Local raw `git commit` is blocked by Husky on purpose; use the interactive helper instead:

```bash
npm run commit
```

That helper is intentionally a small local script instead of `commitizen` to avoid extra transitive maintenance and vulnerability surface.

## Release workflow

Releases are automated with `semantic-release` in GitHub Actions.

- CI runs `npm ci` and `npm run verify`.
- Releases run on pushes to `main` or `master`, plus manual workflow dispatch.
- The workflow is designed for protected branches and does not rely on pushing version or changelog commits back to git.
- Git tags, npm releases, and GitHub Releases are the release source of truth.
- Because of that, the `package.json` version committed on `main` can lag behind the latest published version.
- The release workflow is set up for npm Trusted Publishing via GitHub Actions OIDC. No long-lived `NPM_TOKEN` should be required once the npm package is configured for trusted publishing.

You can preview the release process locally with:

```bash
npm run release:dry-run
```

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