what-pm
TypeScript icon, indicating that this package has built-in type declarations

3.2.0 • Public • Published

what-pm

Detects what package manager was used for installation

NPM version Codacy Badge Test coverage npm download License

Sonar

Install

# use pnpm
$ pnpm install what-pm

# use yarn
$ yarn add what-pm

# use npm
$ npm install what-pm

Usage

use what-pm in terminal

npx what-pm
# or
npx whatpm

# output: pnpm

use import

import { whatPM, whatPMSync } from '@node-kit/what-pm'

whatPM()
// or
whatPMSync()

use require

const { whatPM, whatPMSync } = require('@node-kit/what-pm')

whatPM()
// or
whatPMSync()

API reference

  • Usage: whatPM(pkgPath) & whatPMSync(pkgPath)
  • Parameters:
Param Description Type Optional value Required Default value
pkgPath package path string - true -
  • Types:
declare function whatPM(pkgPath: string): Promise<WhatPMResult | null>

declare interface WhatPMResult {
  name: string
  version: string
  isWorkspace: boolean
}

declare function whatPMSync(pkgPath: string): WhatPMResult | null
  • Demos:
  1. simple use
import { whatPM, whatPMSync } from '@node-kit/what-pm'

whatPM().then(info => {
  console.log('The package manager is: ', info) // pnpm | null
})

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

Issues & Support

Please open an issue here.

License

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.0-alpha.80alpha
3.2.016latest
3.0.0-beta.50beta

Version History

VersionDownloads (Last 7 Days)Published
3.2.016
3.1.10
3.1.00
3.0.00
3.0.0-beta.50
3.0.0-beta.40
3.0.0-beta.30
3.0.0-beta.20
2.5.121
2.5.00
2.4.00
2.3.00
2.2.11
2.2.00
2.0.00
1.0.10
1.0.00
1.0.0-alpha.80
1.0.0-alpha.70
1.0.0-alpha.60
1.0.0-alpha.40
1.0.0-alpha.30
1.0.0-alpha.20
1.0.0-alpha.01

Package Sidebar

Install

npm i what-pm

Weekly Downloads

39

Version

3.2.0

License

MIT

Unpacked Size

14.1 kB

Total Files

8

Last publish

Collaborators

  • saqqdy