3.2.0 • Published 9 months ago

what-pm v3.2.0

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

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:
ParamDescriptionTypeOptional valueRequiredDefault value
pkgPathpackage pathstring-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

3.0.0-beta.3

11 months ago

3.0.0-beta.2

11 months ago

3.0.0-beta.5

10 months ago

3.0.0-beta.4

10 months ago

3.2.0

9 months ago

3.1.1

10 months ago

3.1.0

10 months ago

3.0.0

10 months ago

1.0.1

1 year ago

1.0.0

1 year ago

1.0.0-alpha.8

1 year ago

2.3.0

1 year ago

2.2.1

1 year ago

1.0.0-alpha.7

1 year ago

2.2.0

1 year ago

1.0.0-alpha.6

1 year ago

2.5.0

1 year ago

2.4.0

1 year ago

1.0.0-alpha.4

1 year ago

2.5.1

1 year ago

2.0.0

1 year ago

1.0.0-alpha.3

1 year ago

1.0.0-alpha.2

1 year ago

1.1.0

1 year ago

1.0.0-alpha.0

1 year ago