mirror of
https://github.com/strapi/strapi.git
synced 2025-07-14 12:32:35 +00:00
16 lines
320 B
TypeScript
16 lines
320 B
TypeScript
export type PackageManager = 'npm' | 'yarn' | 'pnpm';
|
|
|
|
export const detectPackageManager = (): PackageManager => {
|
|
const userAgent = process.env.npm_config_user_agent || '';
|
|
|
|
if (userAgent.startsWith('yarn')) {
|
|
return 'yarn';
|
|
}
|
|
|
|
if (userAgent.startsWith('pnpm')) {
|
|
return 'pnpm';
|
|
}
|
|
|
|
return 'npm';
|
|
};
|