yarn-api

1.1.0 • Public • Published

yarn-api NPM version NPM monthly downloads NPM total downloads Linux Build Status

Basic API for yarn.

Install

Install with npm:

$ npm install --save yarn-api

Install with yarn:

$ yarn add yarn-api

Usage

var yarn = require('yarn-api');
 
yarn(['why', 'isobject'], function(err) {
  if (err) throw err;
});

API

yarn

Run yarn with the given cmds, args and callback.

Params

  • cmds {String|Array}
  • args {String|Array}
  • cb {Function}: Callback

Example

yarn(['add', 'isobject'], function(err) {
  if (err) throw err;
});
.link

.link

Symlink the current project to global node_modules. Visit the yarn docs for link.

Params

  • cb {Function}: Callback

Example

yarn.link(function(err) {
  if (err) throw err;
});
.unlink

.unlink

Unlink a previously created symlink for a package. Visit the yarn docs for unlink.

Params

  • cb {Function}: Callback

Example

yarn.unlink(function(err) {
  if (err) throw err;
});
.add

.add

Installs one or more packages and any packages they depend on.

Visit the yarn docs for add.

Params

  • names {String|Array}: package names
  • cb {Function}: Callback

Example

yarn.add('isobject', function(err) {
  if (err) throw err;
});
.global

.global

Execute yarn add --global with one or more package names.

Params

  • names {String|Array}: One or more package names to install
  • cb {Function}: Callback

Example

yarn.global('mocha', function(err) {
  if (err) throw err;
});
.install

.install

Install all dependencies for a project. This is most commonly used when you have just checked out code for a project, or when another developer on the project has added a new dependency that you need to pick up.

Visit the yarn docs for install.

Params

  • cb {Function}: Callback

Example

yarn.install(function(err) {
  if (err) throw err;
});
.outdated

.outdated

Checks for outdated package dependencies.

Visit the yarn docs for outdated

Params

  • names {String|Array}: package names
  • cb {Function}: Callback

Example

yarn.outdated('isobject', function(err) {
  if (err) throw err;
});
.upgrade

.upgrade

Updates all dependencies to their latest version based on the version range specified in the package.json file. The yarn.lock file will be (re)created as well.

Visit the yarn docs for upgrade.

Params

  • cb {Function}: Callback

Example

yarn.upgrade(function(err) {
  if (err) throw err;
});
.remove

.remove

Remove a package from your direct dependencies, updating your package.json and yarn.lock files in the process.

Visit the yarn docs for remove.

Params

  • args {Function}
  • cb {Function}: Callback

Example

yarn.remove('isobject', function(err) {
  if (err) throw err;
});
.why

.why

Show information about why a package is installed.

Visit the yarn docs for why.

Params

  • args {Function}
  • cb {Function}: Callback

Example

yarn.why('isobject', function(err) {
  if (err) throw err;
});
.dependencies

.dependencies

Execute yarn add with one or more package names. Updates dependencies in package.json.

Params

  • names {String|Array}: One or more package names to install
  • cb {Function}: Callback

Example

yarn.dependencies('micromatch', function(err) {
  if (err) throw err;
});
.devDependencies

.devDependencies

Execute yarn add --dev with one or more package names. Updates devDependencies in package.json.

Params

  • names {String|Array}: One or more package names to install
  • cb {Function}: Callback

Example

// defined as a string
yarn.devDependencies('micromatch', function(err) {
  if (err) throw err;
});
 
// or as an array
yarn.devDependencies(['micromatch', 'is-glob'], function(err) {
  if (err) throw err;
});
.peerDependencies

.peerDependencies

Execute yarn add --peer with one or more package names. Updates peerDependencies in package.json.

Params

  • names {String|Array}: One or more package names to install
  • cb {Function}: Callback

Example

yarn.peerDependencies('isobject', function(err) {
  if (err) throw err;
});
.optionalDependencies

.optionalDependencies

Execute yarn add --optional with one or more package names. Updates optionalDependencies in package.json.

Params

  • names {String|Array}: One or more package names to install
  • cb {Function}: Callback

Example

yarn.optionalDependencies('isobject', function(err) {
  if (err) throw err;
});

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Please read the contributing guide for advice on opening issues, pull requests, and coding standards.

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on April 27, 2017.

Readme

Keywords

Package Sidebar

Install

npm i yarn-api

Weekly Downloads

7

Version

1.1.0

License

MIT

Last publish

Collaborators

  • jonschlinkert