Skip to content

Commit

Permalink
change(create-next-app): Get-pkg-manager logic change. (vercel#50372)
Browse files Browse the repository at this point in the history
Simplified Get-pkg-manager logic.

---------

Co-authored-by: Steven <steven@ceriously.com>
  • Loading branch information
2 people authored and hydRAnger committed Jun 12, 2023
1 parent 06e2340 commit 7e4d2ce
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions packages/create-next-app/helpers/get-pkg-manager.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
export type PackageManager = 'npm' | 'pnpm' | 'yarn'

export function getPkgManager(): PackageManager {
const userAgent = process.env.npm_config_user_agent
const userAgent = process.env.npm_config_user_agent || ''

if (userAgent) {
if (userAgent.startsWith('yarn')) {
return 'yarn'
} else if (userAgent.startsWith('pnpm')) {
return 'pnpm'
} else {
return 'npm'
}
} else {
return 'npm'
if (userAgent.startsWith('yarn')) {
return 'yarn'
}

if (userAgent.startsWith('pnpm')) {
return 'pnpm'
}

return 'npm'
}

0 comments on commit 7e4d2ce

Please sign in to comment.