# use pnpm
$ pnpm install -D monorepo-root
# use yarn
$ yarn add -D monorepo-root
# use npm
$ npm install -D monorepo-root
use import
import { monorepoRoot, monorepoRootSync } from 'monorepo-root'
monorepoRoot()
// or
monorepoRootSync()
use require
const { monorepoRoot, monorepoRootSync } = require('monorepo-root')
monorepoRoot()
// or
monorepoRootSync()
- 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:
- 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
Please open an issue here.