is-monorepo
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

is-monorepo

NPM TypeScript

Check if the working directory is in a monorepo.

If I should maintain this repo, please ⭐️ GitHub stars

DM me on Twitter if you have questions or suggestions. Twitter


Installation

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

Usage

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

Dependenciesdependencies

  • read-json-safe: Read JSON files without try catch
  • root-pkg-json: Find the highest package.json, starting from from the current working directory.
  • types-json: Type checking for JSON values

Dev Dependencies

  • autorepo: Autorepo abstracts away your dev dependencies, providing a single command to run all of your scripts.

License license

MIT

Package Sidebar

Install

npm i is-monorepo

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

7.32 kB

Total Files

4

Last publish

Collaborators

  • bconnorwhite