workspace-pkgs
v3.2.0
Published
A simple utility to get the workspace project list
Downloads
45
Maintainers
Readme
workspace-pkgs
A simple utility to get the workspace project list
Install
# use pnpm
$ pnpm install -D workspace-pkgs
# use yarn
$ yarn add -D workspace-pkgs
# use npm
$ npm install -D workspace-pkgs
Usage
use import
import { workspacePkgs, workspacePkgsSync } from '@node-kit/workspace-pkgs'
workspacePkgs()
// or
workspacePkgsSync()
use require
const { workspacePkgs, workspacePkgsSync } = require('@node-kit/workspace-pkgs')
workspacePkgs()
// or
workspacePkgsSync()
API reference
- Usage:
workspacePkgs(cwd)
&workspacePkgsSync(cwd)
- Parameters:
| Param | Description | Type | Optional value | Required | Default value |
| ----- | ------------ | -------- | -------------- | -------- | ------------- |
| cwd | running path | string
| - | false
| - |
- Types:
declare function workspacePkgs(cwd?: string): Promise<string[] | null>
declare function workspacePkgsSync(cwd?: string): string[] | null
- Demos:
- simple use
import { workspacePkgs, workspacePkgsSync } from '@node-kit/workspace-pkgs'
workspacePkgs().then(data => {
console.log('The workspace projects is: ', data) // [ 'packages/utils', 'packages/monorepo-root' ]
})
console.log('The workspace projects is: ', workspacePkgsSync()) // [ 'packages/utils', 'packages/monorepo-root' ]
Issues & Support
Please open an issue here.