@node-kit/lerna-workspace-root
v3.3.0
Published
A simple utility to get the lerna workspace root
Downloads
20,263
Maintainers
Readme
@node-kit/lerna-workspace-root
A simple utility to get the lerna workspace root
Install
# use pnpm
$ pnpm install -D @node-kit/lerna-workspace-root
# use yarn
$ yarn add -D @node-kit/lerna-workspace-root
# use npm
$ npm install -D @node-kit/lerna-workspace-root
Usage
use import
import { lernaWorkspaceRoot, lernaWorkspaceRootSync } from '@node-kit/lerna-workspace-root'
lernaWorkspaceRoot()
// or
lernaWorkspaceRootSync()
use require
const { lernaWorkspaceRoot, lernaWorkspaceRootSync } = require('@node-kit/lerna-workspace-root')
lernaWorkspaceRoot()
// or
lernaWorkspaceRootSync()
API reference
- Usage:
lernaWorkspaceRoot(cwd)
&lernaWorkspaceRootSync(cwd)
- Parameters:
| Param | Description | Type | Optional value | Required | Default value |
| ----- | ------------ | -------- | -------------- | -------- | ------------- |
| cwd | running path | string
| - | false
| - |
- Types:
declare function lernaWorkspaceRoot(cwd?: string): Promise<string | null>
declare function lernaWorkspaceRootSync(cwd?: string): string | null
- Demos:
- simple use
import { lernaWorkspaceRoot, lernaWorkspaceRootSync } from '@node-kit/lerna-workspace-root'
lernaWorkspaceRoot().then(path => {
console.log('The lerna workspace root is: ', path) // /Users/user/path/of/package/root or null
})
console.log('The lerna workspace root is: ', lernaWorkspaceRootSync()) // /Users/user/path/of/package/root or null
Issues & Support
Please open an issue here.