3.2.0 • Published 9 months ago
workspace-root v3.2.0
workspace-root
A simple utility to get the workspace root
Install
# use pnpm
$ pnpm install -D workspace-root
# use yarn
$ yarn add -D workspace-root
# use npm
$ npm install -D workspace-root
Usage
use import
import { workspaceRoot, workspaceRootSync } from '@node-kit/workspace-root'
workspaceRoot()
// or
workspaceRootSync()
use require
const { workspaceRoot, workspaceRootSync } = require('@node-kit/workspace-root')
workspaceRoot()
// or
workspaceRootSync()
API reference
- Usage:
workspaceRoot(cwd)
&workspaceRootSync(cwd)
- Parameters:
Param | Description | Type | Optional value | Required | Default value |
---|---|---|---|---|---|
cwd | running path | string | - | false | - |
- Types:
declare function workspaceRoot(cwd?: string): Promise<string | null>
declare function workspaceRootSync(cwd?: string): string | null
- Demos:
- simple use
import { workspaceRoot, workspaceRootSync } from '@node-kit/workspace-root'
workspaceRoot().then(path => {
console.log('The workspace root is: ', path) // /Users/user/path/of/package/root or null
})
console.log('The workspace root is: ', workspaceRootSync()) // /Users/user/path/of/package/root or null
Issues & Support
Please open an issue here.
License
3.2.0
9 months ago
3.1.1
10 months ago
3.1.0
10 months ago
3.0.0-beta.3
11 months ago
3.0.0-beta.2
11 months ago
3.0.0
10 months ago
3.0.0-beta.5
10 months ago
3.0.0-beta.4
10 months ago
1.0.0
1 year ago
2.3.0
1 year ago
2.2.1
1 year ago
2.2.0
1 year ago
2.5.0
1 year ago
2.4.0
1 year ago
2.5.1
1 year ago
2.0.0-beta.1
1 year ago
2.1.0
1 year ago
2.0.0
1 year ago
1.0.0-alpha.2
1 year ago
1.0.0-alpha.0
1 year ago