# is-monorepo

> Check if the working directory is in a monorepo.

Latest version **1.0.1** (published 2023-07-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-monorepo
pnpm add is-monorepo
yarn add is-monorepo
bun add is-monorepo
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-07-26 |
| First published | 2023-07-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 3 |
| Unpacked size | 7.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Connor White |
| Maintainers | bconnorwhite |
| Keywords | workspace, monorepo, is, package |

## Links

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

## Dependencies (3)

- [types-json](https://npm.io/package/types-json.md) ^4.0.1
- [root-pkg-json](https://npm.io/package/root-pkg-json.md) ^1.0.2
- [read-json-safe](https://npm.io/package/read-json-safe.md) ^3.0.0

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2023-07-26
- 1.0.0 — 2023-07-25

## README

<!--BEGIN HEADER-->
<div id="top" align="center">
  <h1>is-monorepo</h1>
  <a href="https://npmjs.com/package/is-monorepo">
    <img alt="NPM" src="https://img.shields.io/npm/v/is-monorepo.svg">
  </a>
  <a href="https://github.com/bconnorwhite/is-monorepo">
    <img alt="TypeScript" src="https://img.shields.io/github/languages/top/bconnorwhite/is-monorepo.svg">
  </a>
</div>

<br />

<blockquote align="center">Check if the working directory is in a monorepo.</blockquote>

<br />

_If I should maintain this repo, please ⭐️_
<a href="https://github.com/bconnorwhite/is-monorepo">
  <img align="right" alt="GitHub stars" src="https://img.shields.io/github/stars/bconnorwhite/is-monorepo?label=%E2%AD%90%EF%B8%8F&style=social">
</a>

_DM me on [Twitter](https://twitter.com/bconnorwhite) if you have questions or suggestions._
<a href="https://twitter.com/bconnorwhite">
  <img align="right" alt="Twitter" src="https://img.shields.io/twitter/url?label=%40bconnorwhite&style=social&url=https%3A%2F%2Ftwitter.com%2Fbconnorwhite">
</a>

---
<!--END HEADER-->

## Installation

```sh
npm install is-monorepo
```

```sh
yarn add is-monorepo
```

```sh
pnpm add is-monorepo
```

```sh
bun add is-monorepo
```

## Usage
```ts
import {
  isMonorepo,
  getMonorepoInfo,
  getWorkspaces,
  getMonorepoDir,
  getMonorepoPackageJSONPath,
  getMonorepoPackageJSON
} from "is-monorepo";

const monorepo = await isMonorepo(); // true | false

const info = await getMonorepoInfo();
// {
//   directory: string;
//   packageJSONPath: string;
//   packageJSON: JSONObject;
//   workspaces: string[];
// } \ undefined;

const monorepoDir = await getMonorepoDir(); // string | undefined

const monorepoPackageJSONPath = await getMonorepoPackageJSONPath(); // string | undefined

const monorepoPackageJSON = await getMonorepoPackageJSON(); // JSONObject | undefined

// Ex: ["packages/*", "apps/*"]
const workspaces = await getWorkspaces(); // string[] | undefined
```

<!--BEGIN FOOTER-->

<br />

<h2 id="dependencies">Dependencies<a href="https://www.npmjs.com/package/is-monorepo?activeTab=dependencies"><img align="right" alt="dependencies" src="https://img.shields.io/librariesio/release/npm/is-monorepo.svg"></a></h2>

- [read-json-safe](https://www.npmjs.com/package/read-json-safe): Read JSON files without try catch
- [root-pkg-json](https://www.npmjs.com/package/root-pkg-json): Find the highest package.json, starting from from the current working directory.
- [types-json](https://www.npmjs.com/package/types-json): Type checking for JSON values

<br />

<h3>Dev Dependencies</h3>

- [autorepo](https://www.npmjs.com/package/autorepo): Autorepo abstracts away your dev dependencies, providing a single command to run all of your scripts.

<br />

<h2 id="license">License <a href="https://opensource.org/licenses/MIT"><img align="right" alt="license" src="https://img.shields.io/npm/l/is-monorepo.svg"></a></h2>

[MIT](https://opensource.org/licenses/MIT)
<!--END FOOTER-->

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