package-manager-manager
Utilities for managing package managers.
package-manager-manager is a library aimed at providing information regarding the package manager currently being used in a given project.
It can be used in CLIs or similar projects which may at some point need to know and adapt their behavior based on the package manager currently used by the developer (e.g. A project scaffolding tool, a bundling tool, etc...).
Usage
To use the library first install it in your project, via:
npm i package-manager-manager
(or your package manager's equivalent)
Then simply import and use the getPackageManager()
function to get an object containing all the information you need regarding the package manager currently being used:
const packageManager = await getPackageManager();
console.log(packageManager.name);
console.log(packageManager.version);
Note
Note that this library comes with properly defined and documented typescript types, meaning that once you obtain the PackageManager
object you will be able to easily see what's available on it and get all necessary details directly in your IDE