<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Maël Nison</title>
    <description>The latest articles on DEV Community by Maël Nison (@arcanis).</description>
    <link>https://dev.to/arcanis</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F111910%2F336c999d-e4e1-4590-bf13-8c9a82bbe6bb.jpeg</url>
      <title>DEV Community: Maël Nison</title>
      <link>https://dev.to/arcanis</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/arcanis"/>
    <language>en</language>
    <item>
      <title>Yarn 3.2 🚢🔮 Libc, Yarn Explain, Next Major, ...</title>
      <dc:creator>Maël Nison</dc:creator>
      <pubDate>Mon, 21 Feb 2022 13:21:32 +0000</pubDate>
      <link>https://dev.to/arcanis/yarn-32-libc-yarn-explain-next-major--o22</link>
      <guid>https://dev.to/arcanis/yarn-32-libc-yarn-explain-next-major--o22</guid>
      <description>&lt;p&gt;Welcome to the release notes for &lt;strong&gt;Yarn 3.2&lt;/strong&gt;! This release is a little smaller than the 3.0 and 3.1, as we've hold off on some changes in preparation for our next major ... but more on that later 😃&lt;/p&gt;

&lt;p&gt;As always, keep in mind those are only the highlights, the &lt;a href="https://github.com/yarnpkg/berry/blob/master/CHANGELOG.md" rel="noopener noreferrer"&gt;full changelog&lt;/a&gt; is much more comprehensive. And if you just happen to love reading our release posts, here are the past entries 👇&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/arcanis/yarn-31-corepack-esm-pnpm-optional-packages--3hak"&gt;Yarn 3.1 🎃👻 Corepack, ESM, pnpm, Optional Packages ...&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/arcanis/yarn-3-0-performances-esbuild-better-patches-e07"&gt;Yarn 3.0 🚀🤖 Performances, ESBuild, Better Patches, ...&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/arcanis/yarn-2-4-log-filters-audits-better-warnings-49io"&gt;Yarn 2.4 🎄🎁 Log Filters, Audits, Better Warnings, ...&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/arcanis/yarn-2-3-info-command-detailed-options-nohoist-409h"&gt;Yarn 2.3 🍦✨ Info Command, Detailed Options, Nohoist, ...&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/arcanis/yarn-2-2-dedupe-faster-lighter-ha5"&gt;Yarn 2.2 🚅🌟 Dedupe, Faster, Lighter, ...&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/arcanis/yarn-2-1-git-workspaces-focused-installs-loose-mode-live-playground-4kfc"&gt;Yarn 2.1 🐱‍🏍 Git Workspaces, Focused Installs, Loose Mode, ...&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sponsoring
&lt;/h2&gt;

&lt;p&gt;The Yarn org needs your help to make our work more sustainable! Please take a look at our &lt;a href="https://opencollective.com/yarnpkg" rel="noopener noreferrer"&gt;OpenCollective&lt;/a&gt; and &lt;a href="https://github.com/sponsors/yarnpkg" rel="noopener noreferrer"&gt;GitHub Sponsors&lt;/a&gt; pages for more details 😊&lt;/p&gt;

&lt;h2&gt;
  
  
  Libc Field
&lt;/h2&gt;

&lt;p&gt;We implemented in 3.1 a feature we call "conditional dependencies". The idea is simple: if a package is listed in the &lt;code&gt;optionalDependencies&lt;/code&gt; field and its &lt;code&gt;os&lt;/code&gt; / &lt;code&gt;cpu&lt;/code&gt; fields don't match the current machine, we don't install them at all. This pattern is today used by various tools like Esbuild or SWC to avoid overfetching dependencies that systems wouldn't needed.&lt;/p&gt;

&lt;p&gt;One problem however is that while &lt;code&gt;os&lt;/code&gt; and &lt;code&gt;cpu&lt;/code&gt; are useful at differentiating systems, they aren't the only parameters at play. In particular, knowing the standard C library against which native modules are built is critical: using a module linked against the glibc with a Node release built against &lt;a href="https://musl.libc.org/" rel="noopener noreferrer"&gt;musl&lt;/a&gt; would promptly crash.&lt;/p&gt;

&lt;p&gt;To avoid this, Yarn now supports a &lt;code&gt;libc&lt;/code&gt; array field in the &lt;code&gt;package.json&lt;/code&gt; that currently accepts any of two values: &lt;code&gt;glibc&lt;/code&gt; and &lt;code&gt;musl&lt;/code&gt;. Just like &lt;code&gt;os&lt;/code&gt; and &lt;code&gt;cpu&lt;/code&gt;, packages will be skipped if they don't match the host libc.&lt;/p&gt;

&lt;p&gt;This isn't the final iteration; while &lt;code&gt;libc&lt;/code&gt; is a good improvement, more parameters could be taken into account. Both Yarn and npm have open proposals to address this situation, and we'll see what we decide to implement.&lt;/p&gt;

&lt;h2&gt;
  
  
  New Command: &lt;code&gt;yarn explain&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;It can be difficult to know how to react when facing errors. Our website tries to help with that by providing &lt;a href="https://yarnpkg.com/advanced/error-codes" rel="noopener noreferrer"&gt;detailed explanations&lt;/a&gt;, but when you're in your terminal this might not be the first thing you have in mind.&lt;/p&gt;

&lt;p&gt;The new &lt;code&gt;yarn explain&lt;/code&gt; command will let you get all the details about an error, right from your terminal:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbrt0umb2jvfkkjeu2kv9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbrt0umb2jvfkkjeu2kv9.png" alt="Explain Output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the future we'll expand the documentation to cover more error messages, and may use &lt;code&gt;yarn explain&lt;/code&gt; to aggregate some of the other similar mechanisms we already have (such as &lt;a href="https://yarnpkg.com/cli/explain/peer-requirements" rel="noopener noreferrer"&gt;&lt;code&gt;yarn explain peer-requirements&lt;/code&gt;&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  UI Improvements
&lt;/h2&gt;

&lt;p&gt;Every version we look for little UI annoyances to fix. This time is no exception with a couple of neat improvements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The resolution step will now have a spinning wheel; we can't show a percent-based progress since we don't know how many packages we'll have to resolve until the end, but a spinner will at least let you know the process isn't stuck.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Errors thrown when cloning Git repositories were previously reported as regular stack traces. They will now have dedicated output.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm4zkw674viqnuqc7c8fr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm4zkw674viqnuqc7c8fr.png" alt="Improved Git Error"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Next Major
&lt;/h2&gt;

&lt;p&gt;With 3.2 out of the door, we'll now start working on the next major release: Yarn 4! We have an &lt;a href="https://github.com/yarnpkg/berry/issues/3591" rel="noopener noreferrer"&gt;issue&lt;/a&gt; highlighting the things we currently have in mind, but generally speaking expect us to decrease the friction when starting new projects. Some highlights:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We'll drop support for Node 12, as it will reach EOL in April&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We'll be exploring a new resolution algorithm that will prevent most of the attacks similar to the recent &lt;a href="https://news.ycombinator.com/item?id=29851065" rel="noopener noreferrer"&gt;&lt;code&gt;color.js&lt;/code&gt; hijacking&lt;/a&gt;.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;More commands will be integrated with Git; we used to refrain from doing so due to some related projects using Mercurial, but this isn't the case anymore. Projects not using Git will still be able to use Yarn, but some features may not be available there.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To give you an idea of the kind of integration we have in mind, the &lt;code&gt;yarn stage&lt;/code&gt; command (already available as a plugin) allows to automatically commit all dependency-related changes without impacting any other.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The &lt;strong&gt;official&lt;/strong&gt; plugins will be shipped by default, to reduce the friction. In practice the Yarn binary is very small, so we have some leeway to bundle everything together so that you don't have to download more subparts.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Even if bundled by default they'll technically remain plugins, so it doesn't change anything for third-party plugin authors: our plugin API will remain a focus for us, and will keep improve.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;And more! 🙂 We have plenty of other ideas to improve Yarn, so expect to see a significant amount of improvements in our next major - including lower friction when starting new projects or migrating older ones.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>npm</category>
      <category>node</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Yarn 3.1 🎃👻 Corepack, ESM, pnpm, Optional Packages ...</title>
      <dc:creator>Maël Nison</dc:creator>
      <pubDate>Mon, 25 Oct 2021 15:05:15 +0000</pubDate>
      <link>https://dev.to/arcanis/yarn-31-corepack-esm-pnpm-optional-packages--3hak</link>
      <guid>https://dev.to/arcanis/yarn-31-corepack-esm-pnpm-optional-packages--3hak</guid>
      <description>&lt;p&gt;Welcome to the release notes for &lt;strong&gt;Yarn 3.1&lt;/strong&gt;! We're quite excited by this release, as it brings various improvements that we've all been looking forward to. Let's dig into that!&lt;/p&gt;

&lt;p&gt;As always, keep in mind those are only the highlights, the &lt;a href="https://github.com/yarnpkg/berry/blob/master/CHANGELOG.md"&gt;full changelog&lt;/a&gt; is much more comprehensive. And if you just happen to love reading our release posts, here are the past entries 👇&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/arcanis/yarn-3-0-performances-esbuild-better-patches-e07"&gt;Yarn 3.0 🚀🤖 Performances, ESBuild, Better Patches, ...&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/arcanis/yarn-2-4-log-filters-audits-better-warnings-49io"&gt;Yarn 2.4 🎄🎁 Log Filters, Audits, Better Warnings, ...&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/arcanis/yarn-2-3-info-command-detailed-options-nohoist-409h"&gt;Yarn 2.3 🍦✨ Info Command, Detailed Options, Nohoist, ...&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/arcanis/yarn-2-2-dedupe-faster-lighter-ha5"&gt;Yarn 2.2 🚅🌟 Dedupe, Faster, Lighter, ...&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/arcanis/yarn-2-1-git-workspaces-focused-installs-loose-mode-live-playground-4kfc"&gt;Yarn 2.1 🐱‍🏍 Git Workspaces, Focused Installs, Loose Mode, ...&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sponsoring
&lt;/h2&gt;

&lt;p&gt;The Yarn org needs your help to make our work more sustainable! Please take a look at our &lt;a href="https://opencollective.com/yarnpkg"&gt;OpenCollective&lt;/a&gt; and &lt;a href="https://github.com/sponsors/yarnpkg"&gt;GitHub Sponsors&lt;/a&gt; pages for more details 😊&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of content
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Node.js Corepack Integration&lt;/li&gt;
&lt;li&gt;ESM Support&lt;/li&gt;
&lt;li&gt;New Install Mode: &lt;code&gt;pnpm&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Conditional Packages&lt;/li&gt;
&lt;li&gt;Smart Changeset Filters&lt;/li&gt;
&lt;li&gt;New Workspace Syntax: &lt;code&gt;workspace:^&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Improvements
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Node.js Corepack Integration
&lt;/h3&gt;

&lt;p&gt;Did you know that Yarn now ships with Node? This is done via the Node.js &lt;a href="https://nodejs.org/api/corepack.html"&gt;Corepack project&lt;/a&gt;, which includes both the Yarn and pnpm binaries as shims. By adding the &lt;code&gt;packageManager&lt;/code&gt; field to your &lt;code&gt;package.json&lt;/code&gt;, you can enforce the use of a specific package manager &amp;amp; package manager version in a completely transparent way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"packageManager"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"yarn@3.1.0"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that Corepack is available starting from Node.js 16.9, but is currently opt-in. Don't forget to run &lt;code&gt;corepack enable&lt;/code&gt; a single time to make sure the shims are globally installed!&lt;/p&gt;

&lt;p&gt;We also improved in 3.1 the &lt;code&gt;init&lt;/code&gt; command to properly support Corepack: running &lt;code&gt;yarn init -2&lt;/code&gt; will now automatically setup a Yarn Modern project, setting its &lt;code&gt;packageManager&lt;/code&gt; field as required 💫&lt;/p&gt;

&lt;h3&gt;
  
  
  ESM Support
&lt;/h3&gt;

&lt;p&gt;ESM has always been supported when using the &lt;a href="https://yarnpkg.com/configuration/yarnrc#nodeLinker"&gt;&lt;code&gt;node_modules&lt;/code&gt; linker&lt;/a&gt;, since it's the same old install strategy that Node has always supported. However, with PnP taking ownership of the resolution pipeline, compatibility with ESM wasn't a given and had to be implemented using the &lt;a href="https://nodejs.org/dist/latest-v9.x/docs/api/esm.html#esm_loader_hooks"&gt;Loader Hook API&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;While the Loader Hook API isn't entirely stable yet, a large amount of work has been made lately and our team has been able to produce an initial experimental support for ESM modules. It should be enabled automatically if we detect that one of the packages in your dependency tree contains a &lt;code&gt;"type": "module"&lt;/code&gt; field, but you can enable or disable it manually through your settings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;pnpEnableEsmLoader&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Being experimental, it's possible that some bugs may arise or that new Node releases bring some breaking changes around the API. Be sure to report issues on our &lt;a href="https://github.com/yarnpkg/berry"&gt;bug tracker&lt;/a&gt;!&lt;/p&gt;

&lt;h3&gt;
  
  
  New Install Mode: &lt;code&gt;pnpm&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://pnpm.io/"&gt;pnpm package manager&lt;/a&gt; was one of the first tools to advocate for using symlinks when installing packages within the &lt;code&gt;node_modules&lt;/code&gt; folder. While we went another way with PnP, we decided that the implementation cost was low enough that it would be worth adding support for this symlink-based install strategy as well.&lt;/p&gt;

&lt;p&gt;Starting from Yarn 3.1, you can try out symlink-based installs by adding the following setting to your &lt;code&gt;.yarnrc.yml&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;nodeLinker&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;pnpm&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conditional Packages
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://esbuild.github.io/"&gt;Esbuild&lt;/a&gt; and &lt;a href="https://swc.rs/"&gt;swc&lt;/a&gt; are two native packages that gained a lot of attention lately thanks to their impressive performances over their competitors. They recently revamped how their packages are built to avoid complex postinstall scripts, but did so in a way that was less efficient than before for Yarn projects.&lt;/p&gt;

&lt;p&gt;Yarn 3.1 features a new optimization that kicks in when a package is listed as &lt;code&gt;optionalDependencies&lt;/code&gt; and lists &lt;code&gt;os&lt;/code&gt; and/or &lt;code&gt;cpu&lt;/code&gt; fields. When that happens, Yarn will skip fetching and installing those packages unless they match the current system parameters.&lt;/p&gt;

&lt;p&gt;In case you need to manually configure a strict set of package architectures to support (for example like in a zero-install case, where you want to read from an immutable set of packages), you can use the &lt;code&gt;supportedArchitectures&lt;/code&gt; setting:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;supportedArchitectures&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;os&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;linux&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;darwin&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
  &lt;span class="na"&gt;cpu&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;x64&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;arm64&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Smart Changeset Filters
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;yarn workspaces foreach&lt;/code&gt; and &lt;code&gt;yarn workspaces list&lt;/code&gt; commands now ships with brand new &lt;code&gt;--since&lt;/code&gt; flags. When set, those commands will only execute against the packages that changed when compared to the main branch (either &lt;code&gt;main&lt;/code&gt; or &lt;code&gt;master&lt;/code&gt;, depending on the branches in your repository).&lt;/p&gt;

&lt;p&gt;This can come in handy if you wish to only run builds in some specific workspaces, or just get a list of the workspaces which changed for scripting purposes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn workspaces foreach --since run eslint .
yarn workspaces list --since
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;--since&lt;/code&gt; flag also accepts an optional argument (&lt;code&gt;--since=${commit-ish}&lt;/code&gt;) to manually define a source from which the changes should be derived. &lt;/p&gt;

&lt;h3&gt;
  
  
  New Workspace Syntax: &lt;code&gt;workspace:^&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Workspaces supported a special syntax via &lt;code&gt;workspace:*&lt;/code&gt;, with those ranges being replaced at publish-time by exact ranges corresponding to the real version of the target workspace. However, if you wanted to use a caret instead of an exact range, you had to use the verbose &lt;code&gt;workspace:^x.y.z&lt;/code&gt; form, which Yarn updated repo-wide after each publish.&lt;/p&gt;

&lt;p&gt;Yarn now supports &lt;code&gt;workspace:^&lt;/code&gt; and &lt;code&gt;workspace:~&lt;/code&gt; as well, making it much easier to cross-reference workspaces within a monorepo where most packages are intended to be published, by preventing a good amount of the merge conflicts that used to happen after Yarn updated the verbose ranges.&lt;/p&gt;

