MCPcopy
hub / github.com/t3-oss/create-t3-app / getUserPkgManager

Function getUserPkgManager

src/utils/getUserPkgManager.ts:3–11  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1export type PackageManager = "npm" | "pnpm" | "yarn";
2
3export const getUserPkgManager: () => PackageManager = () => {
4 // This environment variable is set by npm and yarn but pnpm seems less consistent
5 const userAgent = process.env.npm_config_user_agent;
6
7 if (userAgent?.startsWith("yarn")) return "yarn";
8 if (userAgent?.startsWith("pnpm")) return "pnpm";
9
10 return "npm";
11};

Callers 4

renderTitleFunction · 0.85
createProjectFunction · 0.85
logNextStepsFunction · 0.85
runCliFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected