<?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: typicode</title>
    <description>The latest articles on DEV Community by typicode (@typicode).</description>
    <link>https://dev.to/typicode</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%2F382460%2F0034bae0-1e6a-4a65-888d-1ccf48cf8a43.jpeg</url>
      <title>DEV Community: typicode</title>
      <link>https://dev.to/typicode</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/typicode"/>
    <language>en</language>
    <item>
      <title>What's new in husky 5</title>
      <dc:creator>typicode</dc:creator>
      <pubDate>Thu, 04 Feb 2021 12:47:09 +0000</pubDate>
      <link>https://dev.to/typicode/what-s-new-in-husky-5-32g5</link>
      <guid>https://dev.to/typicode/what-s-new-in-husky-5-32g5</guid>
      <description>&lt;p&gt;&lt;strong&gt;I'm happy to announce the release of husky 5&lt;/strong&gt; 🎉 🐺 &lt;em&gt;woof!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;During the past years, husky has grown in complexity. With this version, I wanted to go back to something &lt;strong&gt;simpler&lt;/strong&gt;, &lt;strong&gt;more flexible&lt;/strong&gt; and &lt;strong&gt;closer to the metal&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;You can use husky 5 in your Open Source projects today.&lt;/p&gt;

&lt;p&gt;Thanks for your support and feedback. I hope you'll enjoy this release &amp;lt;3&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/typicode/husky"&gt;https://github.com/typicode/husky&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Faster and smaller
&lt;/h2&gt;

&lt;p&gt;Husky 5 is closer to Git and has a lot less abstractions. It makes it not only simpler to understand but also very fast and small with zero dependencies.&lt;/p&gt;

&lt;p&gt;Time spent to run a simple &lt;code&gt;echo "hello world"&lt;/code&gt; pre-commit hook:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;husky 4: ~0.50s
husky 5: ~0.01s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Installation size with dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;husky 4: ~1.00MB with 47 packages
husky 5: ~0.02MB with  0 packages
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Optional install
&lt;/h2&gt;

&lt;p&gt;With husky 4, hooks were automatically installed. With husky 5, you have the choice and it's explicit.&lt;/p&gt;

&lt;p&gt;You can keep the previous behaviour (&lt;strong&gt;recommended&lt;/strong&gt;) by adding a &lt;code&gt;postinstall&lt;/code&gt; script:&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="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;package.json&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;"private"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&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;"postinstall"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"husky install"&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 prefer to manually install husky, omit the above &lt;code&gt;postinstall&lt;/code&gt; script and just run in your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Manual install&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;npx husky &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;yarn husky &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Config
&lt;/h2&gt;

&lt;p&gt;Previously, hooks were defined in &lt;code&gt;package.json&lt;/code&gt; or &lt;code&gt;.huskyrc&lt;/code&gt;. Now they're defined directly in their corresponding hook file. Overhead is reduced and scripting is easier.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# .husky/pre-commit&lt;/span&gt;
&lt;span class="c"&gt;# ...&lt;/span&gt;
yarn lint-staged
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They can also be put in any subdirectory. For example in &lt;code&gt;.config&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# .config/husky/pre-commit&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;husky &lt;span class="nb"&gt;install&lt;/span&gt; .config/husky
&lt;span class="nv"&gt;$ &lt;/span&gt;husky add .config/husky/pre-commit &lt;span class="s2"&gt;"npm test"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How to migrate
&lt;/h2&gt;

&lt;p&gt;A new doc site has been created with a dedicated section to migrating hooks from husky 4 to 5:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://typicode.github.io/husky"&gt;https://typicode.github.io/husky&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have many projects using husky 4, you can use &lt;code&gt;husky-4-to-5&lt;/code&gt; CLI to do it automatically:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/typicode/husky-4-to-5"&gt;https://github.com/typicode/husky-4-to-5&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;There are some caveats so just copying your previous config may not work.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  License
&lt;/h2&gt;

&lt;p&gt;For a limited time, husky 5 will be released under License Zero's &lt;a href="https://paritylicense.com/"&gt;Parity License&lt;/a&gt;. It will be MIT again later.&lt;/p&gt;

&lt;h3&gt;
  
  
  Free for Open Source ❤️
&lt;/h3&gt;

&lt;p&gt;The Parity License is an Open Source friendly license.&lt;/p&gt;

&lt;p&gt;So if you're using husky in an Open Source project, this new license doesn't affect you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You're free to use husky 5 today and I'm glad if it can help you in your day to day work.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Early access for Sponsors 🎁
&lt;/h3&gt;

&lt;p&gt;If you're using husky in a commercial project, your support would be extremely helpful (husky 5 is free to try for 30 days).&lt;/p&gt;

&lt;p&gt;That said, if your company can't or don't want to sponsor, that's perfectly fine too. Husky 4 remains free to use in any project and will continue to receive maintainance updates.&lt;/p&gt;

&lt;p&gt;You can become a sponsor on &lt;a href="https://github.com/sponsors/typicode"&gt;GitHub Sponsors&lt;/a&gt; or &lt;a href="https://opencollective.com/husky"&gt;Open Collective&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Thanks
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Thanks to everyone who has sponsored me, I'm sincerely grateful!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I also have other ideas for husky and projects. If you're a sponsor, you'll be the first to know about them :)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/typicode/husky"&gt;https://github.com/typicode/husky&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Photo by &lt;a href="https://unsplash.com/@yirage"&gt;Andriyko Podilnyk&lt;/a&gt; on &lt;a href="https://unsplash.com"&gt;unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>npm</category>
      <category>node</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
