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