monorepo-root
v3.2.0
Published
A simple utility to get the monorepo root
Downloads
9,464
Maintainers
Readme
monorepo-root
A simple utility to get the monorepo root
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 '@node-kit/monorepo-root'
monorepoRoot()
// or
monorepoRootSync()
use require
const { monorepoRoot, monorepoRootSync } = require('@node-kit/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:
- simple use
import { monorepoRoot, monorepoRootSync } from '@node-kit/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.