npm

@alienfast/find-monorepo-root
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

MIT Version CI PRs Welcome

@alienfast/find-monorepo-root

Find the root directory of a monorepo using any of the following strategies:

  • Lerna
  • Yarn
  • Bolt
  • pnpm
  • npm

Install

yarn install @alienfast/find-monorepo-root

Usage

npx

For easy use in a shell script anywhere in your monorepo, execute with the -y

npx -y @alienfast/find-monorepo-root
# output: /Users/rosskevin/projects/archetype

or

#!/usr/bin/env bash

ROOT=`npx -y @alienfast/find-monorepo-root`

echo "My monorepo root is ${ROOT}"

Api

import { findMonorepoRoot } from '@alienfast/find-monorepo-root'
const cwd = process.cwd()

console.log(await findMonorepoRoot(cwd))
// {
//   strategy: 'lerna', // 'bolt' | 'yarn' | 'pnpm' | 'lerna' | 'npm'
//   dir: '/Users/rosskevin/projects/archetype',     // the monorepo root directory
// }

Contributing

PRs are accepted! This project is configured with auto, so feel free to submit a PR and auto will automatically create a canary release for you to try out.

Prior art

This was originally forked from https://github.com/bubkoo/find-monorepo-root/ because it a) did not work for me in it's current form; and b) I wanted to exec it simply with npx. Thanks to the original author and contributors.

Readme

Keywords

Package Sidebar

Install

npm i @alienfast/find-monorepo-root

Weekly Downloads

336

Version

1.0.9

License

none

Unpacked Size

17.7 kB

Total Files

73

Last publish

Collaborators

  • rosskevin
  • blake.mcdaniel