Yesterday, Maël Nison, maintainer at Yarn, opened a GitHub thread on the Yarn repository describing the roadmap for the next major Yarn release. The roadmap (codenamed Berry) contains significant changes that are planned for Yarn’s design. Nison reinstates that Yarn’s philosophy will continue to be the same based around three important principles.
- Contributing to the Yarn ecosystem should be simple.
Long-term and Short-term goals for Yarn in 2019
- Yarn will be rewritten in TypeScript. The entire codebase will be ported from Flow to TypeScript. This is done to help third-party contributors to help to maintain Yarn.
- Yarn will become a development-first tool. This means Package managers will no longer work as tools for running on your production servers.
- Yarn will become an API first and CLI second. Its internal components will be split into modular entities
- Yarn will be designed in a way that each component of Yarn’s pipeline can be switched to adapt to different install targets. Yarn will now be a package manager platform as much as a package manager.
- Overall compatibility will be preserved when possible. The caveat: installs will now use Plug’n’Play by default.
Major changes and new features
- The lockfile format will become a strict subset of YAML.
- Yarn will drop support for both Node 4 and Node 6.
- The log system will be renovated with implementation of diagnostic error codes from Typescript.
- Some features currently in the core will be moved into contrib plugins.
- The cache file format will switch from Tar to Zip, which offer better features in terms of random access.
- Nested workspaces will be supported out of the box.
- Running Yarn ./packages/my-package add foo will run Yarn add foo into my-package.
- There will be a new resolution protocol, workspaces:, which allows developers to force the package manager to link one of the packages against a workspace.
- Yarn constraints is a new command which will allow developers to enforce constraints across workspaces.
- The Yarn link command will now persist its changes into the package.json files
- Berry will ship with a portable posix-like light shell that’ll be used by default.
- Scripts will be able to put their arguments anywhere in the command-line (and repeat them if needed) using $@.
- Cache will become fully atomic, with multiple Yarn instances running concurrently on the same cache without risking corrupting the data.
Developers are generally positive about this release specially pointing out the change of moving from Flow to Typescript.
A hacker news user states, “Finally one of the biggest news is the switch from Flow to Typescript. I think it’s now clear that Facebook is admitting defeat with Flow; it brought a lot of good in the scene but Typescript is a lot more popular and gets overall much better support. Uniting the JS ecosystem around Typescript will be such a big deal.”
Another comment reads, “The codebase will be ported from Flow to TypeScript. We hope this will help our community ramp up on Yarn, and will help you build awesome new features on top of it. Another major project moving from flow to typescript.”
A new repository will be set up in early February. Post which Berry will be accessible by running yarn policies set-version berry within a project.