detect-package-manager
Advanced tools
Comparing version 3.0.0 to 3.0.1
declare type PM = "npm" | "yarn" | "pnpm" | "bun"; | ||
declare const detect: ({ cwd }?: { | ||
declare const detect: ({ cwd, includeGlobalBun, }?: { | ||
cwd?: string | undefined; | ||
includeGlobalBun?: boolean | undefined; | ||
}) => Promise<PM>; | ||
@@ -5,0 +6,0 @@ |
@@ -80,3 +80,6 @@ var __create = Object.create; | ||
} | ||
var detect = async ({ cwd } = {}) => { | ||
var detect = async ({ | ||
cwd, | ||
includeGlobalBun | ||
} = {}) => { | ||
const type = await getTypeofLockFile(cwd); | ||
@@ -89,3 +92,3 @@ if (type) { | ||
hasGlobalInstallation("pnpm"), | ||
hasGlobalInstallation("bun") | ||
includeGlobalBun && hasGlobalInstallation("bun") | ||
]); | ||
@@ -92,0 +95,0 @@ if (hasYarn) { |
{ | ||
"name": "detect-package-manager", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Detect which package manager you're using (yarn or npm)", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -1,5 +0,4 @@ | ||
# detect-package-manager | ||
[![NPM version](https://img.shields.io/npm/v/detect-package-manager.svg?style=flat)](https://npmjs.com/package/detect-package-manager) [![NPM downloads](https://img.shields.io/npm/dm/detect-package-manager.svg?style=flat)](https://npmjs.com/package/detect-package-manager) [![CircleCI](https://circleci.com/gh/egoist/detect-package-manager/tree/master.svg?style=shield)](https://circleci.com/gh/egoist/detect-package-manager/tree/master) [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat)](https://github.com/egoist/donate) | ||
[![NPM version](https://img.shields.io/npm/v/detect-package-manager.svg?style=flat)](https://npmjs.com/package/detect-package-manager) [![NPM downloads](https://img.shields.io/npm/dm/detect-package-manager.svg?style=flat)](https://npmjs.com/package/detect-package-manager) [![CircleCI](https://circleci.com/gh/egoist/detect-package-manager/tree/master.svg?style=shield)](https://circleci.com/gh/egoist/detect-package-manager/tree/master) [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat)](https://github.com/egoist/donate) | ||
@@ -21,9 +20,8 @@ ## How does this work? | ||
```js | ||
const { detect } = require('detect-package-manager') | ||
const { detect } = require("detect-package-manager"); | ||
detect() | ||
.then(pm => { | ||
console.log(pm) | ||
//=> 'yarn', 'npm', or 'pnpm' | ||
}) | ||
detect().then((pm) => { | ||
console.log(pm); | ||
//=> 'yarn', 'npm', or 'pnpm', 'bun' | ||
}); | ||
``` | ||
@@ -37,5 +35,6 @@ | ||
- `opts.cwd`: `string` Optional, defaults to `.`, the directory to look up `yarn.lock`, `package-lock.json`, or `pnpm-lock.yaml`. | ||
- `opts.includeGlobalBun`: `boolean` Optional, defaults to `false`, whether to check if `bun` exists in PATH. | ||
- Returns: `Promise<PM>` | ||
It returns a Promise resolving the name of package manager, could be `npm`, `yarn`, or `pnpm`. | ||
It returns a Promise resolving the name of package manager, could be `npm`, `yarn`, or `pnpm`, `bun`. | ||
@@ -45,3 +44,3 @@ ### getNpmVersion([pm]) | ||
- Arguments: | ||
- `pm`: `string` Optional, defaults to `npm`, could be `npm`, `yarn`, or `pnpm` | ||
- `pm`: `string` Optional, defaults to `npm`, could be `npm`, `yarn`, or `pnpm`, `bun` | ||
- Returns: `Promise<string>` | ||
@@ -65,3 +64,2 @@ | ||
## Author | ||
@@ -72,2 +70,2 @@ | ||
> [github.com/egoist](https://github.com/egoist) · GitHub [@EGOIST](https://github.com/egoist) · Twitter [@_egoistlily](https://twitter.com/_egoistlily) | ||
> [github.com/egoist](https://github.com/egoist) · GitHub [@EGOIST](https://github.com/egoist) · Twitter [@\_egoistlily](https://twitter.com/_egoistlily) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10464
207
67