Swap-Aggregator-Subgraph/node_modules/gluegun/docs/toolbox-package-manager.md
Richa-iitr d211083153 Revert "Revert "added handler""
This reverts commit c36ee8c5ca.
2022-07-03 07:30:05 +05:30

770 B

Provides an API for intelligently running commands in yarn or npm depending on which is installed.

hasYarn

Whether the current system has yarn installed

toolbox.packageManager.hasYarn() // true

add (async)

Adds a package using yarn or npm

await toolbox.packageManager.add('infinite_red', {
  dev: true,
  dryRun: false,
  force: 'npm', //remove this to have the system determine which
})

Will return an object similar to the following:

{
  success: true,
  command: 'npm install --save-dev infinite_red',
  stdout: ''
}

remove (async)

Removes a package using yarn or npm

await toolbox.packageManager.remove('infinite_red', {
  dryRun: false,
  force: 'npm', //remove this to have the system determine which
})