Detects which package manager (bun, pnpm, yarn, npm) is used.

Overview

@skarab/detect-package-manager

Detects which package manager (bun, pnpm, yarn, npm) is used based on the current working directory.

Features

  • Support packageManager field in package.json.
  • Detect PM agent version from lock file name, format or version.
  • No dependency, fully typed and well tested!

TODO

  • Resolve external lock file such as lockfile-directory in .npmrc (PR welcome).

Installation

pnpm add @skarab/detect-package-manager

Usage

Detect the PM agent from the current working directory.

import { detectAgent } from '@skarab/detect-package-manager';

const agent = await detectAgent();

console.log(agent); // { name: 'pnpm', version: '7.6.0' }

Detect the PM agent from a provided directory.

import { detectAgent } from '@skarab/detect-package-manager';

const agent = await detectAgent('path/to/yarn/project');

console.log(agent); // { name: 'yarn', version: '1.22.17' }

Detect all installed and known agents.

import { detectInstalledAgents } from '@skarab/detect-package-manager';

const agents = await api.detectInstalledAgents();

console.log(agents.has('pnpm')); // true

// agents === Map(3) {
//   'pnpm' => { name: 'pnpm', version: '7.6.0' },
//   'yarn' => { name: 'yarn', version: '1.22.17' },
//   'npm' => { name: 'npm', version: '8.13.2' }
// }

Known agents

  • bun Bun is a fast all-in-one JavaScript runtime.
  • pnpm Fast, disk space efficient package manager.
  • yarn Yarn is a package manager that doubles down as project manager.
  • npm A JavaScript package manager.

Related


Scaffolded with @skarab/skaffold

You might also like...

Deduplication tool for pnpm-lock.yaml files

pnpm-deduplicate Remove duplicate dependencies from pnpm-lock.yaml. This project is simple and not have many features. I see it as a temporary solutio

Jan 3, 2023

Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.

Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.

Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser. Read this file in Portuguese-BR here Our Website is outd

Jan 3, 2023

High performance and SEO friendly lazy loader for images (responsive and normal), iframes and more, that detects any visibility changes triggered through user interaction, CSS or JavaScript without configuration.

lazysizes lazysizes is a fast (jank-free), SEO-friendly and self-initializing lazyloader for images (including responsive images picture/srcset), ifra

Jan 1, 2023

Turborepo starter with pnpm

Turborepo starter with pnpm This is an official starter turborepo. What's inside? This turborepo uses pnpm as a packages manager. It includes the foll

Dec 18, 2022

Remix TypeScript monorepo with Turborepo pipelines, Prisma, PostgreSQL, Docker deploy to Fly.io, pnpm, TailwindCSS and Tsyringe for DI.

Remix TypeScript monorepo with Turborepo pipelines, Prisma, PostgreSQL, Docker deploy to Fly.io, pnpm, TailwindCSS and Tsyringe for DI.

Remix template with Turborepo, TypeScript and pnpm. The remix app deploys to fly.io or build to Docker image. Example packages for Database with prisma, Tsyringe dependency injection, UI, and internal TypeScript packages.

Dec 29, 2022

Nuxt.js 3 x Histoire x Vitest x VitePress x Turbo (pnpm)

Turborepo nuxt starter This is a monorepo with Nuxt, Histoire, Vitest & VitePress as a starter for any project that can be easily extended. You can al

Dec 19, 2022

This package will help parse OData strings (only the Microsoft Dataverse subset). It can be used as a validator, or you can build some javascript library which consumes the output of this library.

@albanian-xrm/dataverse-odata This package will help parse OData strings (only the Microsoft Dataverse subset). It can be used as a validator, or you

Oct 22, 2022

Meogic-tab-manager is an extensible, headless JavaScript tab manager framework.

Meogic-tab-manager is an extensible, headless JavaScript tab manager framework.

MeogicTabManager English document MeogicTabManager是一个有可拓展性的、headless的JavaScript标签页管理框架。 MeogicTabManager旨在提供可自由组装页面框架、自定义页面组件、甚至覆盖框架自带事件响应的开发体验。 Meogi

Oct 8, 2022
Releases(v1.0.0)
Owner
In JavaScript We Trust // Mangeur de code
null
VS Code Extension for pnpm, pnpm workspace and more.

pnpm-vscode-helper VS Code Extension for better DX with pnpm. Quick Start Type Ctrl(Command) + Shift + P to open workbench commands input. Type ext in

LinbuduLab 21 Dec 10, 2022
Detect npm packages by author name in your package-lock.json or yarn.lock.

detect-package-by-author Detect npm packages by author name in your package-lock.json or yarn.lock. Install Install with npm: # Not Yet Publish # npm

azu 2 Jan 11, 2022
Package fetcher is a bot messenger which gather npm packages by uploading either a json file (package.json) or a picture representing package.json. To continue...

package-fetcher Ce projet contient un boilerplate pour un bot messenger et l'executable Windows ngrok qui va permettre de créer un tunnel https pour c

AILI Fida Aliotti Christino 2 Mar 29, 2022
Bys is an npm/yarn library to merge your js and ts files into one file.

Bundle your scripts (bys) Bys is an npm/yarn library to merge your js and ts files into one file. Installation Use the npm or yarn package manager to

FlamesX128 3 Dec 8, 2022
Bun-Bakery is a web framework for Bun. It uses a file based router in style like svelte-kit. No need to define routes during runtime.

Bun Bakery Bun-Bakery is a web framework for Bun. It uses a file based router in style like svelte-kit. No need to define routes during runtime. Quick

Dennis Dudek 44 Dec 6, 2022
Fast, Bun-powered, and Bun-only(for now) Web API framework with full Typescript support.

Zarf Fast, Bun-powered, and Bun-only(for now) Web API framework with full Typescript support. Quickstart Starting with Zarf is as simple as instantiat

Zarf Framework 65 Dec 28, 2022
npm i uuid, npm i nodemon, npm i commander

goit-nodejs-hw-01 Получаем и выводим весь список контактов в виде таблицы (console.table) node index.js --action list Получаем контакт по id node inde

Oksana Banshchykova 3 Jul 5, 2022
A devtool improve your pakage manager use experience no more care about what package manager is this repo use; one line, try all.

pi A devtool improve your pakage manager use experience no more care about what package manager is this repo use; one line, try all. Stargazers over t

tick 11 Nov 1, 2022
An npm package for demonstration purposes using TypeScript to build for both the ECMAScript Module format (i.e. ESM or ES Module) and CommonJS Module format. It can be used in Node.js and browser applications.

An npm package for demonstration purposes using TypeScript to build for both the ECMAScript Module format (i.e. ESM or ES Module) and CommonJS Module format. It can be used in Node.js and browser applications.

Snyk Labs 57 Dec 28, 2022
📷 Detects your face and adds filters from your webcam. You can capture and download images.

Snapchat Filters on WebCam ?? Detects your face and adds filters from your webcam. You can capture and download images. ?? Visit site ?? Screenshots ?

Orhan Emre Dikicigil 2 Apr 27, 2022