mirror of
https://github.com/Instadapp/Swap-Aggregator-Subgraph.git
synced 2024-07-29 21:57:12 +00:00
43 lines
770 B
Markdown
43 lines
770 B
Markdown
Provides an API for intelligently running commands in yarn or npm depending on which is installed.
|
|
|
|
## hasYarn
|
|
|
|
Whether the current system has yarn installed
|
|
|
|
```js
|
|
toolbox.packageManager.hasYarn() // true
|
|
```
|
|
|
|
## add (async)
|
|
|
|
Adds a package using yarn or npm
|
|
|
|
```js
|
|
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:
|
|
|
|
```js
|
|
{
|
|
success: true,
|
|
command: 'npm install --save-dev infinite_red',
|
|
stdout: ''
|
|
}
|
|
```
|
|
|
|
## remove (async)
|
|
|
|
Removes a package using yarn or npm
|
|
|
|
```js
|
|
await toolbox.packageManager.remove('infinite_red', {
|
|
dryRun: false,
|
|
force: 'npm', //remove this to have the system determine which
|
|
})
|
|
```
|