@node-kit/lerna-workspace-root
TypeScript icon, indicating that this package has built-in type declarations

3.3.1 • Public • Published

@node-kit/lerna-workspace-root

A simple utility to get the lerna workspace root

NPM version Codacy Badge Test coverage npm download License

Sonar

Install

# use pnpm
$ pnpm install -D @node-kit/lerna-workspace-root

# use yarn
$ yarn add -D @node-kit/lerna-workspace-root

# use npm
$ npm install -D @node-kit/lerna-workspace-root

Usage

use import

import { lernaWorkspaceRoot, lernaWorkspaceRootSync } from '@node-kit/lerna-workspace-root'

lernaWorkspaceRoot()
// or
lernaWorkspaceRootSync()

use require

const { lernaWorkspaceRoot, lernaWorkspaceRootSync } = require('@node-kit/lerna-workspace-root')

lernaWorkspaceRoot()
// or
lernaWorkspaceRootSync()

API reference

  • Usage: lernaWorkspaceRoot(cwd) & lernaWorkspaceRootSync(cwd)
  • Parameters:
Param Description Type Optional value Required Default value
cwd running path string - false -
  • Types:
declare function lernaWorkspaceRoot(cwd?: string): Promise<string | null>

declare function lernaWorkspaceRootSync(cwd?: string): string | null
  • Demos:
  1. simple use
import { lernaWorkspaceRoot, lernaWorkspaceRootSync } from '@node-kit/lerna-workspace-root'

lernaWorkspaceRoot().then(path => {
  console.log('The lerna workspace root is: ', path) // /Users/user/path/of/package/root or null
})
console.log('The lerna workspace root is: ', lernaWorkspaceRootSync()) // /Users/user/path/of/package/root or null

Issues & Support

Please open an issue here.

License

MIT

Package Sidebar

Install

npm i @node-kit/lerna-workspace-root

Weekly Downloads

7,284

Version

3.3.1

License

MIT

Unpacked Size

11.2 kB

Total Files

7

Last publish

Collaborators

  • saqqdy