{"id":15653740,"url":"https://github.com/jonschlinkert/yarn-api","last_synced_at":"2025-04-30T21:51:19.140Z","repository":{"id":57403263,"uuid":"89559407","full_name":"jonschlinkert/yarn-api","owner":"jonschlinkert","description":"Basic API for yarn.","archived":false,"fork":false,"pushed_at":"2018-05-19T17:47:43.000Z","size":16,"stargazers_count":28,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T18:57:51.489Z","etag":null,"topics":["api","yarn"],"latest_commit_sha":null,"homepage":"https://github.com/jonschlinkert/yarn-api","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonschlinkert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-27T05:33:45.000Z","updated_at":"2021-09-28T07:51:39.000Z","dependencies_parsed_at":"2022-09-15T14:41:28.834Z","dependency_job_id":null,"html_url":"https://github.com/jonschlinkert/yarn-api","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fyarn-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fyarn-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fyarn-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fyarn-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonschlinkert","download_url":"https://codeload.github.com/jonschlinkert/yarn-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251789308,"owners_count":21644081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","yarn"],"created_at":"2024-10-03T12:46:50.802Z","updated_at":"2025-04-30T21:51:19.117Z","avatar_url":"https://github.com/jonschlinkert.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yarn-api [![NPM version](https://img.shields.io/npm/v/yarn-api.svg?style=flat)](https://www.npmjs.com/package/yarn-api) [![NPM monthly downloads](https://img.shields.io/npm/dm/yarn-api.svg?style=flat)](https://npmjs.org/package/yarn-api)  [![NPM total downloads](https://img.shields.io/npm/dt/yarn-api.svg?style=flat)](https://npmjs.org/package/yarn-api) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/yarn-api.svg?style=flat\u0026label=Travis)](https://travis-ci.org/jonschlinkert/yarn-api)\n\n\u003e Basic API for yarn.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save yarn-api\n```\n\nInstall with [yarn](https://yarnpkg.com):\n\n```sh\n$ yarn add yarn-api\n```\n\n## Usage\n\n```js\nvar yarn = require('yarn-api');\n\nyarn(['why', 'isobject'], function(err) {\n  if (err) throw err;\n});\n```\n\n## API\n\n### [yarn](index.js#L33)\n\nRun `yarn` with the given `cmds`, `args` and callback.\n\n**Params**\n\n* `cmds` **{String|Array}**\n* `args` **{String|Array}**\n* `cb` **{Function}**: Callback\n\n**Example**\n\n```js\nyarn(['add', 'isobject'], function(err) {\n  if (err) throw err;\n});\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e.link\u003c/strong\u003e\u003c/summary\u003e\n\n### [.link](index.js#L59)\n\nSymlink the current project to global `node_modules`. Visit the yarn docs for [link](https://yarnpkg.com/en/docs/cli/link).\n\n**Params**\n\n* `cb` **{Function}**: Callback\n\n**Example**\n\n```js\nyarn.link(function(err) {\n  if (err) throw err;\n});\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e.unlink\u003c/strong\u003e\u003c/summary\u003e\n\n### [.unlink](index.js#L76)\n\nUnlink a previously created symlink for a package. Visit the yarn docs for [unlink](https://yarnpkg.com/en/docs/cli/unlink).\n\n**Params**\n\n* `cb` **{Function}**: Callback\n\n**Example**\n\n```js\nyarn.unlink(function(err) {\n  if (err) throw err;\n});\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e.add\u003c/strong\u003e\u003c/summary\u003e\n\n### [.add](index.js#L95)\n\nInstalls one or more packages and any packages they depend on.\n\nVisit the yarn docs for [add](https://yarnpkg.com/en/docs/cli/add).\n\n**Params**\n\n* `names` **{String|Array}**: package names\n* `cb` **{Function}**: Callback\n\n**Example**\n\n```js\nyarn.add('isobject', function(err) {\n  if (err) throw err;\n});\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e.global\u003c/strong\u003e\u003c/summary\u003e\n\n### [.global](index.js#L113)\n\nExecute `yarn add --global` with one or more package `names`.\n\n**Params**\n\n* `names` **{String|Array}**: One or more package names to install\n* `cb` **{Function}**: Callback\n\n**Example**\n\n```js\nyarn.global('mocha', function(err) {\n  if (err) throw err;\n});\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e.install\u003c/strong\u003e\u003c/summary\u003e\n\n### [.install](index.js#L133)\n\nInstall 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.\n\nVisit the yarn docs for [install](https://yarnpkg.com/en/docs/cli/install).\n\n**Params**\n\n* `cb` **{Function}**: Callback\n\n**Example**\n\n```js\nyarn.install(function(err) {\n  if (err) throw err;\n});\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e.outdated\u003c/strong\u003e\u003c/summary\u003e\n\n### [.outdated](index.js#L152)\n\nChecks for outdated package dependencies.\n\nVisit the yarn docs for [outdated](https://yarnpkg.com/en/docs/cli/outdated)\n\n**Params**\n\n* `names` **{String|Array}**: package names\n* `cb` **{Function}**: Callback\n\n**Example**\n\n```js\nyarn.outdated('isobject', function(err) {\n  if (err) throw err;\n});\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e.upgrade\u003c/strong\u003e\u003c/summary\u003e\n\n### [.upgrade](index.js#L172)\n\nUpdates 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.\n\nVisit the yarn docs for [upgrade](https://yarnpkg.com/en/docs/cli/upgrade).\n\n**Params**\n\n* `cb` **{Function}**: Callback\n\n**Example**\n\n```js\nyarn.upgrade(function(err) {\n  if (err) throw err;\n});\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e.remove\u003c/strong\u003e\u003c/summary\u003e\n\n### [.remove](index.js#L192)\n\nRemove a package from your direct dependencies, updating your package.json and yarn.lock files in the process.\n\nVisit the yarn docs for [remove](https://yarnpkg.com/en/docs/cli/remove).\n\n**Params**\n\n* `args` **{Function}**\n* `cb` **{Function}**: Callback\n\n**Example**\n\n```js\nyarn.remove('isobject', function(err) {\n  if (err) throw err;\n});\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e.why\u003c/strong\u003e\u003c/summary\u003e\n\n### [.why](index.js#L211)\n\nShow information about why a package is installed.\n\nVisit the yarn docs for [why](https://yarnpkg.com/en/docs/cli/why).\n\n**Params**\n\n* `args` **{Function}**\n* `cb` **{Function}**: Callback\n\n**Example**\n\n```js\nyarn.why('isobject', function(err) {\n  if (err) throw err;\n});\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e.dependencies\u003c/strong\u003e\u003c/summary\u003e\n\n### [.dependencies](index.js#L229)\n\nExecute `yarn add` with one or more package `names`. Updates `dependencies` in package.json.\n\n**Params**\n\n* `names` **{String|Array}**: One or more package names to install\n* `cb` **{Function}**: Callback\n\n**Example**\n\n```js\nyarn.dependencies('micromatch', function(err) {\n  if (err) throw err;\n});\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e.devDependencies\u003c/strong\u003e\u003c/summary\u003e\n\n### [.devDependencies](index.js#L253)\n\nExecute `yarn add --dev` with one or more package `names`. Updates `devDependencies` in package.json.\n\n**Params**\n\n* `names` **{String|Array}**: One or more package names to install\n* `cb` **{Function}**: Callback\n\n**Example**\n\n```js\n// defined as a string\nyarn.devDependencies('micromatch', function(err) {\n  if (err) throw err;\n});\n\n// or as an array\nyarn.devDependencies(['micromatch', 'is-glob'], function(err) {\n  if (err) throw err;\n});\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e.peerDependencies\u003c/strong\u003e\u003c/summary\u003e\n\n### [.peerDependencies](index.js#L271)\n\nExecute `yarn add --peer` with one or more package `names`. Updates `peerDependencies` in package.json.\n\n**Params**\n\n* `names` **{String|Array}**: One or more package names to install\n* `cb` **{Function}**: Callback\n\n**Example**\n\n```js\nyarn.peerDependencies('isobject', function(err) {\n  if (err) throw err;\n});\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e.optionalDependencies\u003c/strong\u003e\u003c/summary\u003e\n\n### [.optionalDependencies](index.js#L289)\n\nExecute `yarn add --optional` with one or more package `names`. Updates `optionalDependencies` in package.json.\n\n**Params**\n\n* `names` **{String|Array}**: One or more package names to install\n* `cb` **{Function}**: Callback\n\n**Example**\n\n```js\nyarn.optionalDependencies('isobject', function(err) {\n  if (err) throw err;\n});\n```\n\n\u003c/details\u003e\n\n## About\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\nPlease read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.\n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n### Running tests\n\nRunning 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:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on April 27, 2017._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fyarn-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonschlinkert%2Fyarn-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fyarn-api/lists"}