Skip to content

Commit

Permalink
docs: update WIP section of README
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored Aug 14, 2024
1 parent a679fca commit 453c5b9
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,31 @@ const { detect } = require('package-manager-detector')
## Agents and Commands

This package includes package manager agents and their corresponding commands for:
- install dependencies
- install dependencies using frozen lockfile
- add dependencies
- remove dependencies
- install global packages
- remove global packages
- upgrade dependencies
- upgrade dependencies interactively: not available for `npm` and `bun`
- download & execute binary scripts
- run `package.json` scripts
- `'agent'` - run the package manager with no arguments
- `'install'` - install dependencies
- `'frozen'` - install dependencies using frozen lockfile
- `'add'` - add dependencies
- `'uninstall'` - remove dependencies
- `'global'` - install global packages
- `'global_uninstall'` - remove global packages
- `'upgrade'` - upgrade dependencies
- `'upgrade-interactive'` - upgrade dependencies interactively: not available for `npm` and `bun`
- `'execute'` - download & execute binary scripts
- `'run'` - run `package.json` scripts

### Using Agents and Commands

WIP
A `COMMANDS` map is exported which lets you get a command from the above list for the detected agent. For example:
```
import { detect } from 'package-manager-detector'
import { COMMANDS } from 'package-manager-detector/agents'
const pm = await detect()
if (!pm) throw new Error('Could not detect package manager')
const command = COMMANDS[pm.agent]['frozen']
console.log(`Detected the ${pm.agent} package manager. You can run a frozen install with ${command}`);
```

## License

Expand Down

0 comments on commit 453c5b9

Please sign in to comment.