@strapi/strapi
Version:
An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite
28 lines (25 loc) • 831 B
JavaScript
;
/**
* @description Supports the following managers:
* – npm
* – yarn
* – pnpm
*/ const getPackageManager = ()=>{
// Yes, the env var is lowercase - it is set by the package managers themselves
const agent = process.env.npm_config_user_agent || '';
if (agent.includes('yarn')) {
return 'yarn';
}
if (agent.includes('pnpm')) {
return 'pnpm';
}
// Both yarn and pnpm does a `npm/?` thing, thus the slightly different match here
// Theoretically not needed since we check for yarn/pnpm above, but in case other
// package managers do the same thing, we'll (hopefully) catch them here.
if (/^npm\/\d/.test(agent)) {
return 'npm';
}
return undefined;
};
exports.getPackageManager = getPackageManager;
//# sourceMappingURL=managers.js.map