&lt;p&gt;Additionally, as a special case, this syntax is now allowed in the &lt;code&gt;peerDependencies&lt;/code&gt; field as well:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"peerDependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"@my/other-package"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"workspace:^"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>npm</category>
      <category>node</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Yarn 3.0 🚀🤖 Performances, ESBuild, Better Patches, ...</title>
      <dc:creator>Maël Nison</dc:creator>
      <pubDate>Mon, 26 Jul 2021 16:06:24 +0000</pubDate>
      <link>https://dev.to/arcanis/yarn-3-0-performances-esbuild-better-patches-e07</link>
      <guid>https://dev.to/arcanis/yarn-3-0-performances-esbuild-better-patches-e07</guid>
      <description>&lt;p&gt;Hello! Long time no see! Back in December, we decided to start working on our next major release, the &lt;strong&gt;3.0&lt;/strong&gt;. It took a bit of time to do everything we intended to do, but here we are! So let's talk a bit about what it changes, and what it brings. Note that these are only the highlights, the &lt;a href="https://github.com/yarnpkg/berry/blob/master/CHANGELOG.md"&gt;full changelog&lt;/a&gt; is much more comprehensive.&lt;/p&gt;

&lt;p&gt;And if you just love to read our log posts, here are the past entries 👇&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/arcanis/yarn-2-4-log-filters-audits-better-warnings-49io"&gt;Yarn 2.4 🎄🎁 Log Filters, Audits, Better Warnings, ...&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/arcanis/yarn-2-3-info-command-detailed-options-nohoist-409h"&gt;Yarn 2.3 🍦✨ Info Command, Detailed Options, Nohoist, ...&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/arcanis/yarn-2-2-dedupe-faster-lighter-ha5"&gt;Yarn 2.2 🚅🌟 Dedupe, Faster, Lighter, ...&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/arcanis/yarn-2-1-git-workspaces-focused-installs-loose-mode-live-playground-4kfc"&gt;Yarn 2.1 🐱‍🏍 Git Workspaces, Focused Installs, Loose Mode, ...&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Governance
&lt;/h2&gt;

&lt;p&gt;Back when the project was started in 2017, we didn't took the time to establish a formal governance document. This is now addressed, and our team composition can be found &lt;a href="https://github.com/yarnpkg/berry/blob/master/GOVERNANCE.md"&gt;here&lt;/a&gt;. It doesn't change anything in practice (this is how we worked for more than two years now), but we hope it may give you a better understanding as to how we work and reach consensus.&lt;/p&gt;

&lt;h2&gt;
  
  
  OpenCollective
&lt;/h2&gt;

&lt;p&gt;From 2017 to 2019 Yarn was mostly maintained by Facebook engineers. While it worked relatively well, the Yarn 1 -&amp;gt; 2 release also proved to be the right time to expand our active team to other horizons, and nowadays no two of our active contributors work at the same company - and none at Facebook.&lt;/p&gt;

&lt;p&gt;Consequently, we've decided to setup an &lt;a href="https://opencollective.com/yarnpkg"&gt;OpenCollective&lt;/a&gt; (or &lt;a href="https://github.com/sponsors/yarnpkg"&gt;GitHub Sponsors&lt;/a&gt;) to give our supporters a way to both express their thanks to our team, and give us resources we can then inject back into the project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Breaking Changes
&lt;/h2&gt;

