1.0.5 • Published 1 year ago

local-package-manager v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Install

npm install -D local-package-manager

Usage

Get the user package manager

works with yarn, npm, and pnpm

import { getPackageManager } from 'local-package-manager';

const packageManager = await getPackageManager();
console.log(packageManager);
//=> {name: 'npm', version: '8.11.0'}

Translate a command to the package manager of user

import { getCommand } from 'local-package-manager';

const npxCommand = await getCommand('npx');
console.log(`try running: ${npxCommand} some-lib --example
`);

/* if user using pnpm */
//=> try running: pnpm exec some-lib --example

/* if user using yarn */
//=> try running: yarn some-lib --example

/* if user using pnpm */
//=> try running: npx some-lib --example

Maintainers

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago