pmex v1.0.6
Package Manager Execute
Dynamically selects NPM or YARN or PNPM or BUN to execute commands. NPX is also supported.
API
pmex [...command]
Examples
CLI
This example runs npm install
or yarn install
or pnpm install
or bun install
based on how you run the command.
pmex install // uses OS default's package manager (probably npm)
pmex npm install
pmex yarn install
pmex pnpm install
pmex bun install
Scripts
This example runs npm install
or yarn install
or pnpm install
or bun install
based on what you used in the terminal: yarn start
or npm start
or pnpm start
or bun start
.
{
"scripts": {
"prestart": "pmex install",
"start": "node server.js"
}
}
Runtime
This example runs commands based on what you used to run the file.
import pmex from 'pmex';
// Different command based on package manager
pmex({
npm: 'cache clean --force',
yarn: 'cache clean --all',
pnpm: 'store prune',
bun: 'bun pm cache rm -g'
})
pmex('test')
pmex('npx tsc --noEmit')
pmex('build')
Override
You can force the use of a package manager. This example runs npm install
for all package managers and then runs tsc
with automatic detection of the package manager.
import pmex from 'pmex';
pmex('npm install -g tsc')
pmex('tsc --noEmit')
16 days ago
16 days ago
1 month ago
1 month ago
3 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago