3.2.0 • Published 9 months ago

@node-kit/which-pm v3.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@node-kit/which-pm

A simple utility to get which package manager used in the project

NPM version Codacy Badge Test coverage npm download License

Sonar

Install

# use pnpm
$ pnpm install -D @node-kit/which-pm

# use yarn
$ yarn add -D @node-kit/which-pm

# use npm
$ npm install -D @node-kit/which-pm

Usage

use @node-kit/which-pm in terminal

npx which-pm

# output: pnpm@7.26.1 | null

use import

import { whichPM, whichPMSync } from '@node-kit/which-pm'

whichPM()
// or
whichPMSync()

use require

const { whichPM, whichPMSync } = require('@node-kit/which-pm')

whichPM()
// or
whichPMSync()

API reference

  • Usage: whichPM([cwd, withVersion]) & whichPMSync([cwd, withVersion])
  • Parameters:
ParamDescriptionTypeOptional valueRequiredDefault value
cwdrunning pathstring-false-
withVersionreturn with versionboolean-falsetrue
  • Types:
declare function whichPM(cwd?: string, withVersion?: boolean): Promise<string | null>

declare function whichPMSync(cwd?: string, withVersion?: boolean): string | null
  • Demos:
  1. simple use
import { whichPM, whichPMSync } from '@node-kit/which-pm'

whichPM().then(path => {
  console.log('The package manager is: ', path) // pnpm@7.26.1 | null
})

console.log('The package manager is: ', whichPMSync()) // pnpm@7.26.1 | null

Issues & Support

Please open an issue here.

License

MIT

3.0.0-beta.3

11 months ago

3.0.0-beta.2

11 months ago

3.0.0-beta.5

11 months ago

3.0.0-beta.4

11 months ago

3.2.0

9 months ago

3.1.1

11 months ago

3.1.0

11 months ago

3.0.0

11 months ago

2.3.0

1 year ago

2.5.0

1 year ago

2.4.0

1 year ago

2.5.1

1 year ago

2.2.1

1 year ago

2.2.0

1 year ago

2.0.0-beta.1

1 year ago

2.1.0

1 year ago

2.0.0

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.3.0-beta.1

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.0-alpha.8

1 year ago

1.0.0-alpha.7

1 year ago

1.0.0-alpha.6

1 year ago

1.0.0-alpha.4

1 year ago

1.0.0-alpha.3

1 year ago

1.0.0-alpha.2

1 year ago