is-monorepo
v1.0.1
Published
Check if the working directory is in a monorepo.
Downloads
8
Maintainers
Readme
If I should maintain this repo, please ⭐️
DM me on Twitter if you have questions or suggestions.
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
- 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
- autorepo: Autorepo abstracts away your dev dependencies, providing a single command to run all of your scripts.