mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
fix package manager detection
This commit is contained in:
16
apps/cli/src/utils/get-package-manager.ts
Normal file
16
apps/cli/src/utils/get-package-manager.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export type PackageManager = "npm" | "pnpm" | "yarn" | "bun";
|
||||
|
||||
export const getUserPkgManager: () => PackageManager = () => {
|
||||
const userAgent = process.env.npm_config_user_agent;
|
||||
|
||||
if (userAgent?.startsWith("yarn")) {
|
||||
return "yarn";
|
||||
}
|
||||
if (userAgent?.startsWith("pnpm")) {
|
||||
return "pnpm";
|
||||
}
|
||||
if (userAgent?.startsWith("bun")) {
|
||||
return "bun";
|
||||
}
|
||||
return "npm";
|
||||
};
|
||||
Reference in New Issue
Block a user