@node-kit/lerna-workspace-info
v3.3.0
Published
A simple utility to get the lerna workspace information
Downloads
1,327
Maintainers
Readme
@node-kit/lerna-workspace-info
A simple utility to get the lerna workspace information
Install
# use pnpm
$ pnpm install -D @node-kit/lerna-workspace-info
# use yarn
$ yarn add -D @node-kit/lerna-workspace-info
# use npm
$ npm install -D @node-kit/lerna-workspace-info
Usage
use import
import { lernaWorkspaceInfo, lernaWorkspaceInfoSync } from '@node-kit/lerna-workspace-info'
lernaWorkspaceInfo()
// or
lernaWorkspaceInfoSync()
use require
const { lernaWorkspaceInfo, lernaWorkspaceInfoSync } = require('@node-kit/lerna-workspace-info')
lernaWorkspaceInfo()
// or
lernaWorkspaceInfoSync()
API reference
- Usage:
lernaWorkspaceInfo(cwd)
&lernaWorkspaceInfoSync(cwd)
- Parameters:
| Param | Description | Type | Optional value | Required | Default value |
| ----- | ------------ | -------- | -------------- | -------- | ------------- |
| cwd | running path | string
| - | false
| - |
- Types:
declare function lernaWorkspaceInfo(cwd?: string): Promise<WorkspaceInfo | null>
declare function lernaWorkspaceInfoSync(cwd?: string): WorkspaceInfo | null
declare type ManifestInfo = {
packages: string | string[]
} & Record<string, unknown>
declare type WorkspaceInfo = Record<
string,
{
path: string
}
>
- Demos:
- simple use
import { lernaWorkspaceInfo, lernaWorkspaceInfoSync } from '@node-kit/lerna-workspace-info'
lernaWorkspaceInfo({
cwd,
packageManager: 'pnpm'
}).then(data => {
console.log('The lerna workspace info is: ', data) // { projectA: { path: 'packages/projectA' } }
})
// or
console.log('The lerna workspace info is: ', lernaWorkspaceInfoSync()) // { projectA: { path: 'packages/projectA' } }
Issues & Support
Please open an issue here.