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