Fast, reliable, and secure dependency management.
Yarn is a modern package manager split into various packages. Its novel architecture allows to do things currently impossible with existing solutions:
- Yarn supports plugins; adding a plugin is as simple as adding it into your repository
- Yarn supports Node by default but isn't limited to it - plugins can add support for other languages
- Yarn supports workspaces natively, and its CLI takes advantage of that
- Yarn uses a portable shell to execute package scripts, guaranteeing they work the same way on Windows and Linux
- Yarn is first and foremost a Node API that can be used programmatically (via @yarnpkg/core)
- Yarn is written in TypeScript, and is fully type checked
Consult the dedicated page for more details.
The documentation is being reworked to contain an updated content and a refreshed design, and the most up-to-date version can be found on the repository GitHub pages: yarnpkg.com
On top of our classic integration tests, we also run Yarn every day against the latest versions of the toolchains used by our community - just in case, really. Everything should be green!
Toolchains | Tooling |
---|---|
Clone this repository, then run the following commands:
yarn build:cli
How it works
After building the CLI your global yarn
will immediately start to reflect your local changes. This is because Yarn will pick up the yarnPath
settings in this repository's .yarnrc.yml
, which is configured to use the newly built CLI if available.
Works out of the box!
Note that no other command is needed! Given that our dependencies are checked-in within the repository (within the .yarn/cache
directory), you don't even need to run yarn install
. Everything just works right after cloning the project, and is guaranteed to continue to work ten years from now ๐
Those plugins typically come bundled with Yarn. You don't need to do anything special to use them.
- โ
plugin-constraints adds support for
yarn constraints [--fix]
. - โ
plugin-dlx adds support for the
yarn dlx
command. - โ plugin-essentials adds various commands deemed necessary for a package manager (add, remove, ...).
- โ
plugin-file adds support for using the
file:
protocol within your dependencies. - โ plugin-github adds support for using GitHub references as dependencies. This plugin doesn't use git.
- โ plugin-http adds support for using straight URL references as dependencies (tgz archives only).
- โ
plugin-init adds support for the
yarn init
command. - โ
plugin-link adds support for using
link:
andportal:
references as dependencies. - โ plugin-npm adds support for using semver ranges as dependencies, resolving them to an NPM-like registry.
- โ
plugin-npm-cli adds support for the NPM-specific commands (
yarn npm info
,yarn npm login
,yarn npm publish
, ...). - โ
plugin-pack adds support for the
yarn pack
command. - โ plugin-pnp adds support for installing Javascript dependencies through the Plug'n'Play specification.
Although developed on the same repository as Yarn itself, those plugins are optional and need to be explicitly installed through yarn plugin import @yarnpkg/<plugin-name>
.
- โ plugin-exec adds support for using the
exec:
protocol within your dependencies. - โ plugin-stage adds support for the
yarn stage
command. - โ plugin-typescript improves the user experience when working with TypeScript.
- โ plugin-workspace-tools adds support for the
yarn workspaces foreach
command.
Plugins can be developed by third-party entities. To use them within your applications, just specify the full plugin URL when calling yarn plugin import
. Note that plugins aren't fetched from the npm registry at this time - they must be distributed as a single JavaScript file.
To create your own plugin, please refer to the documentation.
The following packages are generic and can be used in a variety of purposes (including to implement other package managers, but not only):
- @yarnpkg/core allows any application to manipulate a project programmatically.
- @yarnpkg/fslib is a set of tools to abstract the filesystem through type-safe primitives.
- @yarnpkg/json-proxy allows to temporarily convert any POD object to an immutable object.
- @yarnpkg/libzip contains zlib+libzip bindings compiled to WebAssembly.
- @yarnpkg/parsers can be used to parse the language used by @yarnpkg/shell.
- @yarnpkg/pnp can be used to generate Plug'n'Play-compatible hooks.
- @yarnpkg/pnpify is a CLI tool to transparently add PnP support to various tools.
- @yarnpkg/shell is a portable bash-like shell interpreter.
The following packages are meant to be used by Yarn itself, and probably won't be useful to other applications:
- @yarnpkg/builder contains a CLI tool to package berry and its plugins.
- @yarnpkg/cli is a CLI entry point built on top of @yarnpkg/core.