Skip to content

Commit

Permalink
refactor(utils): remove unnecessary block (t3-oss#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandoxu authored Jul 25, 2022
1 parent 3ae011e commit 2f2cde8
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/utils/getUserPkgManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,8 @@ export const getUserPkgManager: () => PackageManager = () => {
// This environment variable is set by npm and yarn but pnpm seems less consistent
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 {
// If no user agent is set, assume npm
return "npm";
}
if (userAgent?.startsWith("yarn")) return "yarn";
if (userAgent?.startsWith("pnpm")) return "pnpm";

return "npm";
};

0 comments on commit 2f2cde8

Please sign in to comment.