@node-kit/which-pm
v3.2.0
Published
A simple utility to get which package manager used in the project
Downloads
43
Maintainers
Readme
@node-kit/which-pm
A simple utility to get which package manager used in the project
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: [email protected] | 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:
| Param | Description | Type | Optional value | Required | Default value |
| ----------- | ------------------- | --------- | -------------- | -------- | ------------- |
| cwd | running path | string
| - | false
| - |
| withVersion | return with version | boolean
| - | false
| true
|
- Types:
declare function whichPM(cwd?: string, withVersion?: boolean): Promise<string | null>
declare function whichPMSync(cwd?: string, withVersion?: boolean): string | null
- Demos:
- simple use
import { whichPM, whichPMSync } from '@node-kit/which-pm'
whichPM().then(path => {
console.log('The package manager is: ', path) // [email protected] | null
})
console.log('The package manager is: ', whichPMSync()) // [email protected] | null
Issues & Support
Please open an issue here.