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

3.3.0 • Public • Published

@node-kit/pnpm-workspace-root

A simple utility to get the pnpm workspace root

NPM version Codacy Badge Test coverage npm download License

Sonar

Install

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

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

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

Usage

use import

import { pnpmWorkspaceRoot, pnpmWorkspaceRootSync } from '@node-kit/pnpm-workspace-root'

pnpmWorkspaceRoot()
// or
pnpmWorkspaceRootSync()

use require

const { pnpmWorkspaceRoot, pnpmWorkspaceRootSync } = require('@node-kit/pnpm-workspace-root')

pnpmWorkspaceRoot()
// or
pnpmWorkspaceRootSync()

API reference

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

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

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

Issues & Support

Please open an issue here.

License

MIT

Package Sidebar

Install

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

Weekly Downloads

4,986

Version

3.3.0

License

MIT

Unpacked Size

12.5 kB

Total Files

7

Last publish

Collaborators

  • saqqdy