<?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: Noviny 🦋</title>
    <description>The latest articles on DEV Community by Noviny 🦋 (@noviny).</description>
    <link>https://dev.to/noviny</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%2F469317%2F3606f4ec-dcc4-4fea-9f9e-22810b77c02e.jpg</url>
      <title>DEV Community: Noviny 🦋</title>
      <link>https://dev.to/noviny</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/noviny"/>
    <language>en</language>
    <item>
      <title>Dependencies in Monorepos with Manypkg ☔️</title>
      <dc:creator>Noviny 🦋</dc:creator>
      <pubDate>Tue, 15 Sep 2020 06:46:03 +0000</pubDate>
      <link>https://dev.to/noviny/dependencies-in-monorepos-with-manypkg-2fig</link>
      <guid>https://dev.to/noviny/dependencies-in-monorepos-with-manypkg-2fig</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Or: Make upgrading dependencies of your monorepo quick and easy with this one simple package*&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add @manypkg/cli
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;A common bit of wisdom in monorepos, is when you depend on external versions of a package, you should depend on the same version everywhere. This ensures more consistent behaviour across different packages, reduced install time, and reduced bundle size.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.npmjs.com/package/@manypkg/cli#manypkg-upgrade-packagename-tag-or-version"&gt;manypkg&lt;/a&gt; has been able to detect when packages depend on different versions, and fix for them since it started, but there hasn’t been a good path on how to do updates. Enter our newest helper command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;manypkg upgrade react
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This command will find every package that relies on &lt;code&gt;react&lt;/code&gt; , and upgrades it to &lt;code&gt;latest&lt;/code&gt;. Nice and simple.&lt;/p&gt;

&lt;p&gt;This works with a tag, such as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;manypkg upgrade react next
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And works with a version range such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;manypkg upgrade react ^16.3.0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  For packages &lt;em&gt;from&lt;/em&gt; monorepos
&lt;/h2&gt;

&lt;p&gt;If you are installing packages from a monorepo, you may want to upgrade all packages from that monorepo at once, to the same point in time. For this, you can specify a scope:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;manypkg upgrade @keystonejs
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You can still specify a tag, or a version, and all packages will be upgraded the first tag&lt;/p&gt;

&lt;h2&gt;
  
  
  Tagging in a monorepo
&lt;/h2&gt;

&lt;p&gt;I have a theory, which is that in a monorepo, being able to install a particular &lt;em&gt;release&lt;/em&gt; of all packages is useful (for when you don’t want latest), but it’s still nice if each &lt;em&gt;version&lt;/em&gt; for packages can remain separate.&lt;/p&gt;

&lt;p&gt;To allow both these things, we want to be able to name a release, and make that name meaningful on &lt;code&gt;npm&lt;/code&gt;. The best way is to tag all the packages on &lt;code&gt;npm&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;manypkg npm-tag arcade
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This will add the tag &lt;code&gt;arcade&lt;/code&gt; to the current version for every package in your monorepo. Now you’re all set up to &lt;code&gt;manypkg upgrade&lt;/code&gt; everything to &lt;code&gt;arcade&lt;/code&gt; 😎&lt;/p&gt;

&lt;p&gt;With these new tools under your belt, it should be even easier both to manage your monorepo, and to make it easier for consumers of your packages.&lt;/p&gt;

&lt;h3&gt;
  
  
  This is neat, but I see manypkg has some other commands?
&lt;/h3&gt;

&lt;p&gt;It does! &lt;code&gt;manypkg check&lt;/code&gt; and &lt;code&gt;manypkg fix&lt;/code&gt; are opinionated linting of your dependencies, mostly focused on your monorepos installs or links being more efficient. If you are developing in a monorepo, you might find these helpful - otherwise, you can just use manypkg for upgrading, no worries.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Yes I write titles like an academic ¯\_(ツ)_/¯&lt;/em&gt;&lt;/p&gt;

</description>
      <category>npm</category>
      <category>javascript</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
