Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions packages/cli-kit/src/public/node/node-package-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,8 @@ export class FindUpAndReadPackageJsonNotFoundError extends BugError {
* @returns The dependency manager
*/
export function packageManagerFromUserAgent(env = process.env): PackageManager {
if (env.npm_config_user_agent?.includes('yarn')) {
return 'yarn'
} else if (env.npm_config_user_agent?.includes('pnpm')) {
return 'pnpm'
} else if (env.npm_config_user_agent?.includes('bun')) {
return 'bun'
} else if (env.npm_config_user_agent?.includes('npm')) {
return 'npm'
}
return 'unknown'
const userAgent = env.npm_config_user_agent
return (['yarn', 'pnpm', 'bun', 'npm'] as const).find((pm) => userAgent?.includes(pm)) ?? 'unknown'
}

function hasBunLockfileSync(directory: string): boolean {
Expand Down
Loading