Yarn v2 changes migrates codebase from Flow to TypeScript
Its full changelog is available on GitHub, detailing all the new additions.
Introducing Yarn 2! https://t.co/PZMf0IChFu
— Maël (@arcanis) January 24, 2020
v2 changes and highlights
Some of the notable changes included in v2:
- Redesigned CLI Output: New colors and new searchable error codes which include suggested fixes.
- “Zero-installs” philosophy: Yarn reads vendor files directly from cache.
yarn dlxcommand: Download and execute remote scripts
yarn workspaces foreach command: Extends Yarn across multiple repos with a plugin
patch:protocol: Apply changes to a package in the dependency tree
- New workflow plugin: A new incubating plugin adds deferred versioning and includes a visual interface.
- Constraints: Specify generic rules for workspaces using Prolog.
- Zip cache files: Zip now replaces tgz
- Read-only packages: Packages in cache archives are mounted as read-only drives
- Updated homepage and documentation. (The adorable mascot is conspicuously missing from the v2 site. Catch him on the legacy code site.)
Many new features in v2 are currently experimental and still incubating, so keep this in mind if you decide to migrate to the newest version and watch for updates.
Migrating from Flow to TypeScript
One of the biggest changes under the hood in v2 is the switch from Flow to TypeScript.
From the announcement blog post by Yarn maintainer Maël Nison:
While it might not directly impact you as a user, we’ve fully migrated from Flow to TypeScript. One huge advantage is that our tooling and contribution workflow is now easier than ever. And since we now allow building Yarn plugins, you’ll be able to directly consume our types to make sure your plugins are safe between updates.
This is another drop in the bucket towards making TypeScript the new JS developer standard and marks yet another project moving their codebase from Flow to TypeScript. (Back in 2018, Facebook’s Jest also made the switch.)