
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Asynchronous library with built-in caching to identify available package managers
Asynchronous library with built-in caching to identify available package managers.
npm, yarn, pnpm and bun.npm install pubun
Pubun offers several import options - default import, or named import.
// default import
import pubun from 'pubun';
// or named import. Recommended!
import { defineManager, defineGlobalManagers } from 'pubun';
import { defineManager } from 'pubun';
async function demoFunction() {
const packageManager = await defineManager('/path/to/project');
console.log(packageManager); // npm | yarn | pnpm | bun
}
demoFunction();
import { defineGlobalManagers } from 'pubun';
async function demoFunction() {
const globalManagers = await defineGlobalManagers();
console.log(globalManagers);
// [
// {
// manager: 'pnpm';
// version: '8.11.0';
// },
// {
// manager: 'bun';
// version: '1.0.14';
// },
// ...
// ]
}
demoFunction();
Since all Pubun operations are cached in order to optimize speed, sometimes you may need to clear the cache manually.
import { clearCache } from 'pubun';
clearCache();
Defines the package manager used in a given directory.
Checks for the presence of characteristic files (e.g., package-lock.json for npm) for each known package manager.
Supported package managers: npm, yarn, pnpm, bun
type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';
defineManager: (path?: string) => Promise<PackageManager | null>;
| Argument | Type | Default value | Description |
|---|---|---|---|
path | string | process.cwd() | The path to the directory to check. If not provided, defaults to the current working directory. |
Return: A promise that resolves to the type of package manager used or null if no package manager can be defined.
interface GlobalManagerData {
manager: PackageManager;
version: string;
}
defineGlobalManagers: () => Promise<GlobalManagerData[] | null>;
Return: A promise that resolves to an array of global manager data, including the name and version of each installed package manager, or null if none is installed.
Clears the entire cache.
This function removes all cached data related to package manager checks.
Useful for resetting the state to ensure fresh data is fetched.
clearCache: () => void
FAQs
Asynchronous library with built-in caching to identify available package managers
The npm package pubun receives a total of 29 weekly downloads. As such, pubun popularity was classified as not popular.
We found that pubun demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.