MCPcopy
hub / github.com/vercel/next.js / getPkgManager

Function getPkgManager

packages/create-next-app/helpers/get-pkg-manager.ts:5–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3export type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun'
4
5export function getPkgManager(): PackageManager {
6 const userAgent = process.env.npm_config_user_agent || ''
7
8 if (userAgent.startsWith('yarn')) {
9 return 'yarn'
10 }
11
12 if (userAgent.startsWith('pnpm')) {
13 return 'pnpm'
14 }
15
16 if (userAgent.startsWith('bun')) {
17 return 'bun'
18 }
19
20 return 'npm'
21}
22
23/**
24 * Get the major version of pnpm being used.

Callers 1

index.tsFile · 0.90

Calls 1

startsWithMethod · 0.80

Tested by

no test coverage detected