yarn-install
If command yarn
exists it uses Yarn to install, otherwise fallbacks to npm.
Install
$ npm install --save yarn-install
Usage
const install = const result = //=> result, returned by child_process.spawnSync
CLI
yarn global add yarn-install # then you will have `yarn-install` & `yarn-remove` commands yarn-install pokemon --devyarn-install yo --globalyarn-remove xo# don't forget that `yarn-install` with dependencies is always `--save` by default. yarn-install helpyarn-remove help
API
install([options])
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.
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: boolean
Default: undefined
The reversed behavior to install
, ie. yarn remove
and npm uninstall
production
Type: boolean
Default: undefined
Only install dependencies
in package.json
.
respectNpm5
Type: boolean
Default: undefined
Use npm if it's >= npm5.
install.getPm([options])
Get the package manager that will be used to install.
options
respectNpm5
// Given you have yarn & npm 4 installedconst pm = install//=> yarn // Given you have yarn & npm 5 installedconst pm = install//=> yarn // Given you have yarn & npm 5 installedconst pm = install//=> npm
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D