Developer(s) | Maël Nison, Yarn core team |
---|---|
Initial release | 18 June 2016 [1] |
Stable release | |
Repository | |
Written in | TypeScript, JavaScript |
Platform | Cross-platform |
Type | Package manager |
License | BSD 2-Clause License |
Website | yarnpkg |
Yarn is one of the main JavaScript package managers, [3] [4] initially started in 2016 by Sebastian McKenzie of Meta (formerly Facebook) for the Node.js JavaScript runtime environment. An alternative to the npm package manager, Yarn was created as a collaboration of Facebook (now Meta), Exponent (now Expo.dev), Google, and Tilde (the company behind Ember.js) to solve consistency, security, and performance problems with large codebases. [5]
While bootstrapped by tech companies, the project was setup from the get go as its own GitHub organization, and eventually became fully autonomous in 2019, following its lead maintainer as he left Facebook for Datadog.
In 2020 the Yarn team released a major update, Yarn 2.0, also codenamed "Berry" [6] . This version came with a full rewriting of both the codebase (which migrated to TypeScript in the process) and test suite. Many features were introduced, a cleaving one being a new unique installation strategy called Yarn Plug'n'Play.
Under this default but optional mode, Yarn wouldn't generate a node_modules
folder anymore, instead opting to generate a single Node.js resolver file named .pnp.cjs
. [7] While justified by the Yarn team as a need to address multiple design flaws in the typical Node.js module resolution, this change required some support from other projects in the ecosystem which took some time to materialise, adding friction to the migration from Yarn 1.22. to Yarn 2.0.
Users can write their own plugins for Yarn.
Yarn constraints allow users to enforce rules for their dependencies or manifest fields across scoped workspaces.
Downloaded packages are cached and stored as a single file.
Plug'n'Play allows users to run Node projects without node_modules
folder, defining the way or location to resolve dependencies package files with the Plug-n-Play-control file. This feature is aimed to fix an unwell structured node_modules
architecture and resulting in a faster Node.js application start-up time.
Plugins can add new resolvers, fetchers, linkers, commands, and can also register to some events or be integrated with each other, most features of Yarn are implemented through plugins, including yarn add
and yarn install
, which are also preinstalled plugins.
Users can define which protocol will be used to resolve certain packages, for example, the git protocol is used for downloading a public package from a Git repository, and the patch protocol is used for creating a patched copy of the original package.
Release Workflow automatically upgrades relative packages among monorepos workspaces when root packages are upgraded.
Workspaces allow multiple projects to work together in the same repository and automatically apply changes to other relatives when source code is modified, allowing installation of multiple packages in a single pass by running the installation command only once.
Zero-Installs solve the needs of installation of packages when packages is required to install when the codes is just fresh fetched to local.
To install yarn:
npm install -g yarn
To install a package with yarn: [10]
yarn add package-name
To install a package with yarn for development and testing purposes:
yarn add package-name --dev
NB: in the first versions, it was:
yarn install package-name --save-dev
The Comprehensive Perl Archive Network (CPAN) is a software repository of over 250,000 software modules and accompanying documentation for 39,000 distributions, written in the Perl programming language by over 12,000 contributors. CPAN can denote either the archive network or the Perl program that acts as an interface to the network and as an automated software installer. Most software on CPAN is free and open source software.
Konqueror is a free and open-source web browser and file manager that provides web access and file-viewer functionality for file systems. It forms a core part of the KDE Software Compilation. Developed by volunteers, Konqueror can run on most Unix-like operating systems. The KDE community licenses and distributes Konqueror under GNU GPL-2.0-or-later.
The following tables compare general and technical information for many wiki software packages.
TypeScript is a free and open-source high-level programming language developed by Microsoft that adds static typing with optional type annotations to JavaScript. It is designed for the development of large applications and transpiles to JavaScript.
Node.js is a cross-platform, open-source JavaScript runtime environment that can run on Windows, Linux, Unix, macOS, and more. Node.js runs on the V8 JavaScript engine, and executes JavaScript code outside a web browser.
npm is a package manager for the JavaScript programming language maintained by npm, Inc., a subsidiary of GitHub. npm is the default package manager for the JavaScript runtime environment Node.js and is included as a recommended feature in the Node.js installer.
Sublime Text is a text and source code editor featuring a minimal interface, syntax highlighting and code folding with native support for numerous programming and markup languages, search and replace with support for regular expressions, an integrated terminal/console window, and customizable themes. Available for Windows, macOS, and Linux, its functionality can be expanded with plugins written in Python. Community-contributed plugins can be downloaded and installed via a built-in Package Control system, or written by the user via a Python API. Sublime Text is proprietary software, but can be downloaded for free and used as an evaluation version with no time limit.
Amber Smalltalk, formerly named Jtalk, is an implementation of the programming language Smalltalk-80, that runs on the JavaScript runtime of a web browser. It is designed to enable client-side development using Smalltalk. The programming environment in Amber is named Helios.
Cloud9 IDE is an Online IDE, published as open source from version 2.0, until version 3.0. It supports multiple programming languages, including C, C++, PHP, Ruby, Perl, Python, JavaScript with Node.js, and Go.
Socket.IO is an event-driven library for real-time web applications. It enables real-time, bi-directional communication between web clients and servers. It consists of two components: a client, and a server. Both components have a nearly identical API.
Webpack is a free and open-source module bundler for JavaScript. It is made primarily for JavaScript, but it can transform front-end assets such as HTML, CSS, and images if the corresponding loaders are included. Webpack takes modules with dependencies and generates static assets representing those modules.
Hyperledger is an umbrella project of open source blockchains and related tools that the Linux Foundation started in December 2015. IBM, Intel, and SAP Ariba have contributed to support the collaborative development of blockchain-based distributed ledgers. It was renamed the Hyperledger Foundation in October 2021.
gulp is an open-source JavaScript toolkit, used as a streaming build system in front-end web development.
Grunt is a JavaScript task runner, a tool used to automatically perform frequent tasks such as minification, compilation, unit testing, and linting. It uses a command-line interface to run custom tasks defined in a file. Grunt was created by Ben Alman and is written in Node.js. It is distributed via npm. As of October 2022, there were more than 6,000 plugins available in the Grunt ecosystem.
In computing, Hoodie is an open-source JavaScript package, that enables offline-first, front-end web development by providing a complete backend infrastructure. It aims to allow developers to rapidly develop web applications using only front-end code by providing a backend based on Node.js and Apache CouchDB. It runs on many Unix-like systems as well as on Microsoft Windows.
Deno is a runtime for JavaScript, TypeScript, and WebAssembly that is based on the V8 JavaScript engine and the Rust programming language. Deno was co-created by Ryan Dahl, who also created Node.js.
peacenotwar is a piece of malware, which has been characterized as protestware, created by Brandon Nozaki Miller. In March 2022, it was added as a dependency in an update for node-ipc
, a common JavaScript dependency.
On March 22, 2016, software engineer Azer Koçulu took down the left-pad
package that he had published to npm. Koçulu deleted the package after a dispute with Kik Messenger, in which the company forcibly took control of the package name kik
. As a result, thousands of software projects that used left-pad
as a dependency, including the Babel transcompiler and the React web framework, were unable to be built or installed. This caused widespread disruption, as technology corporations small and large, including Facebook, PayPal, Netflix and Spotify, used left-pad
in their software products.
pnpm, or Performant Node Package Manager, is one of the main JavaScript package managers, developed in 2016 by Zoltan Kochan for the Node.js JavaScript runtime environment. It focuses on being a disk space-efficient alternative to npm.