Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

detect-package-manager

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detect-package-manager - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

3

dist/index.d.ts
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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc