<?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: Shalva Gegia</title>
    <description>The latest articles on DEV Community by Shalva Gegia (@shalvagegia).</description>
    <link>https://dev.to/shalvagegia</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%2F106764%2F78c6375b-dd69-4fec-a2ba-f702b34d258d.jpg</url>
      <title>DEV Community: Shalva Gegia</title>
      <link>https://dev.to/shalvagegia</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shalvagegia"/>
    <language>en</language>
    <item>
      <title>MERN Monorepo</title>
      <dc:creator>Shalva Gegia</dc:creator>
      <pubDate>Mon, 14 Oct 2019 22:48:45 +0000</pubDate>
      <link>https://dev.to/shalvagegia/mern-monorepo-45f3</link>
      <guid>https://dev.to/shalvagegia/mern-monorepo-45f3</guid>
      <description>&lt;p&gt;Hello reader,&lt;br&gt;
I want to talk about monorepo, and also will share boilerplate for MERN (Mongo, Express.js, React, React-Native/Expo) stack.&lt;/p&gt;

&lt;p&gt;When it comes to a real-life project, it consists of multiple services fronted, backend/API and mobile. We can split them into separate repositories, but sharing code between repositories is difficult when using multiple repositories. This is the moment where monorepo shines.&lt;/p&gt;

&lt;p&gt;Let's compare monorepo to mutli-repo style.&lt;/p&gt;
&lt;h4&gt;
  
  
  Monorepo
&lt;/h4&gt;

&lt;p&gt;Monorepo is split into many single-repos. Each single-repo repository is read-only. You can change its code via pull-request to the monorepo.&lt;/p&gt;
&lt;h4&gt;
  
  
  Multirepo
&lt;/h4&gt;

&lt;p&gt;The other approach is to manage multiple repositories. 1 package = 1 own repository. Each package has its own development, tagging, and even maintainers.&lt;/p&gt;
&lt;h4&gt;
  
  
  Monolith
&lt;/h4&gt;

&lt;p&gt;Monolith IS NOT monorepo. Monolith is a huge amount of coupled code of one application that is hell to maintain.&lt;/p&gt;

&lt;p&gt;This is what monorepo repository looks like&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%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F1%2A95IEDUCN3mfU9vpTWXChhQ%402x.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%2Fcdn-images-1.medium.com%2Fmax%2F1600%2F1%2A95IEDUCN3mfU9vpTWXChhQ%402x.png" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Boilerplate
&lt;/h2&gt;
&lt;h5&gt;
  
  
  Lerna
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;Lerna is a tool that optimizes the workflow around managing multi-package repositories with git and npm.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Lerna tries to ease the management of npm links when dealing with multi-package projects hosted in a single repository. It analyzes the packages and automatically creates the required npm links between them. It also handles the execution of tasks across multiple packages and eases the pain of versioning and publishing.&lt;br&gt;
It has its shortcomings but it’s worth using it. Big projects like Babel and Jest use Lerna.&lt;/p&gt;
&lt;h5&gt;
  
  
  Yarn workspaces
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;Workspaces are a new way to setup your package architecture (..) It allows you to setup multiple packages in such a way that you only need to run yarn install once to install all of them in a single pass.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Your dependencies can be linked together, which means that your workspaces can depend on one another while always using the most up-to-date code available. This is also a better mechanism than yarn link since it only affects your workspace tree rather than your whole system.&lt;/p&gt;
&lt;h5&gt;
  
  
  Eslint / Tslint / Stylelint / Prettier
&lt;/h5&gt;

&lt;p&gt;In this boilerplate eslint, tslint, stylelint and prettier are already isntalled, configured and ready to go!&lt;/p&gt;
&lt;h5&gt;
  
  
  Husky / Lint-staged / Commit lint
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;Husky - Git hooks made easy&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Husky is a tool which gives us the ability to catch GIT hooks like commit and/or push&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Lint-staged - Run linters against staged git files and don't let 💩 slip into your code base!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Lint-staged is a nice tool to run linters (for example: eslint) on staged files to prevent commit code which is note linter compatible&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Conventional (Semantic) Commit Messages - is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Conventional or Semantic commit messages is naming convension, that helps us to easily determine what commit contains and also it's very helpful to avoid multiple fixes in a single commit.&lt;/p&gt;

&lt;p&gt;If you are not familiar with conventional commits, here are some links with detailed info&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.conventionalcommits.org/en/v1.0.0-beta.4/" rel="noopener noreferrer"&gt;Conventional Commits&lt;/a&gt;&lt;br&gt;
&lt;a href="https://seesparkbox.com/foundry/semantic_commit_messages" rel="noopener noreferrer"&gt;Semantic Commits&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  How to start
&lt;/h3&gt;

&lt;p&gt;All you need is to clone &lt;a href="https://github.com/shakogegia/mern-monorepo-boilerplate" rel="noopener noreferrer"&gt;repository&lt;/a&gt;, run &lt;code&gt;yarn&lt;/code&gt; to install dependencies and you can start the project by running &lt;code&gt;yarn dev&lt;/code&gt;&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F7y04oyepefran5du6nv1.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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F7y04oyepefran5du6nv1.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Packages structure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;client - React app created via&lt;code&gt;create-react-app&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;api - Node.js / Express.js&lt;/li&gt;
&lt;li&gt;socket - Socket.io server&lt;/li&gt;
&lt;li&gt;mobile - React-native/Expo project&lt;/li&gt;
&lt;li&gt;common - common utility functions shared accross all package&lt;/li&gt;
&lt;li&gt;constants - just a container for constant variables also shared accross all package&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By running &lt;code&gt;yarn dev&lt;/code&gt; from the root folder, lerna.js will execute &lt;code&gt;yarn dev&lt;/code&gt; in every and each package&lt;/p&gt;

&lt;p&gt;Here are some of helpful lerna.js commands&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx lerna add &amp;lt;package&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this will add  as a dependency to all packages&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx lerna add &amp;lt;package1&amp;gt; --scope=&amp;lt;package2&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this will add  as a dependency to only package2&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx lerna publish
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this will increase version of all packages and also will generate CHANGELOG.md files for all packages and also for a root repository, based on conventional commits. (see picture below)&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Flwbsakys9rsbqbfp1mzq.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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Flwbsakys9rsbqbfp1mzq.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx lerna bootstrap
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Installs all of the package dependencies in all packages and links any cross-dependencies.&lt;/p&gt;

&lt;p&gt;You can find more commands on Lerna.js's documentation&lt;/p&gt;

&lt;p&gt;Here is a boilerplate link:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/shakogegia/mern-monorepo-boilerplate" rel="noopener noreferrer"&gt;Github Repository&lt;/a&gt;&lt;/p&gt;

</description>
      <category>mern</category>
      <category>monorepo</category>
      <category>lerna</category>
      <category>yarnworkspaces</category>
    </item>
    <item>
      <title>React Native Animated Flatlist</title>
      <dc:creator>Shalva Gegia</dc:creator>
      <pubDate>Mon, 08 Oct 2018 14:32:59 +0000</pubDate>
      <link>https://dev.to/shalvagegia/react-native-animated-flatlist-1ikh</link>
      <guid>https://dev.to/shalvagegia/react-native-animated-flatlist-1ikh</guid>
      <description>&lt;p&gt;React Native Animated Flatlist&lt;br&gt;
Animate item add/delete on&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/shakogegia/react-native-animated-flatlist" rel="noopener noreferrer"&gt;view on github&lt;/a&gt;&lt;br&gt;
&lt;a href="https://snack.expo.io/@shakogegia/react-native-animated-flatlist-demo" rel="noopener noreferrer"&gt;View demo on Snack&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;feedbacks &amp;amp; contributions are more than welcome&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%2Fgithub.com%2Fshakogegia%2Freact-native-animated-flatlist%2Fraw%2Fmaster%2Fscreenshots%2Fdemo.gif" 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%2Fgithub.com%2Fshakogegia%2Freact-native-animated-flatlist%2Fraw%2Fmaster%2Fscreenshots%2Fdemo.gif" title="Demo" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>react</category>
      <category>javascript</category>
      <category>animated</category>
    </item>
  </channel>
</rss>
