npm.io
1.0.1 • Published 3 years ago

is-monorepo

Licence
MIT
Version
1.0.1
Deps
3
Size
7 kB
Vulns
0
Weekly
0

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

Keywords