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

3.3.1 • Public • Published

monorepo-root

A simple utility to get the monorepo root

NPM version Codacy Badge Test coverage npm download License

Sonar

Install

# use pnpm
$ pnpm install -D monorepo-root

# use yarn
$ yarn add -D monorepo-root

# use npm
$ npm install -D monorepo-root

Usage

use import

import { monorepoRoot, monorepoRootSync } from 'monorepo-root'

monorepoRoot()
// or
monorepoRootSync()

use require

const { monorepoRoot, monorepoRootSync } = require('monorepo-root')

monorepoRoot()
// or
monorepoRootSync()

API reference

  • Usage: monorepoRoot(cwd) & monorepoRootSync(cwd)
  • Parameters:
Param Description Type Optional value Required Default value
cwd running path string - false -
  • Types:
declare function monorepoRoot(cwd?: string): Promise<string | null>

declare function monorepoRootSync(cwd?: string): string | null
  • Demos:
  1. simple use
import { monorepoRoot, monorepoRootSync } from 'monorepo-root'

monorepoRoot().then(path => {
  console.log('The monorepo root is: ', path) // /Users/user/path/of/package/root or null
})
console.log('The monorepo root is: ', monorepoRootSync()) // /Users/user/path/of/package/root or null

Issues & Support

Please open an issue here.

License

MIT

Package Sidebar

Install

npm i monorepo-root

Weekly Downloads

2,135

Version

3.3.1

License

MIT

Unpacked Size

8.3 kB

Total Files

7

Last publish

Collaborators

  • saqqdy