&lt;p&gt;While the migration from Yarn 1 to Yarn 2 brought some discomfort, the migration to Yarn 3 should prove easier - regardless of the version you come from. The user-facing breaking changes we made this season are mostly little details that may only affect you in very specific cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node 10 isn't supported anymore&lt;/li&gt;
&lt;li&gt;Plug'n'Play hooks are now called &lt;code&gt;.pnp.cjs&lt;/code&gt; (vs &lt;code&gt;.pnp.js&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Virtual folders are now called &lt;code&gt;__virtual__&lt;/code&gt; (vs &lt;code&gt;$$virtual&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;The &lt;a href="https://yarnpkg.com/getting-started/editor-sdks"&gt;editor SDKs&lt;/a&gt; have been moved to &lt;code&gt;@yarnpkg/sdks&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Etc; full list &lt;a href="https://github.com/yarnpkg/berry/blob/master/CHANGELOG.md"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even for Yarn 1 users, migrating from 1 to 3 should be easier: we made it so that Yarn will detect when this situation arises to then automatically enable the &lt;code&gt;node-modules&lt;/code&gt; linker. That alone should address most of the problems you may have been hitting when attempting the upgrade - and for everything else, make sure to take a look at our &lt;a href="https://yarnpkg.com/getting-started/migration#step-by-step"&gt;Migration Guide&lt;/a&gt; which got significantly improved over the past year.&lt;/p&gt;

&lt;h3&gt;
  
  
  Support for the &lt;code&gt;exports&lt;/code&gt; field
&lt;/h3&gt;

&lt;p&gt;When using Yarn 3 w/ PnP, the &lt;a href="https://nodejs.org/api/packages.html#packages_exports"&gt;&lt;code&gt;exports&lt;/code&gt;&lt;/a&gt; field will be properly resolved &lt;em&gt;regardless of your Node version&lt;/em&gt;. If you're not familiar with this field, you can see it as a way to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Replace the &lt;code&gt;main&lt;/code&gt; field&lt;/li&gt;
&lt;li&gt;Soft-prevent accessing arbitrary files in the package&lt;/li&gt;
&lt;li&gt;Conditionally remap files depending on the context (bundlers, ...)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Performances
&lt;/h2&gt;

&lt;p&gt;Various tweaks have been made to address some of the largest resource consumptions in Yarn. Installs have been improved (turning us faster than pnpm in some scenarios, which is quite a feat!), but not only: script execution tends to have a natural overhead, but bugs in 2.4 and prior caused this overhead to grow relative to the size of the project itself.  This is no longer the case, and the overhead should now be constant.&lt;/p&gt;

&lt;h2&gt;
  
  
  New &lt;code&gt;node_modules&lt;/code&gt; linkers
&lt;/h2&gt;

&lt;p&gt;As you may know, Yarn is built around a few interfaces. One of them is called a "linker", and tells Yarn how to install packages on disk. It's how we can support both PnP and node_modules installs without changing much code.&lt;/p&gt;

&lt;p&gt;One advantage of this architecture is how it allows us to efficiently iterate on alternative install strategies. For this release, &lt;a href="https://github.com/larixer"&gt;larixer&lt;/a&gt; implemented a new experimental &lt;code&gt;nmMode&lt;/code&gt; setting that can be used to instruct the linker to use a specific copy scheme:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;hardlinks-local&lt;/code&gt; will use hardlinks when the same package is found multiple times within the same project (but only if they have exactly the same version at the moment).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;hardlinks-global&lt;/code&gt; will use hardlinks on identical files (even across different versions!), but will also make them point to a global content-addressable directory. This is similar to what pnpm does. Note that if the cache is corrupted (for example because you manually edited it), Yarn will automatically repair it on subsequent installs.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I myself have been playing with a pnpm-style linker. It hasn't shipped yet since I'm cautious about adding complexity that could end up unmaintained, but given how small it is there's a decent chance we could add it in a later release as an experimental install mode.&lt;/p&gt;

&lt;h2&gt;
  
  
  Improved Shell
&lt;/h2&gt;

&lt;p&gt;As you may know, given that system shells are rarely portable across Windows and Posix, Yarn no longer uses them to run your &lt;code&gt;scripts&lt;/code&gt; entries. Instead, we use our very own shell interpreter.&lt;/p&gt;

&lt;p&gt;We're happy to report that this shell just got smarter, and now provides two additional syntaxes that you can reliably use on both Windows and Posix:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;build-js &amp;amp; build-css &amp;amp;    # Background jobs
ls 2&amp;gt;/dev/null            # File descriptor redirections
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Additionally, background jobs have their output color-coded, so you can clearly identify their output, even interlaced.&lt;/p&gt;

&lt;h2&gt;
  
  
  ESBuild support
&lt;/h2&gt;

&lt;p&gt;We now use ESBuild to generate the Yarn bundles and as such worked to ensure good compatibility with Plug'n'Play installs. The result is the new &lt;a href="https://github.com/yarnpkg/berry/tree/master/packages/esbuild-plugin-pnp"&gt;&lt;code&gt;@yarnpkg/esbuild-plugin-pnp&lt;/code&gt;&lt;/a&gt; package which lets you transparently build your code using the default Yarn installation mode. It's still relatively young, so feel free to drop us an issue if you notice something strange!&lt;/p&gt;

&lt;p&gt;While it won't change much for most end-users, the move to ESBuild also provided decent build speed improvements (around 6x faster), making it less frustrating to &lt;a href="https://yarnpkg.com/cli/set/version/from/sources"&gt;build Yarn from sources&lt;/a&gt; ✨&lt;/p&gt;

&lt;h2&gt;
  
  
  New plugin APIs
&lt;/h2&gt;

&lt;p&gt;Yarn supports writing plugins that can inject themselves into various places and leverage some of the builtin modules provided by the core. While we didn't get the chance to make all the improvements we hoped, we've still been able to upgrade the command line framework to &lt;a href="https://mael.dev/clipanion/"&gt;Clipanion 3&lt;/a&gt;, which lets you write intuitive type-checked commands with a minimal syntactic overhead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;According to DEV.to, those change notes take about 5 minutes to read - by contrast, the &lt;a href="https://dev.to/arcanis/introducing-yarn-2-4eh1"&gt;2.0 release post&lt;/a&gt; was a whopping 15 minutes! Of course, this time around we didn't need to fully rewrite Yarn, hence a lower amount of "critical information" we need you to be aware of 😉 We expect that to be the norm from now on: majors won't have a lot of super impactful changes, mostly just some architecture cleaning and modernization, as new features will tend to land in minors.&lt;/p&gt;

&lt;p&gt;As for our team, we're very happy of the work we've been doing! Working on the codebase still feels like a treat, and features are often constrained to a few identifiable files - proving that our initial redesign bet was right. Our stats suggest that the result are visible to our users as well, and while I remain cautious about popularity metrics it's certainly nice to see.&lt;/p&gt;

&lt;p&gt;Finally, remember that Yarn now has an &lt;a href="https://opencollective.com/yarnpkg"&gt;OpenCollective&lt;/a&gt; / &lt;a href="https://github.com/sponsors/yarnpkg"&gt;GitHub Sponsors&lt;/a&gt;! If your company benefits from our work, or would like to see particular fixes land, sponsoring the project is a good way to engage with us 🙂&lt;/p&gt;

&lt;h3&gt;
  
  
  What's to come?
&lt;/h3&gt;

&lt;p&gt;A few features initially slated for 3.0 have been pushed back to the next minor so that we have more time to properly incubate them. Some of the things we have in motion:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/nodejs/corepack"&gt;Corepack&lt;/a&gt; integration&lt;/li&gt;
&lt;li&gt;ESM support under PnP mode&lt;/li&gt;
&lt;li&gt;Builtin CLI completion&lt;/li&gt;
&lt;li&gt;Changelog generation&lt;/li&gt;
&lt;li&gt;Improved performances&lt;/li&gt;
&lt;li&gt;pnpm-style linker&lt;/li&gt;
&lt;li&gt;And more...!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Of course that's only on the top of my head, so it's possible our objectives shift during the next weeks depending on our own priorities - and of course depending on whether you help us or not 😛&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>npm</category>
      <category>node</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Yarn 💞 GitHub Sponsors</title>
      <dc:creator>Maël Nison</dc:creator>
      <pubDate>Thu, 28 Jan 2021 12:14:14 +0000</pubDate>
      <link>https://dev.to/arcanis/yarn-github-sponsors-711</link>
      <guid>https://dev.to/arcanis/yarn-github-sponsors-711</guid>
      <description>&lt;p&gt;The &lt;a href="https://github.com/yarnpkg"&gt;Yarn organization&lt;/a&gt; now accepts individual &amp;amp; corporate sponsorships via both &lt;a href="https://github.com/sponsors/yarnpkg"&gt;GitHub Sponsors&lt;/a&gt; and &lt;a href="https://opencollective.com/yarnpkg"&gt;OpenCollective&lt;/a&gt;! 🌟&lt;/p&gt;

&lt;p&gt;Ever since its inception in 2016 the project operated without official structure allowing it to receive donations. While we made it work, developing expert tools like package managers revealed itself an extremely resource-intensive task. While our companies have been understanding, maintaining Yarn isn't part of our official job statements and many hours have to be spent maintaining the project and supporting our users during our spare time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/yarnpkg/berry"&gt;As we're working on Yarn 3&lt;/a&gt;, we hope donations will help our core team justify this work while also giving us the resources needed to sometimes delegate parts of the maintenance to professionals (be it for external security reviews, website redesign, documentation proofreading, etc), thus further improving the quality of our production and letting us focus on building the very tool and workflows we all use everyday.&lt;/p&gt;

&lt;p&gt;If you're interested to know more, feel free to ping our team on our &lt;a href="http://discord.gg/yarnpkg"&gt;Discord server&lt;/a&gt; and we'll be happy to help!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>npm</category>
      <category>node</category>
      <category>news</category>
    </item>
    <item>
      <title>Yarn 2.4 🎄🎁 Log Filters, Audits, Better Warnings, ...</title>
      <dc:creator>Maël Nison</dc:creator>
      <pubDate>Mon, 30 Nov 2020 14:52:14 +0000</pubDate>
      <link>https://dev.to/arcanis/yarn-2-4-log-filters-audits-better-warnings-49io</link>
      <guid>https://dev.to/arcanis/yarn-2-4-log-filters-audits-better-warnings-49io</guid>
      <description>&lt;p&gt;Hey everyone! It's this time of the year where everyone is slowly preparing for the holidays. This year will probably be slightly different, but I can't wait to at least take a well deserved time off. But before that, let's talk about our next minor Yarn release, and a little bit about the next-next release: &lt;strong&gt;Yarn 3&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;Oh, and in case you missed our previous release notes, you can find them all here in all their glorious emojiness: 👇&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/arcanis/yarn-2-3-info-command-detailed-options-nohoist-409h"&gt;Yarn 2.3 🍦✨ Info Command, Detailed Options, Nohoist, ...&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/arcanis/yarn-2-2-dedupe-faster-lighter-ha5"&gt;Yarn 2.2 🚅🌟 Dedupe, Faster, Lighter, ...&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/arcanis/yarn-2-1-git-workspaces-focused-installs-loose-mode-live-playground-4kfc"&gt;Yarn 2.1 🐱‍🏍 Git Workspaces, Focused Installs, Loose Mode, ...&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Plugins
&lt;/h2&gt;

&lt;p&gt;We'll try to reference external plugins made by our community in our release notes, so if you made one that you want to share, please ping us! We're also looking at adding a page on our website to list them all, improving discoverability 💫&lt;/p&gt;

&lt;p&gt;For now, let me present those two:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://yarn.build/" rel="noopener noreferrer"&gt;yarn.build&lt;/a&gt; by &lt;a href="https://twitter.com/ojkelly" rel="noopener noreferrer"&gt;ojkelly&lt;/a&gt; is a fast monorepo builder for Yarn. In a sense it's similar to &lt;a href="https://yarnpkg.com/cli/workspaces/foreach" rel="noopener noreferrer"&gt;&lt;code&gt;yarn workspaces foreach&lt;/code&gt;&lt;/a&gt; but more opinionated, and thus easier to adapt to existing workflows. It parallelises builds, shows what's being executed, and generates zipped archives suitable for AWS and similar platforms.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://gitlab.com/Larry1123/yarn-contrib/-/tree/master/packages/plugin-production-install" rel="noopener noreferrer"&gt;prod-install&lt;/a&gt; by &lt;a href="https://gitlab.com/Larry1123" rel="noopener noreferrer"&gt;Larry1123&lt;/a&gt; and &lt;a href="https://www.mynetsvs.com/" rel="noopener noreferrer"&gt;NETSVS&lt;/a&gt; is a much more powerful version of &lt;a href="https://yarnpkg.com/cli/workspaces/focus" rel="noopener noreferrer"&gt;&lt;code&gt;yarn workspaces focus&lt;/code&gt;&lt;/a&gt; that copies the selected workspaces into a target location before transforming it to become self-sufficient - the final directory thus being ready to be efficiently cached and deployed via Docker layers.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Audits
&lt;/h2&gt;

&lt;p&gt;Both Yarn 1 and npm had this handy little feature called &lt;code&gt;audit&lt;/code&gt;. Originally developed by npm when they acquired &lt;a href="https://medium.com/npm-inc/npm-acquires-lift-security-258e257ef639" rel="noopener noreferrer"&gt;Lift&lt;/a&gt;, this command lets you quickly check whether some of your dependencies have known vulnerabilities, which may come in handy in some types of application. Unfortunately, since the audit endpoint isn't documented, its implementation wasn't entirely obvious.&lt;/p&gt;

&lt;p&gt;Thanks to our contributors, Yarn 2.4 now includes proper audit, available via the &lt;a href="https://yarnpkg.com/cli/npm/audit" rel="noopener noreferrer"&gt;&lt;code&gt;yarn npm audit&lt;/code&gt;&lt;/a&gt; command! And to make up for the delay, we've implemented various interesting ways to run it, under the form of the &lt;code&gt;-A,--all&lt;/code&gt; and &lt;code&gt;-R,--recursive&lt;/code&gt; options - check the &lt;a href="https://yarnpkg.com/cli/npm/audit#examples" rel="noopener noreferrer"&gt;examples&lt;/a&gt; for details!&lt;/p&gt;

&lt;p&gt;We've also significantly improved the output to be more in line with the rest of the CLI, providing information in a more compact way:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1037931%2F100546031-5ee0ba00-325f-11eb-8d6d-c6973571e099.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1037931%2F100546031-5ee0ba00-325f-11eb-8d6d-c6973571e099.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This new output is compatible with the &lt;code&gt;--json&lt;/code&gt; flag, meaning that you can leverage the information obtained from &lt;code&gt;yarn npm audit --json&lt;/code&gt; from any script you want - even the command-line itself, using tools like &lt;a href="https://stedolan.github.io/jq/" rel="noopener noreferrer"&gt;jq&lt;/a&gt;! &lt;/p&gt;

&lt;h2&gt;
  
  
  Better Warnings
&lt;/h2&gt;

&lt;p&gt;Peer dependencies have always been a difficult concept to grasp. They are not that hard per se (a peer dependency is always satisfied by the exact package instance used by the parent of the package listing it), but various other factors played into it and caused typical installs to produce many rarely actionable warnings.&lt;/p&gt;

&lt;p&gt;No more!, do we say. Starting from 2.4, you can expect the warnings produced by Yarn to become vastly better than what we used to report. For this first release with warnings being a focus, we've implemented a new range merging algorithm that lets us drastically decrease the amount of warnings we emit. The idea is simple: imaging the following dependency tree:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
└── your project/
    ├── @storybook/react/
    │   ├── (peer) react@^15
    │   ├── storybook-plugin-foo/
    │   │   └── (peer) react@^15
    │   └── storybook-plugin-bar/
    │       └── (peer) react@^15
    └── react@17
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before, these are the warnings you'd have had:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;your project provides react@17 to @storybook/react, which isn't compatible with react@^15
your project provides react@17 to storybook-plugin-foo, which isn't compatible with react@^15
your project provides react@17 to storybook-plugin-bar, which isn't compatible with react@^15
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From all those warnings, only one was truly actionable: the &lt;code&gt;@storybook/react&lt;/code&gt; one. The two others were mere byproducts from the first, and were just making the output harder to read. This is now fixed, and Yarn will instead report:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;your project provides react@17 (pXYZ), which doesn't satisfy what @storybook-react and its dependents request
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;pXYZ&lt;/code&gt; is a hash that you can use with a new command, &lt;code&gt;yarn explain peer-requirements &amp;lt;hash&amp;gt;&lt;/code&gt;, to get the exact list of packages that contribute to the final peer dependency requirement, and whether they are met or not. For instance, this is what I get in one of my projects:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1037931%2F100546016-3e186480-325f-11eb-8454-a44402a45494.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1037931%2F100546016-3e186480-325f-11eb-8454-a44402a45494.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Log Filters
&lt;/h2&gt;

&lt;p&gt;Even if warnings will get smarter, there's always this one case where you really don't care about a specific message. For instance the message saying that a package wasn't in the cache is sometimes controversial, with half of our users liking it, and the other half wanting to hide it.&lt;/p&gt;

&lt;p&gt;While you could use &lt;a href="https://yarnpkg.com/configuration/yarnrc/#preferAggregateCacheInfo" rel="noopener noreferrer"&gt;&lt;code&gt;preferAggregateCacheInfo&lt;/code&gt;&lt;/a&gt; to tweak that, it's only about one message. What about others? Well, starting from 2.4 we introduce a new setting called &lt;a href="https://yarnpkg.com/configuration/yarnrc#logFilters" rel="noopener noreferrer"&gt;&lt;code&gt;logFilters&lt;/code&gt;&lt;/a&gt;. It has the following syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;logFilters&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;code&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;YN0005&lt;/span&gt;
    &lt;span class="na"&gt;level&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;discard&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this configuration, all messages matching the specified code (which would be builds being disabled, per &lt;a href="https://yarnpkg.com/advanced/error-codes#yn0005---build_disabled" rel="noopener noreferrer"&gt;our documentation&lt;/a&gt;) will be removed from the output. And if you need to only remove a single line, it's possible as well:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;logFilters&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;core-js@npm:2.6.11&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;lists&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;build&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;scripts,&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;but&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;its&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;build&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;has&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;been&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;explicitly&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;disabled&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;through&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;configuration."&lt;/span&gt;
    &lt;span class="na"&gt;level&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;discard&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We hope this feature will let you tune your package managers to watch what you truly care about, which can be different from one person to the other.&lt;/p&gt;

&lt;h2&gt;
  
  
  And also
&lt;/h2&gt;

&lt;p&gt;As always, these release notes focus exclusively on the big-picture stuff - as always, there's a lot more things that have been improved under the hood. Check our &lt;a href="https://github.com/yarnpkg/berry/blob/master/CHANGELOG.md" rel="noopener noreferrer"&gt;changelog&lt;/a&gt; for a comprehensive list, but we can mention:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Updated our patches to account for TS 4.1 and FSEvents 2.1.2&lt;/li&gt;
&lt;li&gt;Improved usability when using the &lt;a href="https://yarnpkg.com/configuration/yarnrc#enableGlobalCache" rel="noopener noreferrer"&gt;global cache&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Improved usability in the &lt;a href="https://marketplace.visualstudio.com/items?itemName=arcanis.vscode-zipfs" rel="noopener noreferrer"&gt;VSCode ZipFS extension&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Improved performances on recurrent installs&lt;/li&gt;
&lt;li&gt;Improved Windows compatibility when running binaries&lt;/li&gt;
&lt;li&gt;Improved the display for &lt;code&gt;yarn upgrade-interactive&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Fixed the &lt;code&gt;postinstall&lt;/code&gt; scripts run by &lt;code&gt;yarn workspaces focus&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Fixed some edge cases with &lt;code&gt;||&lt;/code&gt; and interpolation errors&lt;/li&gt;
&lt;li&gt;Added support for proxy settings (&lt;code&gt;caFilePath&lt;/code&gt;, ...)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/yarnpkg/berry/blob/master/CHANGELOG.md" rel="noopener noreferrer"&gt;... and more!&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What about Yarn 3?
&lt;/h2&gt;

&lt;p&gt;This is a big news for us! Yarn 2.4 is expected to be the last minor release for the 2.x line! After a year of development, we now have put aside enough items to be worth addressing in a new major.&lt;/p&gt;

&lt;p&gt;While the 3.x branch will be much less disruptive than the jump from 1.x to 2.x (after all we won't need to rewrite the whole codebase this time! 😁), it'll include a few breaking changes. Most of those are listed &lt;a href="https://github.com/yarnpkg/berry/issues/1406" rel="noopener noreferrer"&gt;here&lt;/a&gt; but, as you'll see, they are mostly about old workflows being deprecated, and are unlikely to affect most codebases.&lt;/p&gt;

&lt;p&gt;One important note though: given that Node 10 will reach its end-of-life in April, it's likely that Yarn 3 will be Node 12+ only. So if you want to prepare for it, start considering upgrading to either Node 12 or, better yet, 14!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>npm</category>
      <category>node</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Yarn 2.3 🍦✨ Info Command, Detailed Options, Nohoist, ... </title>
      <dc:creator>Maël Nison</dc:creator>
      <pubDate>Fri, 02 Oct 2020 10:56:46 +0000</pubDate>
      <link>https://dev.to/arcanis/yarn-2-3-info-command-detailed-options-nohoist-409h</link>
      <guid>https://dev.to/arcanis/yarn-2-3-info-command-detailed-options-nohoist-409h</guid>
      <description>&lt;p&gt;Howdy! Another big month just went by, 2020 confirming being a very weird year for everyone. I hope things will be ok for you, wherever you are.&lt;/p&gt;

&lt;p&gt;As for Yarn itself, we're happy to meet you again to talk a bit about the highlights for the work we've done in the third minor of the Yarn 2 release line! Remember that we try to limit these blog posts to about three core items, and that the exhaustive list will always be in &lt;a href="https://github.com/yarnpkg/berry/blob/master/CHANGELOG.md" rel="noopener noreferrer"&gt;our repository&lt;/a&gt;. Check it out sometime, there's some very good stuff there too! 📝&lt;/p&gt;

&lt;p&gt;And in case you missed our previous release notes, don't forget to take a look at them for even more awesome stuff: &lt;a href="https://dev.to/arcanis/yarn-2-1-git-workspaces-focused-installs-loose-mode-live-playground-4kfc"&gt;2.1&lt;/a&gt; | &lt;a href="https://dev.to/arcanis/yarn-2-2-dedupe-faster-lighter-ha5"&gt;2.2&lt;/a&gt; 😃&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Don't know how to upgrade?&lt;/strong&gt; It's easy: just run yarn set version berry in your project, and you'll get the latest build. Want to skip the upgrade? Just revert the changes!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Info command
&lt;/h2&gt;

&lt;p&gt;Every now and then, we have this dependency that we want to know more about. We want to know its authors, we want to know its license, we want to know its size ... there's a lot of thing we want to know! And sometimes, we want to retrieve those information from many different packages at once.&lt;/p&gt;

&lt;p&gt;Yarn already provides the &lt;a href="https://yarnpkg.com/cli/npm/info" rel="noopener noreferrer"&gt;&lt;code&gt;yarn npm info&lt;/code&gt; command&lt;/a&gt;, but this command is a bit special in that it prints  by default the latest info from the npm registry ... and that's not necessarily what we are using!&lt;/p&gt;

&lt;p&gt;To address some of the problem with this command, we're now introducing a &lt;a href="https://yarnpkg.com/cli/info" rel="noopener noreferrer"&gt;new top-level command, &lt;code&gt;yarn info&lt;/code&gt;&lt;/a&gt;. It looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1037931%2F94694323-02cbe900-0335-11eb-8166-c21b1c66ffe9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1037931%2F94694323-02cbe900-0335-11eb-8166-c21b1c66ffe9.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First, wow, that's pretty! But there are a few interesting things we can note about this display:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It prints by default the information based on what's currently used by the active workspace. I could use the &lt;code&gt;-A,--all&lt;/code&gt; or &lt;code&gt;-R,--recursive&lt;/code&gt; flags to change that, though!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It prints less information than &lt;code&gt;yarn npm info&lt;/code&gt;. For instance, there's little point in printing the README content as a raw single-line string, so we removed it. By default, &lt;code&gt;yarn info&lt;/code&gt; will only print the most relevant information.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;But it prints &lt;em&gt;more&lt;/em&gt; information than &lt;code&gt;yarn npm info&lt;/code&gt; as well! For instance, because we passed the &lt;code&gt;--cache&lt;/code&gt; flag, it also reported the size of the package in the cache, and its exact location.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are many other gems in the command. By passing the &lt;code&gt;--manifest&lt;/code&gt; flag you also get additional fields like the license or the homepage. By passing the &lt;code&gt;--json&lt;/code&gt; flag you generate a stream of data that can be easily transformed using &lt;a href="https://stedolan.github.io/jq/" rel="noopener noreferrer"&gt;jq&lt;/a&gt;. You can even add your own data sections if you want, by using our plugin system! Ever wanted a place to show the number of downloads for your dependencies? Their CVEs? Their maintainers? Just use the provided hook, and all those information are yours to give!&lt;/p&gt;

&lt;h2&gt;
  
  
  Option Documentation
&lt;/h2&gt;

&lt;p&gt;You might not be aware of it, but Yarn uses a pretty unique CLI framework: &lt;a href="https://github.com/arcanis/clipanion" rel="noopener noreferrer"&gt;Clipanion&lt;/a&gt;. Very few tools have as much requirements as we do, and it was very important for us to be able to fix bugs and implement features without decreasing our velocity.&lt;/p&gt;

&lt;p&gt;In the latest Clipanion update, our contributors implemented a syntax to individually document options. Another one took this new feature, and went over every command, documenting each option one by one. The result looks absolutely great:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1037931%2F94702462-162f8200-033e-11eb-965a-f08dadaf2064.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1037931%2F94702462-162f8200-033e-11eb-965a-f08dadaf2064.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Because our CLI is the source of our website's documentation, you can find the exact same information &lt;a href="https://yarnpkg.com/cli/add" rel="noopener noreferrer"&gt;online&lt;/a&gt;. We hope this effort will prove useful to you, as you discover new features you weren't even aware of until now!&lt;/p&gt;

&lt;h2&gt;
  
  
  Nohoist
&lt;/h2&gt;

&lt;p&gt;As package manager authors, we try to do our best to support the ecosystem, sometimes going as far as building features just to help one single large project migrating to better practices. In 2017, in order to let React Native users use our newly released &lt;a href="https://yarnpkg.com/features/workspaces" rel="noopener noreferrer"&gt;workspaces&lt;/a&gt;, we implemented a feature called &lt;a href="https://classic.yarnpkg.com/blog/2018/02/15/nohoist/" rel="noopener noreferrer"&gt;nohoist&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Nohoist was a bit weird. It accepted glob patterns, and presumably the paths matching this glob pattern couldn't be hoisted. But what if their ancestors were hoisted? Was it meant to support targeting deep packages? After all, it was really only meant to help React Native users in one specific case. Because the feature itself wasn't entirely clear, it suffered from many bugs over the years, where noone really knew what to do of it. In Yarn 2.0, we decided to completely remove it.&lt;/p&gt;

&lt;p&gt;Now, the problem is, React Native &lt;a href="https://github.com/facebook/react-native/issues/20832" rel="noopener noreferrer"&gt;still doesn't support workspaces without help&lt;/a&gt;. And we like React Native users. So we've been looking for a way to reintroduce something similar to &lt;code&gt;nohoist&lt;/code&gt;, but in a way that actually made sense to us. That's where we introduce you to &lt;strong&gt;hoisting limits&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;nodeLinker&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;node-modules&lt;/span&gt;
&lt;span class="na"&gt;nmHoistingLimits&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;workspaces&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;By configuring the &lt;a href="https://yarnpkg.com/configuration/yarnrc#nmHoistingLimits" rel="noopener noreferrer"&gt;&lt;code&gt;nmHoistingLimits&lt;/code&gt; setting&lt;/a&gt; to &lt;code&gt;workspaces&lt;/code&gt; when using the node_modules linker, Yarn will prevent packages from being hoisted past the workspaces that transitively depends on them. In practice, it means that you don't need to care about the specific hoisting glob patterns: just declare where the hoisting limit is, and Yarn will take care of the rest.&lt;/p&gt;

&lt;p&gt;This design is interesting, because it allows us to support one additional feature: "safe hoisting". See, one problem with the classic hoisting is that it makes it very likely that you're going to eventually start referring to dependencies without explicitly listing them. Then your users install your packages, and all hell breaks loose.&lt;/p&gt;

&lt;p&gt;By configuring &lt;code&gt;nmHoistingLimits&lt;/code&gt; on &lt;code&gt;dependencies&lt;/code&gt;, Yarn will prevent packages from being hoist past their &lt;em&gt;transitive top-level dependent&lt;/em&gt;. It may seem a bit arcane, said like this, but it's actually quite simple! Imagine the following project:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1037931%2F94700298-943e5980-033b-11eb-95c7-564ab70e5fae.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1037931%2F94700298-943e5980-033b-11eb-95c7-564ab70e5fae.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With the default hoisting, it would turn into the following, &lt;a href="https://yarnpkg.com/advanced/rulebook#packages-should-only-ever-require-what-they-formally-list-in-their-dependencies" rel="noopener noreferrer"&gt;mistakenly&lt;/a&gt; letting you access all dependencies as your own:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1037931%2F94702122-b0db9100-033d-11eb-8cca-7d4071473441.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1037931%2F94702122-b0db9100-033d-11eb-8cca-7d4071473441.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With &lt;code&gt;nmHoistingLimits&lt;/code&gt; set on &lt;code&gt;dependencies&lt;/code&gt;, Yarn will instead generate the following, ensuring that you won't ever be able to mistakenly require dependencies you don't list as your own:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1037931%2F94701050-7c1b0a00-033c-11eb-8419-abd52b651da1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1037931%2F94701050-7c1b0a00-033c-11eb-8419-abd52b651da1.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Of course it has its own drawbacks, since the imperfect deduplication also means an heavier disk footprint and slower installs, but it may provide a good safety valve until you can migrate to standard PnP installs.&lt;/p&gt;
&lt;h2&gt;
  
  
  What's to come?
&lt;/h2&gt;

&lt;p&gt;With Hacktoberfest coming, now is as good a time as ever to let you know about our issues labelled &lt;a href="https://github.com/yarnpkg/berry/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22" rel="noopener noreferrer"&gt;Good First Issues&lt;/a&gt;! In fact, we wrote a whole article about it a few days ago:&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/arcanis" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F111910%2F336c999d-e4e1-4590-bf13-8c9a82bbe6bb.jpeg" alt="arcanis"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/arcanis/yarn-hacktoberfest-ao7" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Yarn 🎊 Hacktoberfest &lt;/h2&gt;
      &lt;h3&gt;Maël Nison ・ Sep 28 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#hacktoberfest&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#node&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#npm&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



&lt;p&gt;As for the features we're planning for Yarn 2.4, our focus are currently on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adding back &lt;code&gt;yarn audit&lt;/code&gt; with revamped output&lt;/li&gt;
&lt;li&gt;New changelog generation capabilities&lt;/li&gt;
&lt;li&gt;PnP support for the &lt;code&gt;exports&lt;/code&gt; field, and ESM in general&lt;/li&gt;
&lt;li&gt;And more...!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Of course that's only on the top of my head, so it's possible our objectives shift during the next weeks depending on our own priorities - and of course depending on whether you help us or not 😛&lt;/p&gt;

&lt;p&gt;One very long-term topic we're starting to explore are package support for non-&lt;br&gt;
JavaScript languages (think C++, Python, Rust, PHP, ...). We already have a few ideas (we have an &lt;a href="https://github.com/yarnpkg/berry/pull/1697" rel="noopener noreferrer"&gt;experimental branch&lt;/a&gt; generating CMake files, and another contributor played with Python), and we'll keep evaluating the work needed to get there during the next few months. If you're familiar with any of those ecosystems and are interested in helping Yarn become the universal package manager, please contact us on &lt;a href="https://discord.com/invite/yarnpkg" rel="noopener noreferrer"&gt;Discord&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>npm</category>
      <category>node</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Yarn 🎊 Hacktoberfest </title>
      <dc:creator>Maël Nison</dc:creator>
      <pubDate>Mon, 28 Sep 2020 11:36:40 +0000</pubDate>
      <link>https://dev.to/arcanis/yarn-hacktoberfest-ao7</link>
      <guid>https://dev.to/arcanis/yarn-hacktoberfest-ao7</guid>
      <description>&lt;p&gt;As you may know, every October the dev community at large starts an event called &lt;a href="https://hacktoberfest.digitalocean.com/"&gt;Hacktoberfest&lt;/a&gt;. The idea is simple: a whole month specially designed to help onboard people with little to no prior experience contributing to open-source codebases. In return, you get t-shirts, a valuable experience, and maybe will find a community you'll want to be a part of. Win-win!&lt;/p&gt;

&lt;p&gt;October is almost there, so it's a good time to think: what are some interesting tasks you could tackle? Not too hard but still impactful? I happen to lead the work on &lt;a href="https://yarnpkg.com/"&gt;Yarn&lt;/a&gt;, the famous JavaScript package manager, and I can tell you: &lt;strong&gt;we have a bit of everything!&lt;/strong&gt; Whether you prefer frontend work or brain teasers, I'm sure we'll find you great project to hone your skills 😃&lt;/p&gt;

&lt;p&gt;I've listed some tasks I have in mind, but please feel free to join our little community on &lt;a href="https://discord.com/invite/yarnpkg"&gt;Discord&lt;/a&gt;! My fellow maintainers and me will be happy to give you more pointers, ideas, help, and feedback. Until then, happy Hacktoberfest! 🚀&lt;/p&gt;




&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;If you're fluent in React&lt;/strong&gt;, we're looking to revamp the &lt;a href="https://yarnpkg.com/?q=react&amp;amp;p=1"&gt;package search interface&lt;/a&gt; on our website. We're displaying a lot of information, and we'd like to highlight the most important ones in as few clicks as possible.&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;If you're a great technical writer&lt;/strong&gt;, we could really use your help refining our documentation. We're often not native english speakers, and I personally make typos, grammatical errors, or sometimes even forget words in the of my sentences.&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;If you'd like working on the CLI&lt;/strong&gt;, we have various tasks tagged &lt;a href="https://github.com/yarnpkg/berry/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22"&gt;Good First Issue&lt;/a&gt; that we've identified as being useful without requiring more than a minimal amount of context.&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;If you want to take a look at the infra side&lt;/strong&gt;, talk with us! There are various places where we'd benefit from better typings, automated workflows, extra tests, or many other small things that let us focus on designing new features.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>hacktoberfest</category>
      <category>node</category>
      <category>webdev</category>
      <category>npm</category>
    </item>
    <item>
      <title>Yarn Tips, part 1</title>
      <dc:creator>Maël Nison</dc:creator>
      <pubDate>Sun, 13 Sep 2020 16:04:26 +0000</pubDate>
      <link>https://dev.to/arcanis/yarn-tips-part-1-g52</link>
      <guid>https://dev.to/arcanis/yarn-tips-part-1-g52</guid>
      <description>&lt;p&gt;After leading Yarn's development for a bit more than three years now, I noticed that many of our users weren't aware of some very useful features and settings. While often documented on our &lt;a href="https://yarnpkg.com/"&gt;website&lt;/a&gt;, most of the time it was a case of &lt;em&gt;"I didn't even know I could solve my problem this way"&lt;/em&gt;. To help you discover them, I started the following initiative:&lt;/p&gt;


&lt;blockquote class="ltag__twitter-tweet"&gt;

  &lt;div class="ltag__twitter-tweet__main"&gt;
    &lt;div class="ltag__twitter-tweet__header"&gt;
      &lt;img class="ltag__twitter-tweet__profile-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--exURfZRy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/1157296099679440896/DL8L2-XK_normal.jpg" alt="Maël profile image"&gt;
      &lt;div class="ltag__twitter-tweet__full-name"&gt;
        Maël
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__username"&gt;
        &lt;a class="comment-mentioned-user" href="https://dev.to/arcanis"&gt;@arcanis&lt;/a&gt;

      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__twitter-logo"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P4t6ys1m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-f95605061196010f91e64806688390eb1a4dbc9e913682e043eb8b1e06ca484f.svg" alt="twitter logo"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__body"&gt;
      In this thread: a bunch of tips and “Did you know” about Yarn (and Yarn 2 in particular), updated daily ⬇
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__date"&gt;
      14:37 PM - 31 Aug 2020
    &lt;/div&gt;


    &lt;div class="ltag__twitter-tweet__actions"&gt;
      &lt;a href="https://twitter.com/intent/tweet?in_reply_to=1300442490265362432" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-reply-action.svg" alt="Twitter reply action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/retweet?tweet_id=1300442490265362432" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-retweet-action.svg" alt="Twitter retweet action"&gt;
      &lt;/a&gt;
      32
      &lt;a href="https://twitter.com/intent/like?tweet_id=1300442490265362432" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-like-action.svg" alt="Twitter like action"&gt;
      &lt;/a&gt;
      108
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;


&lt;p&gt;This series of article will go over this thread, 5 tweets each time, to dive into them and provide more information than tweets would allow. And if you find these tips interesting, don't forget to follow me on &lt;a href="https://twitter.com/arcanis"&gt;Twitter&lt;/a&gt; to learn more about Yarn and its behind-the-scene development 😃&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The node_modules linker
&lt;/h2&gt;


&lt;blockquote class="ltag__twitter-tweet"&gt;

  &lt;div class="ltag__twitter-tweet__main"&gt;
    &lt;div class="ltag__twitter-tweet__header"&gt;
      &lt;img class="ltag__twitter-tweet__profile-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--exURfZRy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/1157296099679440896/DL8L2-XK_normal.jpg" alt="Maël profile image"&gt;
      &lt;div class="ltag__twitter-tweet__full-name"&gt;
        Maël
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__username"&gt;
        &lt;a class="comment-mentioned-user" href="https://dev.to/arcanis"&gt;@arcanis&lt;/a&gt;

      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__twitter-logo"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P4t6ys1m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-f95605061196010f91e64806688390eb1a4dbc9e913682e043eb8b1e06ca484f.svg" alt="twitter logo"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__body"&gt;
      1 ✌️ Yarn 2 handles node_modules projects just fine. In fact, our test suites proved our n_m linker to be more stable than in Yarn 1! Only use PnP if you want too 🙂&lt;br&gt;&lt;a href="https://t.co/xz4mzoWViB"&gt;yarnpkg.com/configuration/…&lt;/a&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__date"&gt;
      14:37 PM - 31 Aug 2020
    &lt;/div&gt;


    &lt;div class="ltag__twitter-tweet__actions"&gt;
      &lt;a href="https://twitter.com/intent/tweet?in_reply_to=1300442491368476672" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-reply-action.svg" alt="Twitter reply action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/retweet?tweet_id=1300442491368476672" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-retweet-action.svg" alt="Twitter retweet action"&gt;
      &lt;/a&gt;
      4
      &lt;a href="https://twitter.com/intent/like?tweet_id=1300442491368476672" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-like-action.svg" alt="Twitter like action"&gt;
      &lt;/a&gt;
      19
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;


&lt;p&gt;
  Click to learn more!
  &lt;p&gt;Funnily, we've had a few people opening issues on our bug tracker to report that "Yarn doesn't generate a node_modules when I run an install, something is wrong!". Then we ask them to still try to run their programs and, lo and behold, it works! This is due to Yarn 2 using a new install strategy by default, that we call &lt;a href="https://yarnpkg.com/features/pnp"&gt;Plug'n'Play&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Still, Plug'n'Play isn't for absolutely everyone. Some older projects aren't compatible with it, and some others see preexisting bugs being exposed, usually under the form of missing dependency reports.&lt;/p&gt;

&lt;p&gt;As regular users we don't necessarily want to have to deal with all that, so Yarn still features the good old &lt;code&gt;node_modules&lt;/code&gt; strategy. &lt;a href="https://yarnpkg.com/configuration/yarnrc#nodeLinker"&gt;Just one setting to set&lt;/a&gt;, an install to run, and you'll find your &lt;code&gt;node_modules&lt;/code&gt; back! Without the Plug'n'Play stability and performance improvements, of course, but at least you'll be in known territory and ready to pursue your work.&lt;/p&gt;



&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The &lt;code&gt;packageExtensions&lt;/code&gt; settings
&lt;/h2&gt;


&lt;blockquote class="ltag__twitter-tweet"&gt;

  &lt;div class="ltag__twitter-tweet__main"&gt;
    &lt;div class="ltag__twitter-tweet__header"&gt;
      &lt;img class="ltag__twitter-tweet__profile-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--exURfZRy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/1157296099679440896/DL8L2-XK_normal.jpg" alt="Maël profile image"&gt;
      &lt;div class="ltag__twitter-tweet__full-name"&gt;
        Maël
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__username"&gt;
        &lt;a class="comment-mentioned-user" href="https://dev.to/arcanis"&gt;@arcanis&lt;/a&gt;

      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__twitter-logo"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P4t6ys1m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-f95605061196010f91e64806688390eb1a4dbc9e913682e043eb8b1e06ca484f.svg" alt="twitter logo"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__body"&gt;
      2 🧩 But if you use PnP, and if a project doesn’t list its dependencies, just use `packageExtensions` to fix it in a few seconds!&lt;br&gt;&lt;a href="https://t.co/PvFkDP600D"&gt;yarnpkg.com/configuration/…&lt;/a&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__date"&gt;
      14:37 PM - 31 Aug 2020
    &lt;/div&gt;


    &lt;div class="ltag__twitter-tweet__actions"&gt;
      &lt;a href="https://twitter.com/intent/tweet?in_reply_to=1300442492597399553" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-reply-action.svg" alt="Twitter reply action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/retweet?tweet_id=1300442492597399553" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-retweet-action.svg" alt="Twitter retweet action"&gt;
      &lt;/a&gt;
      0
      &lt;a href="https://twitter.com/intent/like?tweet_id=1300442492597399553" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-like-action.svg" alt="Twitter like action"&gt;
      &lt;/a&gt;
      11
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;


&lt;p&gt;
  Click to learn more!
  &lt;p&gt;That being said, enabling the &lt;code&gt;node_modules&lt;/code&gt; linker should probably be seen as a last resort option. After all, there are (many) reasons we decided to make it the exception rather than the norm. But how to proceed when working with problematic packages that don't list all their dependencies? Do we need to wait for them to fix that? Fortunately not.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://yarnpkg.com/configuration/yarnrc#packageExtensions"&gt;&lt;code&gt;packageExtensions&lt;/code&gt;&lt;/a&gt; setting is the recommended way to fix such problems. Just declare yourself the dependencies that the relevant packages are missing, and let Yarn deal with that. I myself use it quite a lot in my projects, with for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;packageExtensions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@apollo/client@*"&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;dependencies&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@wry/context"&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;*"&lt;/span&gt;
    &lt;span class="na"&gt;peerDependenciesMeta&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;react"&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;optional&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
      &lt;span class="na"&gt;react-dom&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;optional&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And from time to time, don't forget you can send PRs upstream to solve this problem durably both for you and your community!&lt;/p&gt;



&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Yarn's E2E battery
&lt;/h2&gt;


&lt;blockquote class="ltag__twitter-tweet"&gt;

  &lt;div class="ltag__twitter-tweet__main"&gt;
    &lt;div class="ltag__twitter-tweet__header"&gt;
      &lt;img class="ltag__twitter-tweet__profile-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--exURfZRy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/1157296099679440896/DL8L2-XK_normal.jpg" alt="Maël profile image"&gt;
      &lt;div class="ltag__twitter-tweet__full-name"&gt;
        Maël
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__username"&gt;
        &lt;a class="comment-mentioned-user" href="https://dev.to/arcanis"&gt;@arcanis&lt;/a&gt;

      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__twitter-logo"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P4t6ys1m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-f95605061196010f91e64806688390eb1a4dbc9e913682e043eb8b1e06ca484f.svg" alt="twitter logo"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__body"&gt;
      3 🔭 Yarn runs E2E tests against various projects from the community every four hours. If something looks off (new release missing a dependency?), we’re typically first aware, and often contribute fixes ourselves&lt;br&gt;&lt;a href="https://t.co/eXYrbbrjkX"&gt;github.com/yarnpkg/berry#…&lt;/a&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__date"&gt;
      14:37 PM - 31 Aug 2020
    &lt;/div&gt;


    &lt;div class="ltag__twitter-tweet__actions"&gt;
      &lt;a href="https://twitter.com/intent/tweet?in_reply_to=1300442493872418816" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-reply-action.svg" alt="Twitter reply action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/retweet?tweet_id=1300442493872418816" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-retweet-action.svg" alt="Twitter retweet action"&gt;
      &lt;/a&gt;
      2
      &lt;a href="https://twitter.com/intent/like?tweet_id=1300442493872418816" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-like-action.svg" alt="Twitter like action"&gt;
      &lt;/a&gt;
      21
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;


&lt;p&gt;
  Click to learn more!
  &lt;p&gt;While a large part of Yarn 2 has been to, well, implement Yarn, we also wanted to help fix the ecosystem. After all, what good is it to build a package manager that enforces strict rules if nobody is following them? So we submitted many, many PRs, adding missing dependencies to projects that forgot them, explaining the danger, and making sure that everyone had time to address those problems before our release in January.&lt;/p&gt;

&lt;p&gt;Still, even projects that actively took steps to fix those issues sometimes had regression. For example, large OSS projects like Next.js, because of their very high velocity, sometimes merged PRs that didn't list new dependencies. In the worst cases, we only noticed it when someone opened an issue on our bug tracker. Not great!&lt;/p&gt;

&lt;p&gt;And so, after some time, we decided to start implementing our own set of E2E tests. Baked by a bunch of &lt;a href="https://github.com/yarnpkg/berry/tree/master/.github/workflows"&gt;GitHub workflows&lt;/a&gt;, they run every four hours and let us know should anything awry happen in the ecosystem. Thanks to this, we help ensure that the JavaScript ecosystem not only trends towards sanity, but doesn't deviate from the goal even when we're not looking 😉&lt;/p&gt;



&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Cache integrity
&lt;/h2&gt;


&lt;blockquote class="ltag__twitter-tweet"&gt;

  &lt;div class="ltag__twitter-tweet__main"&gt;
    &lt;div class="ltag__twitter-tweet__header"&gt;
      &lt;img class="ltag__twitter-tweet__profile-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--exURfZRy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/1157296099679440896/DL8L2-XK_normal.jpg" alt="Maël profile image"&gt;
      &lt;div class="ltag__twitter-tweet__full-name"&gt;
        Maël
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__username"&gt;
        &lt;a class="comment-mentioned-user" href="https://dev.to/arcanis"&gt;@arcanis&lt;/a&gt;

      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__twitter-logo"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P4t6ys1m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-f95605061196010f91e64806688390eb1a4dbc9e913682e043eb8b1e06ca484f.svg" alt="twitter logo"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__body"&gt;
      4 🔥 Yarn 2 checks the cache integrity between each install. It’s a tiny bit slower, but you get the certainty that your project is in a good state if `yarn install` exits without error code 🙂
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__date"&gt;
      14:37 PM - 31 Aug 2020
    &lt;/div&gt;


    &lt;div class="ltag__twitter-tweet__actions"&gt;
      &lt;a href="https://twitter.com/intent/tweet?in_reply_to=1300442495256604672" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-reply-action.svg" alt="Twitter reply action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/retweet?tweet_id=1300442495256604672" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-retweet-action.svg" alt="Twitter retweet action"&gt;
      &lt;/a&gt;
      0
      &lt;a href="https://twitter.com/intent/like?tweet_id=1300442495256604672" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-like-action.svg" alt="Twitter like action"&gt;
      &lt;/a&gt;
      12
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;


&lt;p&gt;
  Click to learn more!
  &lt;p&gt;Back in v1 our cache could, sometimes, be corrupted. It was a fairly rare occurrence, but in theory it could happen. And, should this happen, it was impossible for Yarn to detect it, which would eventually lead to very difficult debug sessions.&lt;/p&gt;

&lt;p&gt;In the v2, Yarn is much more careful, and runs a full validation pass before attempting to install the packages on the disk. The validation is really fast (I think it takes less than 2 seconds on our own repository), and it protects against various problems. For example, since Plug'n'Play can share the same cache between all projects on your machine, it may happen that you want to modify a dependency's sources during a debug session, and forget to revert it. With the integrity check, Yarn will now let you know the problem the next time you run &lt;code&gt;yarn install&lt;/code&gt;!&lt;/p&gt;



&lt;/p&gt;

&lt;h2&gt;
  
  
  5. File cloning
&lt;/h2&gt;


&lt;blockquote class="ltag__twitter-tweet"&gt;

  &lt;div class="ltag__twitter-tweet__main"&gt;
    &lt;div class="ltag__twitter-tweet__header"&gt;
      &lt;img class="ltag__twitter-tweet__profile-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--exURfZRy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/1157296099679440896/DL8L2-XK_normal.jpg" alt="Maël profile image"&gt;
      &lt;div class="ltag__twitter-tweet__full-name"&gt;
        Maël
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__username"&gt;
        &lt;a class="comment-mentioned-user" href="https://dev.to/arcanis"&gt;@arcanis&lt;/a&gt;

      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__twitter-logo"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P4t6ys1m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-f95605061196010f91e64806688390eb1a4dbc9e913682e043eb8b1e06ca484f.svg" alt="twitter logo"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__body"&gt;
      5 👥 Yarn will use native file cloning when available, so you’ll only pay the size of your cache once, not per project&lt;br&gt;&lt;a href="https://t.co/dIogfgyJxC"&gt;nodejs.org/api/fs.html#fs…&lt;/a&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__date"&gt;
      14:37 PM - 31 Aug 2020
    &lt;/div&gt;


    &lt;div class="ltag__twitter-tweet__actions"&gt;
      &lt;a href="https://twitter.com/intent/tweet?in_reply_to=1300442496540069889" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-reply-action.svg" alt="Twitter reply action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/retweet?tweet_id=1300442496540069889" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-retweet-action.svg" alt="Twitter retweet action"&gt;
      &lt;/a&gt;
      0
      &lt;a href="https://twitter.com/intent/like?tweet_id=1300442496540069889" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-like-action.svg" alt="Twitter like action"&gt;
      &lt;/a&gt;
      10
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;


&lt;p&gt;
  Click to learn more!
  &lt;p&gt;One interesting thing that made &lt;code&gt;node_modules&lt;/code&gt; installs very slow was way the installs and the cache interacted together. Back in Yarn 1, our cache contained the unpacked archives, and we copied each file into each project during installs. We used file cloning as well (using &lt;a href="https://nodejs.org/api/fs.html#fs_fs_copyfile_src_dest_mode_callback"&gt;&lt;code&gt;fs.copyFile&lt;/code&gt;&lt;/a&gt;), but because of the sheer amount of files, a lot of I/O still had to be performed.&lt;/p&gt;

&lt;p&gt;In Yarn 2, the pipeline is quite different. Plug'n'Play allows us to keep the dependencies compressed, meaning that there isn't any difference between the cache and the install artifacts! Because of this, even in the absolute worst case, we only have to perform the clone operation exactly one time for each package - compared to the hundreds of times it previously was.&lt;/p&gt;



&lt;/p&gt;

</description>
      <category>npm</category>
      <category>javascript</category>
      <category>node</category>
    </item>
    <item>
      <title>Yarn 2.2 🚅🌟 Dedupe, Faster, Lighter, ...</title>
      <dc:creator>Maël Nison</dc:creator>
      <pubDate>Fri, 28 Aug 2020 12:16:40 +0000</pubDate>
      <link>https://dev.to/arcanis/yarn-2-2-dedupe-faster-lighter-ha5</link>
      <guid>https://dev.to/arcanis/yarn-2-2-dedupe-faster-lighter-ha5</guid>
      <description>&lt;p&gt;I hope you enjoyed the summer! As for us, we've been hard at work, and this update comes with its good chunk of improvements in various aspects. As usual we keep a detailed list in &lt;a href="https://github.com/yarnpkg/berry/blob/master/CHANGELOG.md" rel="noopener noreferrer"&gt;our repository&lt;/a&gt;, but let's go over the highlights!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Don't know how to upgrade?&lt;/strong&gt; It's easy: just run &lt;code&gt;yarn set version berry&lt;/code&gt; in your project, and you'll get the latest build. Want to skip the upgrade? Just revert the changes!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Dedupe command
&lt;/h2&gt;

&lt;p&gt;One of Yarn's core values is predictability. We want you to be confident that your project won't suddenly change in unexpected ways. The lockfile is a large part of this, ensuring that you always get the same dependencies during install, now or in the future.&lt;/p&gt;

&lt;p&gt;To explain what the dedupe command is, I first need to explain a bit the lockfile format. In Yarn, we have &lt;a href="https://yarnpkg.com/advanced/lexicon#descriptor" rel="noopener noreferrer"&gt;descriptors&lt;/a&gt; (a combination of package name and range), and we associate them with &lt;a href="https://yarnpkg.com/advanced/lexicon#reference" rel="noopener noreferrer"&gt;references&lt;/a&gt; (versions). A lockfile essentially stores which reference is linked to a specific range.&lt;/p&gt;

&lt;p&gt;So what happens when you add new ranges? For example if you already have &lt;code&gt;lodash@^4.0.0&lt;/code&gt; in your lockfile, resolved to &lt;code&gt;4.0.0&lt;/code&gt;, and suddenly add &lt;code&gt;lodash@^4.1.0&lt;/code&gt;? Since this new range isn't compatible with the old one, Yarn will need to resolve it on its own - let's say to &lt;code&gt;4.1.0&lt;/code&gt;. And now is the interesting part - remember when I said that Yarn tries to be predictable, and thus avoid to update things unless ordered to do so? In this case, it means that &lt;code&gt;lodash@^4.0.0&lt;/code&gt; will &lt;strong&gt;not&lt;/strong&gt; be updated to use &lt;code&gt;4.1.0&lt;/code&gt;, even if they'd be compatible. Instead, it will keep using whatever else it was using before, meaning that you'll end up with both &lt;code&gt;4.0.0&lt;/code&gt; and &lt;code&gt;4.1.0&lt;/code&gt; in your tree.&lt;/p&gt;

&lt;p&gt;Functionally this isn't a problem, because both ranges will use versions compatible with what they advertise. In practice however, it may cause your lockfile to grow needlessly over time as it starts referencing multiple copies of packages, despite the fact that they would have been compatible if the lockfile had been allowed to make wider changes.&lt;/p&gt;

&lt;p&gt;The new &lt;a href="https://yarnpkg.com/cli/dedupe" rel="noopener noreferrer"&gt;&lt;code&gt;yarn dedupe&lt;/code&gt; command&lt;/a&gt; is our solution to that. By default, it will apply a resolution pass that will go over each range and use the highest compatible version that's already in the lockfile. This has various advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It doesn't require the network, so very fast&lt;/li&gt;
&lt;li&gt;In the end, most duplicates will be removed&lt;/li&gt;
&lt;li&gt;It's very predictable: the highest version wins&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Of course, if you have incompatible ranges (for example &lt;code&gt;^1&lt;/code&gt; and &lt;code&gt;^2&lt;/code&gt;), they won't be deduped together, since that would lead to invalid trees. In this case, you'll have to fix your dependencies to remove references to the older range.&lt;/p&gt;

&lt;p&gt;Finally, if you want this kind of check to happen on your CI, the &lt;code&gt;-c,--check&lt;/code&gt; option will cause the dedupe algorithm to report an error if optimizations would be possible.&lt;/p&gt;

&lt;h2&gt;
  
  
  Performances
&lt;/h2&gt;

&lt;p&gt;Better performances lead to better UX, and Yarn is a lot about a good UX. To this end, we've done various improvements in the 2.2 to improve the performances on real-world projects. For instance, Gatsby on cold cache went 92s → 83s, and 17s → 13s on hot cache.&lt;/p&gt;

&lt;p&gt;And because we think we should do better than flaunt about perf increases without live numbers to back them up and publicly track regressions, we've setup a &lt;a href="https://p.datadoghq.eu/sb/d2wdprp9uki7gfks-c562c42f4dfd0ade4885690fa719c818" rel="noopener noreferrer"&gt;live dashboard&lt;/a&gt; with our friends at &lt;a href="https://www.datadoghq.com/" rel="noopener noreferrer"&gt;Datadog&lt;/a&gt; that shows the results of the daily benchmarks we run against most common package managers. We're pretty happy about the results!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fd47lr3ndqr657ls5xf7w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fd47lr3ndqr657ls5xf7w.png" alt="Yarn's Live Benchmarks"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note that Yarn currently does a bit more work than its siblings on cold cache installs because we need to convert the registry archives in zip format, more suitable for the usage we have. As registries get better at this, we expect cold cache performances to drastically improve 🚅&lt;/p&gt;

&lt;h2&gt;
  
  
  Size
&lt;/h2&gt;

&lt;p&gt;Since we're recommending checking-in the Yarn binary in your repository, we better be careful about how large we are. Our team made various improvements in this regard, and Yarn 2.2 is now exactly 1.8MB large. To give you an idea:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Yarn Classic is ~5MB large&lt;/li&gt;
&lt;li&gt;pnpm is 35MB&lt;/li&gt;
&lt;li&gt;npm is 61MB&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, yeah. 1.8MB is nice, isn't it? 🙂&lt;/p&gt;

&lt;h2&gt;
  
  
  Telemetry
&lt;/h2&gt;

&lt;p&gt;One interesting change in the v2 is that we're going to enable basic opt-out telemetry. The full details are &lt;a href="https://yarnpkg.com/advanced/telemetry" rel="noopener noreferrer"&gt;here&lt;/a&gt;, but the gist is that we hope this will allow us to spend more time working on Yarn itself, and with a better understanding of how it's used in our community at large - which will then help inform the tradeoffs we make.&lt;/p&gt;

&lt;p&gt;The telemetry payload is easily &lt;a href="https://yarnpkg.com/advanced/telemetry#how-can-i-disable-it" rel="noopener noreferrer"&gt;opt-out&lt;/a&gt;, and we're committed to send as little information as possible. As soon as the data starts flowing we plan to build public dashboards (similar to our &lt;a href="https://p.datadoghq.eu/sb/d2wdprp9uki7gfks-c562c42f4dfd0ade4885690fa719c818" rel="noopener noreferrer"&gt;benchmarks&lt;/a&gt;) that will help everyone get a better picture of the project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other works
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Smaller Improvements
&lt;/h4&gt;

&lt;p&gt;This is only a very short list, as always please look at our &lt;a href="https://github.com/yarnpkg/berry/blob/master/CHANGELOG.md" rel="noopener noreferrer"&gt;official changelog&lt;/a&gt; for a comprehensive list, but the 2.2 also ships with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The shell script language now supports more syntaxes (shell groups &lt;code&gt;{ echo foo; echo bar } &amp;gt; bar&lt;/code&gt;, basic arithmetic &lt;code&gt;$(($RANDOM + 10))&lt;/code&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;--immutable&lt;/code&gt; flag now accepts an &lt;a href="https://yarnpkg.com/configuration/yarnrc#immutablePatterns" rel="noopener noreferrer"&gt;&lt;code&gt;immutablePatterns&lt;/code&gt;&lt;/a&gt; settings that you can use to define additional paths that aren't allowed to change during an install - useful to prevent changes to &lt;code&gt;.pnp.js&lt;/code&gt; or other artifacts&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Packages referenced via the &lt;code&gt;file:&lt;/code&gt; protocol will now update when running &lt;code&gt;yarn add&lt;/code&gt; again (they're still stored in the cache - prefer &lt;code&gt;portal:&lt;/code&gt; if you want a symlink-like behavior).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The new &lt;a href="https://yarnpkg.com/configuration/manifest#publishConfig.executableFiles" rel="noopener noreferrer"&gt;&lt;code&gt;publishConfig.executableFiles&lt;/code&gt; field&lt;/a&gt; lets you define paths in your package that should be flagged as executable. By default, since Windows has no way to express the executable flag, only files referenced in the &lt;code&gt;bin&lt;/code&gt; field will be marked as such, but sometimes you might need others.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Error messages have been clarified in various contexts, such as when accessing Node builtin within Webpack's browser context, when running &lt;code&gt;yarn add&lt;/code&gt; on unknown packages, or when a lingering package.json exists in a parent directory.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Website
&lt;/h4&gt;

&lt;p&gt;Multiple improvements were made on the website. In particular:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The migration guide now features a &lt;a href="https://yarnpkg.com/advanced/migration#step-by-step" rel="noopener noreferrer"&gt;step-by-step section&lt;/a&gt; that should help migrate without having to read the entire documentation beforehand.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The search engine now covers both the &lt;a href="https://yarnpkg.com/configuration/manifest" rel="noopener noreferrer"&gt;manifest&lt;/a&gt; and &lt;a href="https://yarnpkg.com/configuration/yarnrc" rel="noopener noreferrer"&gt;yarnrc&lt;/a&gt; pages, making it easier to find information about specific fields.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  "Package manager manager"
&lt;/h4&gt;

&lt;p&gt;We are &lt;a href="https://github.com/nodejs/TSC/issues/904" rel="noopener noreferrer"&gt;starting discussions&lt;/a&gt; with the Node TSC to bundle Yarn with Node in some capacity (the current plan is to ship a shim that would, in turn, install Yarn transparently the first time you call it). The full proposal can be found on the following repository: &lt;a href="https://github.com/arcanis/pmm" rel="noopener noreferrer"&gt;arcanis/pmm&lt;/a&gt;. We strongly advise that you play with it and let us know what you think!&lt;/p&gt;

&lt;p&gt;As often, this kind of change benefits from wide support, so if you use Yarn (or pnpm), please feel free to follow the discussion and contribute when relevant. If you don't use either, remember that others do, and shutting the proposal down purely because you wouldn't directly benefit from it may not be representative of an inclusive community.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's to come?
&lt;/h2&gt;

&lt;p&gt;We'll try to make more regular minor releases from now on, shipping exactly one minor per month (eventually leading up to the release of Yarn 3 in January 2021). Some topics we have in mind for the next one (come help us! we have a lot of &lt;a href="https://github.com/yarnpkg/berry/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22" rel="noopener noreferrer"&gt;Good First Issues&lt;/a&gt;!):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://twitter.com/arcanis/status/1298193746614312960" rel="noopener noreferrer"&gt;All-new &lt;code&gt;yarn info&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;New changelog generation capabilities&lt;/li&gt;
&lt;li&gt;PnP support for the &lt;code&gt;exports&lt;/code&gt; field, and ESM in general&lt;/li&gt;
&lt;li&gt;And more...!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Of course that's only on the top of my head, so it's possible our objectives shift during the next weeks depending on our own priorities - and of course depending on whether you help us or not 😛&lt;/p&gt;

&lt;p&gt;One very long-term topic we're starting to explore are package support for non-&lt;br&gt;
JavaScript languages (think C++, Python, Rust, PHP, ...). We already have a few ideas (we have an &lt;a href="https://github.com/yarnpkg/berry/pull/1697" rel="noopener noreferrer"&gt;experimental branch&lt;/a&gt; generating CMake files, and another contributor played with Python), and we'll keep evaluating the work needed to get there during the next few months. If you're familiar with any of those ecosystems and are interested in helping Yarn become the universal package manager, please contact us on &lt;a href="https://discord.com/invite/yarnpkg" rel="noopener noreferrer"&gt;Discord&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Until then stay safe, wear a mask, and see you next month 😉&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>npm</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Yarn 2.1 🐱‍🏍 Git Workspaces, Focused Installs, Loose mode, Live Playground, ...</title>
      <dc:creator>Maël Nison</dc:creator>
      <pubDate>Thu, 09 Jul 2020 14:05:27 +0000</pubDate>
      <link>https://dev.to/arcanis/yarn-2-1-git-workspaces-focused-installs-loose-mode-live-playground-4kfc</link>
      <guid>https://dev.to/arcanis/yarn-2-1-git-workspaces-focused-installs-loose-mode-live-playground-4kfc</guid>
      <description>&lt;p&gt;How are you doing since &lt;a href="https://dev.to/arcanis/introducing-yarn-2-4eh1"&gt;January&lt;/a&gt;? So many things happened since then. I hope you're all safe, wherever you are.&lt;/p&gt;

&lt;p&gt;As for today, we'll be here to talk about Yarn. And as far as Yarn goes I'm happy to report that our work continued at a very good pace! So good in fact that it's now time to release the next minor build, the 2.1 🎉&lt;/p&gt;

&lt;p&gt;Still, don't let this little number trick you: more than &lt;strong&gt;350&lt;/strong&gt; pull requests were merged since the previous release! This is an incredible pace for our project, only made possible by the dedicated community that gathered around our favorite tool 🌟&lt;/p&gt;

&lt;p&gt;So what's in the 2.1? Many, many things! We'll go over the main items, but a more detailed list can be found in &lt;a href="https://github.com/yarnpkg/berry/blob/master/CHANGELOG.md"&gt;our repository&lt;/a&gt;. You should check it out too, there's a lot of interesting tidbits!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Don't know how to upgrade?&lt;/strong&gt; It's easy: just run &lt;code&gt;yarn set version berry&lt;/code&gt; in your project, and you'll get the latest build. Want to skip the upgrade? Just revert the changes!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Linker improvements
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Node-modules linker
&lt;/h4&gt;

&lt;p&gt;Some people can't migrate to Plug'n'Play installs just yet. That's fine! Some of our contributors don't use it! &lt;a href="https://yarnpkg.com/configuration/yarnrc#nodeLinker"&gt;&lt;strong&gt;Yarn supports &lt;code&gt;node_modules&lt;/code&gt; installs too!&lt;/strong&gt;&lt;/a&gt; And thanks to &lt;a href="https://twitter.com/larixer"&gt;Larixer&lt;/a&gt;'s impressive work, we're happy to report that even large and complex repositories have successfully upgraded to Yarn 2. And when I say large, I mean &lt;a href="https://github.com/babel/babel/tree/next-8-dev"&gt;freaking massive ones&lt;/a&gt; 🤓&lt;/p&gt;

&lt;p&gt;In fact, our position is now that the node_modules linker in Yarn 2 is a &lt;strong&gt;strict improvement over the v1&lt;/strong&gt;. Multiple hoisting issues have been identified and fixed, and the workspace support has also been improved significantly.&lt;/p&gt;

&lt;p&gt;To give you an idea, back in the v1, Babel had never been able to use the stock Yarn workspaces. We all wanted it to happen, but because of the very tricky nature of self-hosted compiler repositories, it proved very challenging. Until now! &lt;strong&gt;The Babel and Jest repositories are now powered by Yarn 2,&lt;/strong&gt; and that's frankly the best seal of quality we could hope for.&lt;/p&gt;

&lt;p&gt;So if you're still on the fence about Plug'n'Play ... don't use it for now! Just migrate for all the other speed and stability and UX improvements 😃&lt;/p&gt;

&lt;h4&gt;
  
  
  Loose mode
&lt;/h4&gt;

&lt;p&gt;The Plug'n'Play linker also improved, with the introduction of the Loose Mode. In Loose Mode, Yarn will simply warn should the runtime make an unsafe module access, avoiding to throw hard exceptions. This works because we generate at install-time the hoisting map that would have been generated by the node-modules linker, then we use that as a fallback pool for any unspecified dependency. It's still unsafe, but now you can quickly get a bird's eye view of all the potential problems without having to fix them all immediately.&lt;/p&gt;

&lt;p&gt;Note that the loose mode &lt;strong&gt;isn't enabled by default&lt;/strong&gt; because, somewhat ironically, it may lead to more verbose executions than the strict mode depending on various factors. In particular, packages that wrapped optional require calls between &lt;code&gt;try/catch&lt;/code&gt; blocks won't be able to prevent the warnings from being emitted, thus causing false positive.&lt;/p&gt;

&lt;h2&gt;
  
  
  Major improvements to the &lt;code&gt;git:&lt;/code&gt; protocol
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Workspace cloning
&lt;/h4&gt;

&lt;p&gt;For the past years, most projects have typically followed an "edit, commit, push, release" workflow - the first three parts happening on GitHub while the fourth one was being delegated to the npm registry. Downloading dependencies from Git was always an option, of course, but it didn't always received the attention it deserved. In particular, cloning specific packages from monorepos was still an unsolved problem.&lt;/p&gt;

&lt;p&gt;With Yarn 2.1, this situation changes. &lt;strong&gt;Yarn is now able to clone any workspace from any Yarn project.&lt;/strong&gt; Note that this only works with Yarn projects at the moment due to the lack of &lt;code&gt;yarn workspace &amp;lt;name&amp;gt; run build&lt;/code&gt; counterparts on current npm and pnpm releases.&lt;/p&gt;

&lt;h4&gt;
  
  
  Respectful builds
&lt;/h4&gt;

&lt;p&gt;See, there's a very important misconception that we (as in, the package manager authors, collectively speaking) have failed to address during the past years. &lt;strong&gt;They are not interchangeable.&lt;/strong&gt; You cannot use X instead of Y and expect a reproducible build. Regardless of what the advertisement says, each package manager has its own feature set, and to expect them all to be in sync is fruitless. We sometimes implement features we like from other package managers, of course, but when all is said, each project still has its own characteristics that others will never truly replicate. And that's fine!&lt;/p&gt;

&lt;p&gt;So what does that mean for Git builds in particular? Imagine, you want to use a project that's maintained by someone using pnpm. That's fair. Well, until now, if you were referencing this project with a &lt;code&gt;git:&lt;/code&gt; dependency, Yarn would clone it, then run &lt;code&gt;yarn install&lt;/code&gt;, then &lt;code&gt;yarn pack&lt;/code&gt;. All good! But wait ... did it run &lt;code&gt;yarn install&lt;/code&gt;? Why not &lt;code&gt;pnpm install&lt;/code&gt;? Turns out, there were no good reasons. Package managers aren't interchangeable, as I was saying. If a project is configured with a &lt;code&gt;pnpm-lock.yaml&lt;/code&gt;, then using Yarn to install it is wrong, and would lead to unpredictable builds. Clearly, that's not an acceptable behaviour.&lt;/p&gt;

&lt;p&gt;And so we fixed it! &lt;strong&gt;Yarn will now properly detect which packages managers are meant to be used by projects cloned from git dependencies.&lt;/strong&gt; If there's a &lt;code&gt;yarn.lock&lt;/code&gt;, it'll be Yarn. If there's a &lt;code&gt;pnpm-lock.yaml&lt;/code&gt;, it'll be pnpm. And if there's a &lt;code&gt;package-lock.json&lt;/code&gt;, npm it is.&lt;/p&gt;

&lt;h2&gt;
  
  
  CLI Improvements
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Readability
&lt;/h4&gt;

&lt;p&gt;The output was very verbose, sometimes hiding important information (especially on CI, where the cache is either always there or never there). Various changes were made to streamline the output and make it easier to digest.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;On terminals, only five fetch notifications will be displayed at a time. The sixth one will cause the removal of the oldest one, and so forth.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On CI, Yarn will now print a one-line summary instead of the whole definition (unless configured otherwise).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A new optional setting, &lt;code&gt;preferTruncatedLines&lt;/code&gt;, will ensure that infos and warnings only take a single line each, keeping your output clean and tidy.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Most CI systems will offer fold groups on each Yarn step. We're still tweaking a bit this behaviour, and we encourage CI maintainers to reach out to us if you wish to discuss better integrations in this area.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Focused workspaces
&lt;/h4&gt;

&lt;p&gt;The &lt;a href="https://yarnpkg.com/cli/workspaces/focus"&gt;&lt;code&gt;yarn workspaces focus&lt;/code&gt; command&lt;/a&gt; is a new addition inspired by a 1.x feature of the same name. &lt;strong&gt;It allows you to only install the dependencies from one specific workspace&lt;/strong&gt; (plus its own workspace dependencies), thereby decreasing the install size by a significant factor. Coupled to the &lt;code&gt;--production&lt;/code&gt; flag, it's a great tool for developers looking to integrate monorepos with Docker images.&lt;/p&gt;

&lt;p&gt;By the way, the focus implementation takes exactly 99 lines of code. If you're curious what a plugin looks like, &lt;a href="https://github.com/yarnpkg/berry/blob/master/packages/plugin-workspace-tools/sources/commands/focus.ts"&gt;it's a prime example&lt;/a&gt; to keep in mind 😉&lt;/p&gt;

&lt;h4&gt;
  
  
  Deep accesses from &lt;code&gt;yarn config get/set&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;yarn config get/set&lt;/code&gt; commands now accept deep paths (ie &lt;code&gt;foo.bar&lt;/code&gt;), allowing you to access settings with different levels of granularity.&lt;/p&gt;

&lt;p&gt;Additionally, the configuration will now always be redacted before being printed (unless requested otherwise), thereby preventing secrets from accidental leaks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Meta improvements
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Cache filenames
&lt;/h4&gt;

&lt;p&gt;Our cache filenames used to be versioned using a global cache key. As a result, each time we had to bump the cache key (for example because we fixed an issue in the tarball conversion algorithm), all file names changed and were causing a fairly large noise in the Git history for people using &lt;a href="https://yarnpkg.com/features/zero-installs"&gt;zero-installs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This isn't the case anymore, as we made the cache content-indexed. Each file will only ever change if the archive content actually changes! 💫&lt;/p&gt;

&lt;h4&gt;
  
  
  Playground
&lt;/h4&gt;

&lt;p&gt;One of our contributors put CodeSandbox and Yarn together in an impressive &lt;a href="https://yarnpkg.com/playground"&gt;playground&lt;/a&gt;. Through it, you can easily build reproduction cases for bugs you encounter, decreasing the time needed for us to understand and fix them.&lt;/p&gt;

&lt;h4&gt;
  
  
  Documentation index
&lt;/h4&gt;

&lt;p&gt;Thanks to &lt;a href="https://www.algolia.com/"&gt;Algolia&lt;/a&gt;, the Yarn website is now indexed and can be searched from the status bar. We hope this will allow you to quickly find any information you're looking for - whether it's authentication configuration, gitignore examples, or lexicon entries.&lt;/p&gt;

&lt;h4&gt;
  
  
  VSCode Zip Filesystem
&lt;/h4&gt;

&lt;p&gt;We've published the Zip FS extension on the &lt;a href="https://marketplace.visualstudio.com/items?itemName=arcanis.vscode-zipfs"&gt;VSCode Marketplace&lt;/a&gt;. Thanks to the work from &lt;a href="https://github.com/elmpp"&gt;Matt Penrice&lt;/a&gt;, using the Jump to Definition feature with the extension installed will properly send you to the right files, opened straight from the zip archive.&lt;/p&gt;

&lt;p&gt;Note that VSCode has an internal limitation preventing the TypeScript server to cover the files located within zip archives (ie you can Jump to Definition from your sources to zip files, but TypeScript won't show its types once you get there). Please upvote the &lt;a href="https://github.com/microsoft/vscode/issues/59650"&gt;following issue&lt;/a&gt; to raise the ticket's priority (we already made a PR, but it unfortunately got rejected).&lt;/p&gt;

&lt;h2&gt;
  
  
  Other improvements
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Performances
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The Plug'n'Play runtime has been further optimized, which may yield significant boost in some cases (in particular ESLint when using the &lt;code&gt;eslint-plugin-import&lt;/code&gt; package).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The binary size also received a lot of attention, and the 2.1 Yarn binary now takes 2.35MB, vs 2.91MB for the 2.0.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
   Ecosystem
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Packages can now declare they &lt;em&gt;need&lt;/em&gt; to be unpacked in order to be functional using the new &lt;code&gt;"preferUnplugged": true&lt;/code&gt; field in the manifest. &lt;strong&gt;This will hurt the experience of your users&lt;/strong&gt; (your project will require hard installs, meaning a heavier footprint and slower installs), so please refrain using this field unless there's absolutely no other choice.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's to come?
&lt;/h2&gt;

&lt;p&gt;We'll try to make more regular minor releases from now on, shipping exactly one minor per month (eventually leading up to the release of Yarn 3 in January 2021). Some topics we have in mind for the next one (come help us! we have a lot of &lt;a href="https://github.com/yarnpkg/berry/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22"&gt;Good First Issues&lt;/a&gt;!):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add a new &lt;code&gt;dedupe&lt;/code&gt; command to optimize dependency trees&lt;/li&gt;
&lt;li&gt;Add changelog support to the builtin release workflow&lt;/li&gt;
&lt;li&gt;Add support for the &lt;code&gt;exports&lt;/code&gt; field&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;yarn list&lt;/code&gt; &amp;amp; &lt;code&gt;yarn fund&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add the telemetry support (&lt;a href="https://github.com/yarnpkg/berry/issues/1250"&gt;RFC&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;And more...!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Of course that's only on the top of my head, so it's possible our objectives shift during the next weeks depending on our own priorities - and of course depending on whether you help us or not 😛&lt;/p&gt;

&lt;p&gt;Until then stay safe, wear a mask, and see you next month!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>npm</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Introducing Yarn 2 ! 🧶🌟</title>
      <dc:creator>Maël Nison</dc:creator>
      <pubDate>Fri, 24 Jan 2020 17:26:55 +0000</pubDate>
      <link>https://dev.to/arcanis/introducing-yarn-2-4eh1</link>
      <guid>https://dev.to/arcanis/introducing-yarn-2-4eh1</guid>
      <description>&lt;p&gt;Hi everyone! After exactly 365 days of &lt;em&gt;very&lt;/em&gt; intensive development, I'm extremely happy to unveil the first stable release of Yarn 2. In this post I will explain what this release will mean for our community. Buckle up!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you're interested to know more about what will happen to Yarn 1, keep reading as we detail our plans later down this post: Future Plans. If you just want to start right now with Yarn 2, check out the &lt;a href="https://next.yarnpkg.com/getting-started/install" rel="noopener noreferrer"&gt;Getting Started&lt;/a&gt; or &lt;a href="https://next.yarnpkg.com/advanced/migration" rel="noopener noreferrer"&gt;Migration&lt;/a&gt; guides.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Release Overview&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Describing this release is particularly difficult - it contains core, fundamental changes, shipped together with new features born from our own usage.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Highlights&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The output got redesigned for improved readability&lt;/li&gt;
&lt;li&gt;designed for improved readability&lt;/li&gt;
&lt;li&gt;Our CLI commands (&lt;code&gt;yarn add&lt;/code&gt;, ...) are now aware of workspaces&lt;/li&gt;
&lt;li&gt;Running &lt;code&gt;yarn install&lt;/code&gt; can be made optional on per-repo basis&lt;/li&gt;
&lt;li&gt;A safer &lt;code&gt;npx&lt;/code&gt; counterpart called &lt;code&gt;yarn dlx&lt;/code&gt; to run one-shot tools&lt;/li&gt;
&lt;li&gt;Run commands on all workspaces with &lt;code&gt;yarn workspaces foreach&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Packages can be modified in-place through the &lt;code&gt;patch:&lt;/code&gt; protocol&lt;/li&gt;
&lt;li&gt;Local packages can be referenced through the new &lt;code&gt;portal:&lt;/code&gt; protocol&lt;/li&gt;
&lt;li&gt;A new workflow has been designed to efficiently release workspaces&lt;/li&gt;
&lt;li&gt;Workspaces can now be declaratively linted and autofixed&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;But also...&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Package builds are now only triggered when absolutely needed&lt;/li&gt;
&lt;li&gt;Package builds can now be enabled or disabled on a per-package basis&lt;/li&gt;
&lt;li&gt;Scripts now execute within a normalized shell&lt;/li&gt;
&lt;li&gt;Peer dependencies now work even through &lt;code&gt;yarn link&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The lockfile is now proper YAML&lt;/li&gt;
&lt;li&gt;The codebase is now full TypeScript&lt;/li&gt;
&lt;li&gt;Yarn can now be extended through plugins&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Breaking changes...&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Configuration settings have been normalized&lt;/li&gt;
&lt;li&gt;Packages must respect their boundaries&lt;/li&gt;
&lt;li&gt;Bundle dependencies aren't supported anymore&lt;/li&gt;
&lt;li&gt;Packages are stored in read-only archives&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those highlights are only a subset of all the changes and improvements; a more detailed changelog can be found &lt;a href="https://github.com/yarnpkg/berry/blob/master/CHANGELOG.md" rel="noopener noreferrer"&gt;here&lt;/a&gt;, and the upgrade instructions are available &lt;a href="https://next.yarnpkg.com/advanced/migration" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Frequently Asked Questions&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Who should we thank for this release?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A significant amount of work has been done by &lt;a href="https://twitter.com/larixer" rel="noopener noreferrer"&gt;larixer&lt;/a&gt; from &lt;a href="https://sysgears.com/" rel="noopener noreferrer"&gt;SysGears&lt;/a&gt;, who crawled deep into the engine with the mission to make the transition to Yarn 2 as easy as possible. In particular he wrote the whole &lt;code&gt;node_modules&lt;/code&gt; compatibility layer, which I can tell you is no easy feat!&lt;/p&gt;

&lt;p&gt;My thanks also go to everyone  who spontaneously joined us for a week or a month during the development. In particular &lt;a href="https://github.com/Embraser01" rel="noopener noreferrer"&gt;embraser01&lt;/a&gt; for the initial Windows support, &lt;a href="https://github.com/bgotink" rel="noopener noreferrer"&gt;bgotink&lt;/a&gt; for typing our filesystem API, &lt;a href="https://github.com/deini" rel="noopener noreferrer"&gt;deini&lt;/a&gt; for his contributions to the CLI, and &lt;a href="https://twitter.com/daniel15" rel="noopener noreferrer"&gt;Daniel&lt;/a&gt; for his help on the infrastructure migration.&lt;/p&gt;

&lt;p&gt;This work couldn't have been possible without the support from many people from the open-source community - I think in particular to &lt;a href="https://twitter.com/NicoloRibaudo" rel="noopener noreferrer"&gt;Nicolò&lt;/a&gt; from Babel and &lt;a href="https://twitter.com/ljharb" rel="noopener noreferrer"&gt;Jordan&lt;/a&gt; from Browserify, but they're far from being the only ones: the teams of Gatsby, Next, Vue, Webpack, Parcel, Husky, ... your support truly made all the difference in the world.&lt;/p&gt;

&lt;p&gt;And finally, the project lead and design architect for Yarn 2 has been yours truly, &lt;a href="https://twitter.com/arcanis" rel="noopener noreferrer"&gt;Maël Nison&lt;/a&gt;. My time was sponsored in large part by &lt;a href="https://www.datadoghq.com/" rel="noopener noreferrer"&gt;Datadog&lt;/a&gt;, which is a super dope place to develop JS (which &lt;a href="https://www.datadoghq.com/careers/" rel="noopener noreferrer"&gt;is hiring&lt;/a&gt; 😜), and by my fiancé and our cats. Never forget that behind all open-source projects are maintainers and their families.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;How easy will it be to migrate to Yarn 2?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Thanks to our beta testers and the general support of the ecosystem we've been able to soften a lot the pain associated with such a major upgrade. A &lt;a href="https://next.yarnpkg.com/advanced/migration" rel="noopener noreferrer"&gt;Migration Guide&lt;/a&gt; is available that goes into more detail, but generally speaking as long as you use the latest versions of your tools (ESLint, Babel, TypeScript, Gatsby, etc), things should be fine.&lt;/p&gt;

&lt;p&gt;One particular caveat however: &lt;strong&gt;Flow and React-Native cannot be used at the moment under Plug’n’Play (PnP) environments&lt;/strong&gt;. We're looking forward to working with their respective teams to figure out how to make our technologies compatible. In the meantime you can choose to remain on Yarn 1 for as long as you need, or to use the &lt;a href="https://github.com/yarnpkg/berry/tree/master/packages/plugin-node-modules" rel="noopener noreferrer"&gt;&lt;code&gt;node_modules&lt;/code&gt; plugin&lt;/a&gt;, which aims to provide a graceful degradation path for smoother upgrade (note that it's still a work in progress - expect dragons). More details &lt;a href="https://next.yarnpkg.com/advanced/migration#if-required-install-the-node-modules-plugin" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;If you don't want to upgrade all of your projects&lt;/strong&gt;, just run &lt;code&gt;yarn policies set-version ^1&lt;/code&gt; in the repositories that need to stay on Yarn 1, and commit the result. Yarn will always prefer the checked-in binaries over the global ones, making it the best way to ensure that everyone in your team shares the exact same release!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What will happen to the legacy codebase?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Yarn 1.22 will be released next week. Once done, the 1.x branch will officially enter maintenance mode - meaning that it won't receive further releases from me except when absolutely required to patch vulnerabilities. New features will be developed exclusively against Yarn 2. In practical terms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The classic repository (&lt;code&gt;yarnpkg/yarn&lt;/code&gt;) will move over to &lt;code&gt;yarnpkg/classic&lt;/code&gt; to reflect its maintenance status. It will be kept open for the time being, but we'll likely archive it in a year or two.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The modern repository will &lt;strong&gt;not&lt;/strong&gt; be renamed into &lt;code&gt;yarnpkg/yarn&lt;/code&gt;, as that would break a significant amount of backlink history. It will remain  &lt;a href="https://github.com/yarnpkg/berry" rel="noopener noreferrer"&gt;&lt;code&gt;yarnpkg/berry&lt;/code&gt;&lt;/a&gt; for the foreseeable future.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The old website will move over to classic.yarnpkg.com, and the new website (currently &lt;a href="https://next.yarnpkg.com" rel="noopener noreferrer"&gt;next.yarnpkg.com&lt;/a&gt;) will be migrated to the main domain name.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;yarn&lt;/code&gt; package on npm will not change; we will distribute further version using the new &lt;a href="https://yarnpkg.com/cli/set/version" rel="noopener noreferrer"&gt;&lt;code&gt;yarn set version&lt;/code&gt;&lt;/a&gt; command.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We expect most of those changes to be completed by February 1, 2020.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;In Depth&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;CLI Output&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Back when Yarn was released its CLI output was a good step forward compared to other solutions (plus it had emojis! 🧶), but some issues remained. In particular lots of messages were rather cryptic, and the colours were fighting against the content rather than working with it. Strong from this experience, we decided to try something different for Yarn 2:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FqetNioL.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FqetNioL.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Almost all messages now have their own error codes that can be searched within our &lt;a href="https://next.yarnpkg.com/advanced/error-codes" rel="noopener noreferrer"&gt;documentation&lt;/a&gt;. Here you'll find comprehensive explanations of the in-and-outs of each message - including suggested fixes. The colours are now used to support the important parts of each message, usually the package names and versions, rather than on a per-line basis.&lt;/p&gt;

&lt;p&gt;We expect some adjustments to be made during the following months (in particular with regard to colour blindness accessibility), but over time I think you'll come to love this new display!&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Workspace-aware CLI&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Working with workspaces can sometimes be overwhelming. You need to keep the state of your whole project in mind when adding a new dependency to one of your workspaces. "Which version should I use? What’s already used by my other workspaces?", etc.&lt;/p&gt;

&lt;p&gt;Yarn now facilitates the maintenance of such setups through various means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;yarn up &amp;lt;name&amp;gt;&lt;/code&gt; will upgrade a package in all workspaces at once&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;yarn add -i &amp;lt;name&amp;gt;&lt;/code&gt; will offer to reuse the same version as the ones used by your other workspaces (and some other choices)&lt;/li&gt;
&lt;li&gt;The &lt;a href="https://next.yarnpkg.com/features/release-workflow" rel="noopener noreferrer"&gt;version plugin&lt;/a&gt; will give you a way to check that all the relevant workspaces are bumped when one of them is released again.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those changes highlight the new experience that we want to bring to Yarn: the tool becomes an ally rather than a burden.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FfVY7EAs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FfVY7EAs.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Zero-Installs&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;While not a feature in itself, the term "Zero Install" encompasses a lot of Yarn features tailored around one specific goal - to make your projects as stable and fast as possible by removing the main source of entropy from the equation: Yarn itself.&lt;/p&gt;

&lt;p&gt;To make it short, because Yarn now reads the vendor files directly from the cache, if the cache becomes part of your repository then you never need to run yarn install again. It has a repository size impact, of course, but on par with the &lt;a href="https://yarnpkg.com/blog/2016/11/24/offline-mirror/" rel="noopener noreferrer"&gt;offline mirror feature&lt;/a&gt; from Yarn 1 - very reasonable.&lt;/p&gt;

&lt;p&gt;For more details (such as "why is it different from checking in the &lt;code&gt;node_modules&lt;/code&gt; directory"), refer to  this &lt;a href="https://next.yarnpkg.com/features/zero-installs" rel="noopener noreferrer"&gt;documentation page&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;New Command: &lt;code&gt;yarn dlx&lt;/code&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Yarn 2 introduces a new command called &lt;a href="https://next.yarnpkg.com/cli/dlx" rel="noopener noreferrer"&gt;&lt;code&gt;yarn dlx&lt;/code&gt;&lt;/a&gt; (dlx stands for &lt;em&gt;download and execute&lt;/em&gt;) which basically does the same thing as &lt;a href="https://www.npmjs.com/package/npx" rel="noopener noreferrer"&gt;&lt;code&gt;npx&lt;/code&gt;&lt;/a&gt; in a slightly less dangerous way. Since &lt;code&gt;npx&lt;/code&gt; is meant to be used for both local and remote scripts, there is a decent risk that a typo could open the door to an attacker:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

$ npx serv # Oops, should have been "serve"


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This isn't a problem with dlx, which exclusively downloads and executes remote scripts - never local ones. Local scripts are always runnable through yarn run or directly by their name:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

$ yarn dlx terser my-file.js
$ yarn run serve
$ yarn serve


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;New Command: &lt;code&gt;yarn workspaces foreach&lt;/code&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Running a command over multiple repositories is a relatively common use case, and until now  you needed an external tool in order to do it. This isn't the case anymore as the &lt;a href="https://github.com/yarnpkg/berry/tree/master/packages/plugin-workspace-tools" rel="noopener noreferrer"&gt;workspace-tools plugin&lt;/a&gt; extends Yarn, allowing you to do just that:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

$ yarn workspaces foreach run build


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The command also supports options to control the execution which allow you to tell Yarn to follow dependencies, to execute the commands in parallel, to skip workspaces, and more. Check out the full list of options &lt;a href="https://next.yarnpkg.com/cli/workspaces/foreach" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;New Protocol: &lt;code&gt;patch:&lt;/code&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Yarn 2 features a new protocol called &lt;code&gt;patch:&lt;/code&gt;. This protocol can be used whenever you need to apply changes to a specific package in your dependency tree. Its format is similar to the following:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"dependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"left-pad"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"patch:left-pad@1.3.0#./my-patch.patch"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Together with the &lt;a href="https://next.yarnpkg.com/configuration/manifest#resolutions" rel="noopener noreferrer"&gt;&lt;code&gt;resolutions&lt;/code&gt;&lt;/a&gt; field, you can even patch a package located deep within your dependency tree. And since the &lt;code&gt;patch:&lt;/code&gt; protocol is just another data source, it benefits from the same mechanisms as all other protocols - including caching and checksums!&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;New Protocol: &lt;code&gt;portal:&lt;/code&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Yarn 2 features a new protocol called &lt;code&gt;portal:&lt;/code&gt;. You can see &lt;code&gt;portal:&lt;/code&gt; as a package counterpart of the existing &lt;code&gt;link:&lt;/code&gt; protocol. Where the &lt;code&gt;link:&lt;/code&gt; protocol is used to tell Yarn to create a symlink to any folder on your local disk, the &lt;code&gt;portal:&lt;/code&gt; protocol is used to create a symlink to any &lt;em&gt;package&lt;/em&gt; folder.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"dependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"@my/app"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"link:./src"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"eslint-plugin-foo"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"portal:./pkgs/eslint-plugin-foo"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;So what's the difference you say? Simple: portals follow transitive dependencies, whereas links don't. Even better, portals properly follow peer dependencies, regardless of the location of the symlinked package.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Workspace Releases&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Working with workspaces brings its own bag of problems, and scalable releases may be one of the largest one. Most of large open-source projects around here use &lt;a href="https://github.com/lerna/lerna" rel="noopener noreferrer"&gt;Lerna&lt;/a&gt; or a similar tool in order to automatically keep track of changes applied to the workspaces.&lt;/p&gt;

&lt;p&gt;When we started releasing the beta builds for Yarn 2, we quickly noticed we would be hitting the same walls. We looked around, but existing solutions seemed to have significant requirements - for example, using Lerna you would have to either release all your packages every time, or to keep track yourself of which packages need to be released. Some of that work can be automated, but it becomes even more complex when you consider that a workspace being released may require unrelated packages to be released again too (for example because they use it in their prepack steps)!&lt;/p&gt;

&lt;p&gt;To solve this problem, we've designed a whole new workflow available through a plugin called &lt;a href="https://github.com/yarnpkg/berry/tree/master/packages/plugin-version" rel="noopener noreferrer"&gt;&lt;code&gt;version&lt;/code&gt;&lt;/a&gt;. This workflow, documented &lt;a href="https://next.yarnpkg.com/features/release-workflow" rel="noopener noreferrer"&gt;here&lt;/a&gt;, allows you to delegate part of the release responsibility to your contributors. And to make things even better, it also ships with a visual interface that makes managing releases a walk in the park!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FcusXKDV.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FcusXKDV.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This workflow is sill experimental, but it works well enough for us that we think it'll quickly prove an indispensable part of your toolkit when building large projects using workspaces.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Workspace Constraints&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Workspaces quickly proved themselves being one of our most valuable features. Countless projects and applications switched to them during the years. Still, they are not flawless. In particular, it takes a lot of care to keep the workspace dependencies synchronized.&lt;/p&gt;

&lt;p&gt;Yarn 2 ships with a new concept called &lt;a href="https://next.yarnpkg.com/features/constraints" rel="noopener noreferrer"&gt;Constraints&lt;/a&gt;. Constraints offer a way to specify generic rules (using &lt;a href="https://en.wikipedia.org/wiki/Prolog" rel="noopener noreferrer"&gt;Prolog&lt;/a&gt;, a declarative programming language) that must be met in all of your workspaces for the validation to pass. For example, the following will prevent your workspaces from ever depending on underscore - and will be autofixable!&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight prolog"&gt;&lt;code&gt;

&lt;span class="ss"&gt;gen_enforced_dependency&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;WorkspaceCwd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;'underscore'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;DependencyType&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:-&lt;/span&gt;
  &lt;span class="ss"&gt;workspace_has_dependency&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;WorkspaceCwd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;'underscore'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;DependencyType&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This other constraint will require that all your workspaces properly describe the repository field in their manifests:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight prolog"&gt;&lt;code&gt;

&lt;span class="ss"&gt;gen_enforced_field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;WorkspaceCwd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;'repository.type'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;'git'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:-&lt;/span&gt;
  &lt;span class="ss"&gt;workspace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;WorkspacedCwd&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;

&lt;span class="ss"&gt;gen_enforced_field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;WorkspaceCwd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;'repository.url'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;'ssh://git@github.com/yarnpkg/berry.git'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:-&lt;/span&gt;
  &lt;span class="ss"&gt;workspace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;WorkspacedCwd&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Constraints are definitely one of our most advanced and powerful features, so don't fret yourself if you need time to wrap your head around it. We'll follow up with blog posts to explore them into details - watch this space!&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Build Dependency Tracking&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A recurrent problem in Yarn 1, native packages used to be rebuilt much more than they should have. For example, running &lt;code&gt;yarn remove&lt;/code&gt; used to completely rebuild all packages in your dependency tree.&lt;/p&gt;

&lt;p&gt;Starting from Yarn 2 we now keep track of the individual dependency trees for each package that lists postinstall scripts, and only run them when those dependency trees changed in some way:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

➤ YN0000: ┌ Link step
➤ YN0007: │ sharp@npm:0.23.0 must be rebuilt because its dependency tree changed
➤ YN0000: └ Completed in 16.92s
➤ YN0000: Done with warnings in 21.07s


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Per-Package Build Configuration&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Yarn 2 now allows you to specify whether a build script should run or not on a per-package basis. At the moment the default is to run everything, so by default you can choose to disable the build for a specific package:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"dependenciesMeta"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"core-js"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"built"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If you instead prefer to disable everything by default, just toggle off &lt;a href="https://next.yarnpkg.com/configuration/yarnrc#enableScripts" rel="noopener noreferrer"&gt;&lt;code&gt;enableScripts&lt;/code&gt;&lt;/a&gt; in your settings then explicitly enable the &lt;a href="https://next.yarnpkg.com/configuration/manifest#dependenciesMeta.built" rel="noopener noreferrer"&gt;&lt;code&gt;built&lt;/code&gt;&lt;/a&gt; flag in &lt;code&gt;dependenciesMeta&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Normalized Shell&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Back when Yarn 2 was still young, the very first external PR we received was about Windows support. As it turns out Windows users are fairly numerous, and compatibility is important to them. In particular they often face problems with the scripts field which is typically only tested on Bash.&lt;/p&gt;

&lt;p&gt;Yarn 2 ships with a rudimentary shell interpreter that knows just enough to give you 90% of the language structures typically used in the scripts field. Thanks to this interpreter, your scripts will run just the same regardless of whether they're executed on OSX or Windows:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"redirect"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"node ./something.js &amp;gt; hello.md"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"no-cross-env"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"NODE_ENV=prod webpack"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Even better, this shell allows us to build tighter integrations, such as exposing the command line arguments to the user scripts:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"lint-and-build"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"yarn lint &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;$@&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt; &amp;amp;&amp;amp; yarn build &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;$@&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Improved Peer Dependency Links&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Because Node calls realpath on all required paths (unless --preserve-symlinks is on, which is rarely the case), peer dependencies couldn't work through yarn link as they were loaded from the perspective of the true location of the linked package on the disk rather than from its dependent.&lt;/p&gt;

&lt;p&gt;Thanks to Plug’n’Play which can force Node to instantiate packages as many times as needed to satisfy all of their dependency sets, Yarn is now able to properly support this case.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;New Lockfile Format&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Back when Yarn was created, it was decided that the lockfile would use a format very similar to YAML but with a few key differences (for example without colons between keys and their values). It proved fairly annoying for third-party tools authors, as the parser was custom-made and the grammar was anything but standard.&lt;/p&gt;

&lt;p&gt;Starting from Yarn 2, the format for both lockfile and configuration files changed to pure YAML:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;

&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@yarnpkg/parsers@workspace:^2.0.0-rc.6,&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;@yarnpkg/parsers@workspace:packages/yarnpkg-parsers"&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;0.0.0-use.local&lt;/span&gt;
  &lt;span class="na"&gt;resolution&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;@yarnpkg/parsers@workspace:packages/yarnpkg-parsers"&lt;/span&gt;
  &lt;span class="na"&gt;dependencies&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;js-yaml&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;^3.10.0&lt;/span&gt;
    &lt;span class="na"&gt;pegjs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;^0.10.0&lt;/span&gt;
  &lt;span class="na"&gt;languageName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;unknown&lt;/span&gt;
  &lt;span class="na"&gt;linkType&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;soft&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;TypeScript Codebase&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;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.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;Package&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;Locator&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;languageName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;linkType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;LinkType&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;dependencies&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;IdentHash&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Descriptor&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;peerDependencies&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;IdentHash&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Descriptor&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;dependenciesMeta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;Map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;DependencyMeta&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;peerDependenciesMeta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;PeerDependencyMeta&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Modular Architecture&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;I recently wrote a whole &lt;a href="https://dev.to/arcanis/plugin-systems-when-why-58pp"&gt;blog post&lt;/a&gt; on the subject so I won't delve too much into it, but Yarn now follows a very modular architecture.&lt;/p&gt;

&lt;p&gt;In particular, this means two interesting things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You can write plugins that Yarn will load at runtime, and that will be able to access the true dependency tree as Yarn sees it; this allows you to easily build tools such as &lt;a href="https://lerna.js.org/" rel="noopener noreferrer"&gt;Lerna&lt;/a&gt;, &lt;a href="https://fable.io/blog/Introducing-Femto.html" rel="noopener noreferrer"&gt;Femto&lt;/a&gt;, &lt;a href="https://github.com/ds300/patch-package" rel="noopener noreferrer"&gt;Patch-Package&lt;/a&gt;, ...&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can have a dependency on the Yarn core itself and instantiate the classes yourself (note that this part is still a bit experimental as we figure out the best way to include the builtin plugins when operating under this mode).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To give you an idea, we've built a &lt;a href="https://github.com/yarnpkg/berry/tree/master/packages/plugin-typescript" rel="noopener noreferrer"&gt;typescript plugin&lt;/a&gt; which will automatically add the relevant &lt;code&gt;@types/&lt;/code&gt; packages each time you run &lt;code&gt;yarn add&lt;/code&gt;. Plugins are easy to write - we even have a &lt;a href="https://next.yarnpkg.com/advanced/plugin-tutorial" rel="noopener noreferrer"&gt;tutorial&lt;/a&gt; -, so give it a shot sometime!&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Normalized Configuration&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;One very common piece of feedback we got regarding Yarn 1 was about our configuration pipeline. When Yarn was released we tried to be as compatible with npm as possible, which prompted us to for example try to read the npm configuration files etc. This made it fairly difficult for our users to understand where settings should be configured.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;

&lt;span class="na"&gt;initScope&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;yarnpkg&lt;/span&gt;
&lt;span class="na"&gt;npmPublishAccess&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;public&lt;/span&gt;
&lt;span class="na"&gt;yarnPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;scripts/run-yarn.js&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In Yarn 2, the whole configuration has been revamped and everything is now kept within a single source of truth named &lt;code&gt;.yarnrc.yml&lt;/code&gt;. The settings names have changed too in order to become uniform (no more &lt;code&gt;experimental-pack-script-packages-in-mirror&lt;/code&gt; vs &lt;code&gt;workspaces-experimental&lt;/code&gt;), so be sure to take a look at our shiny new &lt;a href="https://next.yarnpkg.com/configuration/yarnrc" rel="noopener noreferrer"&gt;documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Strict Package Boundaries&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Packages aren't allowed to require other packages unless they actually list them in their dependencies. This is in line with the changes we made back when we introduced Plug'n'Play &lt;a href="https://github.com/yarnpkg/rfcs/pull/101" rel="noopener noreferrer"&gt;more than a year ago&lt;/a&gt;, and we're happy to say that the work we've been doing with the top maintainers of the ecosystem have been fruitful. Nowadays, very few packages still have compatibility issues with this rule.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;

&lt;span class="c1"&gt;// Error: Something that got detected as your top-level application&lt;/span&gt;
&lt;span class="c1"&gt;// (because it doesn't seem to belong to any package) tried to access&lt;/span&gt;
&lt;span class="c1"&gt;// a package that is not declared in your dependencies&lt;/span&gt;
&lt;span class="c1"&gt;// &lt;/span&gt;
&lt;span class="c1"&gt;// Required package: not-a-dependency (via "not-a-dependency")&lt;/span&gt;
&lt;span class="c1"&gt;// Required by: /Users/mael/my-app/&lt;/span&gt;
&lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`not-a-dependency`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Deprecating Bundle Dependencies&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Bundle dependencies are an artefact of another time, and all support for them has been dropped. The installs will gracefully degrade and download the packages as originally listed in the dependencies field.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"bundleDependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"not-supported-anymore"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Should you use bundle dependencies, please check the &lt;a href="https://next.yarnpkg.com/advanced/migration" rel="noopener noreferrer"&gt;Migration Guide&lt;/a&gt; for suggested alternatives.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Read-Only Packages&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Packages are now kept within their cache archives. For safety and to prevent cache corruptions, those archives are mounted as read-only drives and cannot be modified under normal circumstances:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;writeFileSync&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`fs`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;lodash&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`lodash`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Error: EROFS: read-only filesystem, open '/node_modules/lodash/lodash.js'&lt;/span&gt;
&lt;span class="nf"&gt;writeFileSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;lodash&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;`module.exports = 42;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If a package needs to modify its own source code, it will need to be &lt;a href="https://next.yarnpkg.com/advanced/lexicon#unplugged-package" rel="noopener noreferrer"&gt;unplugged&lt;/a&gt; - either explicitly in the &lt;a href="https://next.yarnpkg.com/configuration/manifest#dependenciesMeta.unplugged" rel="noopener noreferrer"&gt;&lt;code&gt;dependenciesMeta&lt;/code&gt; field&lt;/a&gt;, or implicitly by listing a postinstall script.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Wow. That's a lot of material, isn't it? I hope you enjoy this update, it's the culmination of literally years of preparation and obstinacy.&lt;/p&gt;

&lt;p&gt;Everything I believe package management should be, you'll find it here. The result is for sure more opinionated than it used to be, but I believe this is the way going forward - a careful planning of the long term user experience we want to provide, rather than a toolbox without directions.&lt;/p&gt;

&lt;p&gt;As for me, working on Yarn has been an incredible experience. I'm simultaneously project manager, staff engineer, lead designer, developer relations, and user support. There are ups and downs, but every time I hear someone sharing their Yarn success story my heart is internally cheering a little bit. So do this: &lt;a href="https://discord.gg/yarnpkg" rel="noopener noreferrer"&gt;tell me what you like&lt;/a&gt;, and help fix what you don't.&lt;/p&gt;

&lt;p&gt;Happy 2020! 🎄&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>npm</category>
    </item>
    <item>
      <title>Plugin systems - when &amp; why? 🧩</title>
      <dc:creator>Maël Nison</dc:creator>
      <pubDate>Mon, 30 Dec 2019 15:01:38 +0000</pubDate>
      <link>https://dev.to/arcanis/plugin-systems-when-why-58pp</link>
      <guid>https://dev.to/arcanis/plugin-systems-when-why-58pp</guid>
      <description>&lt;p&gt;I've recently heard some rants against plugin systems and modular architectures. One particular criticism argued that they're merely marketing keywords, adding significant complexity to a software's architecture for little end value. This criticism makes sense to some degree, and there's a trap to be aware of when designing such systems, but we need to be careful. There are reasons why project health might benefit from a plugin architecture, and they might not be the ones you even had in mind.&lt;/p&gt;

&lt;p&gt;Given that plugins hold a central place in the new architecture we've built for &lt;a href="https://github.com/yarnpkg/berry" rel="noopener noreferrer"&gt;Yarn 2&lt;/a&gt;, I figured it could be interesting to put my thoughts on paper for future reference. Grab your hat and let's dive into the depth of the Plugin Temple 🤠&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2F2fo8Gs0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2F2fo8Gs0.png"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Plugins are boundaries
&lt;/h2&gt;

&lt;p&gt;Because plugins make it possible to implement new behaviors in pre-existing software it's easy to see them as a way to open up a project to the outside world. But it's also very easy to forget that they're the exact opposite: a way to add constraints to an architecture.&lt;/p&gt;

&lt;p&gt;Imagine the same application implemented twice - the first time as a monolith, and the second time with a typical core + plugins architecture. Now you need to build a new feature:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;With the monolithic application, you'll likely be able to do your assignment by tweaking a few modules here and there, adding a few new branches, and possibly adding new fields to the data structures. You may not even need to create new files!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;With a well-designed plugin system, it'll be more difficult - you'll need to make sure that your changes go through the predefined core hooks. You won't be able to just change the core logic to fit your new need, so you think hard about the implementation before even starting to code.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FazVUHxY.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FazVUHxY.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The monolithic application sounds better, right? Easier to work with, faster iterations. And that's true, given the few parameters I've exposed! But now consider those additional ones:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Multiple people will work on the codebase. There's even a non-zero chance that no one from the current maintainer team will be there in a year. Worse: it's also quite likely that no one from the current maintainer team was here even a year ago.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Most contributors only ever make a single commit - to fix the one bug they experience. They won't ever come back, and probably don't have any context regarding why things work the way they do.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This software will be used for years, and its userbase will keep growing.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Under those new parameters, the monolith will quickly start to spiral out of control. New features get developed and injected into the core. When something isn't quite possible yet, a few small hacks are used. And it works! Time flows, contributors come and go, and suddenly you start to notice a weird pattern: each feature you develop introduces new bugs. People send PRs to help you fix those bugs, but introduce new ones in the process. Long-forgotten hacks trigger edge cases more and more often. Technical debt creeps in and, eventually, we come to a point where no one dares to make a change.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.explainxkcd.com%2Fwiki%2Fimages%2F5%2F5c%2Fnew_bug.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.explainxkcd.com%2Fwiki%2Fimages%2F5%2F5c%2Fnew_bug.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The plugin architecture, however, survives. Bugs still happen, but because the broken features are typically scoped to a single plugin people who aim to fix them only have to understand the context of the one affected module instead of the whole codebase. Same things for reviews, which can be done by people familiar with the individual plugins rather than the whole application. Core maintainers can focus on the core work, and delegate the plugin implementation to new contributors.&lt;/p&gt;

&lt;p&gt;The monolith application is Yarn 1 and its &lt;a href="https://github.com/yarnpkg/yarn/blob/master/src/package-linker.js#L246" rel="noopener noreferrer"&gt;hardcoded code paths&lt;/a&gt;. The plugin architecture is Yarn 2 and its &lt;a href="https://github.com/yarnpkg/berry/blob/master/packages/yarnpkg-core/sources/Installer.ts#L19-L34" rel="noopener noreferrer"&gt;specialized hooks&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It's still too early to call it a definitive victory, but after working almost a year on this approach I've already been able to see its first payoffs. Freshly onboarded contributors have been able to focus their efforts on specific subparts of the codebase without having to be aware of all the subtle details of the core implementation. Finding how a feature is implemented is mostly a matter of finding the right file.&lt;/p&gt;




&lt;h2&gt;
  
  
  Plugins give focus
&lt;/h2&gt;

&lt;p&gt;Working on an open-source project the size of Yarn is challenging for various reasons, but the one we'll focus on in this article is pretty simple: what are the features worth implementing?&lt;/p&gt;

&lt;p&gt;Lots of people use Yarn every day and, as a result, we get a lot of pull requests to add new features into our tool. Each time, when we're about to merge them, the same questions pop into our minds: will it be useful? Is it worth the complexity? Will I feel comfortable having to maintain this myself in a year?&lt;/p&gt;

&lt;p&gt;Back in the v1, our typical answers were along the line of "well, let's move forward and see what happens". But I can already tell you what happens: some of those features became cornerstones of our offering (like workspaces, or resolution overrides) while others ended up cluttering our codebase (like Bower support, or multilingual support). In almost every case even though the implementations worked in isolation, they happened to hit some weird edge case when used together with other features.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FPvVKT7f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FPvVKT7f.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Plugin systems offer a very simple solution to this problem by stating that &lt;strong&gt;not everything has to belong to the core&lt;/strong&gt;. It becomes perfectly fine if a lot of features are first implemented through community plugins, the time we can assess their cost/value ratio.&lt;/p&gt;

&lt;p&gt;Even better, if we someday decide that a feature shouldn't be shipped anymore, it's just a matter of removing the plugin from the codebase.  Of course, such actions sometimes make parts of the core irrelevant and subject to changes. Thankfully, the resources freed by outsourcing part of the feature development can then be reassigned to allow maintainers to spend more timing on keeping up to date the most critical part of their software: the core itself.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Plugins aren't good in every scenario. In particular, they can only be designed once you already have a perfect knowledge of the design space - or at least good enough to know exactly what are the parts you're still missing.&lt;/p&gt;

&lt;p&gt;In my case, for example, it took almost two years before I finally felt confident enough about package managers to bootstrap the project. Before that, I spent my time writing various package manager implementations, various tentative APIs, all to grasp the extent of what we would need to cover. It's only after failing a few times that I decided we were ready to go.&lt;/p&gt;

&lt;p&gt;So plugins are dangerous. They might put you off the trail, looking for the mysterious cities of gold rather than building your fort. Still, in the case of popular open-source projects, I believe using a modular architecture offers some very strong advantages that go far beyond the idea that people may have in mind when thinking about plugins. More than just a way to open your project to new features, they also provide crucial structure and support, helping those projects to stand the test of time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FwqhS5l3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FwqhS5l3.png"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
