Install dependencies using Yarn with npm fallback.
npm install yarn-installIf command yarn exists it uses Yarn to install, otherwise fallbacks to npm.
``bash`
$ npm install --save yarn-install
`js
const install = require('yarn-install')
const result = install({
deps: ['webpack', 'mocha']
})
//=> result, returned by child_process.spawnSync
`
`bash
yarn global add yarn-install
& yarn-remove commands with dependencies is always --save by default.yarn-install help
yarn-remove help
`
#### options
##### deps
Type: array
An array of dependencies to install, you can omit it to install dependencies in package.json. If dependencies is present, it defaults to --save mode.
`js`
install({
deps: ['ava', 'koa']
})
##### cwd
Type: string
The directory to run the command.
##### registry
Type: string
Specfic a custom npm registry to use.
##### dev
Type: boolean
Use --dev for Yarn and --save-dev for npm.
##### global
Type: boolean
Install globally, stands for npm --global or yarn global.
##### remove
Type: booleanundefined
Default:
The reversed behavior to install, ie. yarn remove and npm uninstall
##### production
Type: booleanundefined
Default:
Only install dependencies in package.json.
##### respectNpm5
Type: booleanundefined
Default:
Use npm if it's >= npm5.
Get the package manager that will be used to install.
#### options
##### respectNpm5
`js
// Given you have yarn & npm 4 installed
const pm = install.getPm()
//=> yarn
// Given you have yarn & npm 5 installed
const pm = install.getPm()
//=> yarn
// Given you have yarn & npm 5 installed
const pm = install.getPm({ respectNpm5: true })
//=> npm
`
1. Fork it!
2. Create your feature branch: git checkout -b my-new-featuregit commit -am 'Add some feature'
3. Commit your changes: git push origin my-new-feature`
4. Push to the branch:
5. Submit a pull request :D