Yarn JavaScript Package Manager

Yarn JavaScript Package Manager

github.com

3

About this website

Yarn is a free and open-source package manager for JavaScript that serves as a fast, reliable, and secure alternative to npm (Node Package Manager). Developed by Facebook (now Meta) in collaboration with Google, Exponent, and Tilde, Yarn was first released in October 2016 as Yarn Classic (v1) to address npm's shortcomings in speed, reliability (deterministic installs), and security. Yarn Berry (v2+) was released in 2020 as a complete rewrite with new architecture. Key features: speed: Yarn caches every downloaded package locally, so repeated installs are near-instant. Parallel downloads and a global cache reduce network usage and installation time significantly compared to npm v3-v5. Deterministic installs: Yarn generates a yarn.lock file that locks exact dependency versions (including transitive dependencies). Combined with the resolution algorithm, this ensures that installs produce identical node_modules structures across machines, eliminating the 'works on my machine' problem. Workspaces: monorepo support allowing multiple packages to live in a single repository. Workspaces share dependencies and can reference each other via symlinks, simplifying development of multi-package projects. Yarn Berry (v2+): Plug'n'Play (PnP): eliminates node_modules entirely by generating a single .pnp.cjs file that maps package names to their locations on disk, resulting in dramatically faster installs and reduced disk usage. Zero-installs: the .pnp.cjs and cache can be committed to version control, enabling offline installs and instant CI/CD pipelines. Constraints: enforce dependency policies across workspaces. Patches: apply patches to dependencies without forking. Protocols: custom resolution protocols (workspace:, patch:, portal:). Security: checksum verification for package integrity and restricted lifecycle script execution. CLI: yarn add, yarn install, yarn remove, yarn workspaces, yarn dlx (temporary execution). Used by Babel, React, Vue, Angular. BSD.

Tags & Categories

Tags

Statistics

3
Views
0
Clicks
0
Like
0
Dislike

Comments

Log In to post a comment

No comments yet. Be the first!