UNPKG

bod

Version:
21 lines (20 loc) 768 B
import process from 'node:process'; import { color, printer } from './console.js'; import { program, select } from './core.js'; import { envinfo, spawn } from './os.js'; const PNPM_USER_AGENT_RE = /pnpm/; const YARN_USER_AGENT_RE = /yarn/; const BUN_USER_AGENT_RE = /bun/; function findPackageManager() { var _a; const userAgent = (_a = process.env.npm_config_user_agent) !== null && _a !== void 0 ? _a : ''; const packageManager = PNPM_USER_AGENT_RE.test(userAgent) ? 'pnpm' : YARN_USER_AGENT_RE.test(userAgent) ? 'yarn' : BUN_USER_AGENT_RE.test(userAgent) ? 'bun' : 'npm'; return packageManager; } export { color, envinfo, findPackageManager, printer, program, select, spawn };