1.0.6 • Published 16 days ago

pmex v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
16 days ago

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')
1.0.6

16 days ago

1.0.5

16 days ago

1.0.2

1 month ago

1.0.4

1 month ago

1.0.0

3 months ago

0.0.35

9 months ago

0.0.34

10 months ago

0.0.33

10 months ago

0.0.32

10 months ago

0.0.31

10 months ago

0.0.30

10 months ago

0.0.3

10 months ago

0.0.26

11 months ago

0.0.25

11 months ago

0.0.24

11 months ago

0.0.23

11 months ago

0.0.22

11 months ago

0.0.21

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago