<?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: Fatih</title>
    <description>The latest articles on DEV Community by Fatih (@fatihcandev).</description>
    <link>https://dev.to/fatihcandev</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%2F374276%2F842561fc-b3a5-40fb-9999-2c618024d0e0.jpg</url>
      <title>DEV Community: Fatih</title>
      <link>https://dev.to/fatihcandev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fatihcandev"/>
    <language>en</language>
    <item>
      <title>How to bootstrap a Next.js + Tailwind CSS + TypeScript project</title>
      <dc:creator>Fatih</dc:creator>
      <pubDate>Wed, 24 Mar 2021 06:25:59 +0000</pubDate>
      <link>https://dev.to/fatihcandev/how-to-bootstrap-a-next-js-tailwind-css-typescript-project-1ia1</link>
      <guid>https://dev.to/fatihcandev/how-to-bootstrap-a-next-js-tailwind-css-typescript-project-1ia1</guid>
      <description>&lt;p&gt;Hey everyone! Hope you're all safe and well. It's been a while since my last blog post. It's been a productive weekend and I wanted to finish it with a blog post as a cherry on top.&lt;/p&gt;

&lt;p&gt;In this blog post, I'm gonna explain how I've bootstrapped my twitter clone project which I started working on yesterday. But first, let's talk a little about why I've chosen Next.js and Tailwind for the project.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&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%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/fatihcandev" rel="noopener noreferrer"&gt;
        fatihcandev
      &lt;/a&gt; / &lt;a href="https://github.com/fatihcandev/nextjs-tailwindcss-twitter-clone" rel="noopener noreferrer"&gt;
        nextjs-tailwindcss-twitter-clone
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Twitter Clone with Next.js and TailwindCSS&lt;/h1&gt;

&lt;/div&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/7eb783b07996c0d3138a296dfde8de0615a41d12b292092bb4df250edd145119/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6e6578742e6a732d3030303030303f7374796c653d666f722d7468652d6261646765266c6f676f3d6e6578742e6a73266c6f676f436f6c6f723d7768697465"&gt;&lt;img src="https://camo.githubusercontent.com/7eb783b07996c0d3138a296dfde8de0615a41d12b292092bb4df250edd145119/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6e6578742e6a732d3030303030303f7374796c653d666f722d7468652d6261646765266c6f676f3d6e6578742e6a73266c6f676f436f6c6f723d7768697465" alt=""&gt;&lt;/a&gt;
&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/95759dac505a57f5a260db91eca6f7a0c852a095cb271cc6d37c413081c5f799/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5461696c77696e645f4353532d3338423241433f7374796c653d666f722d7468652d6261646765266c6f676f3d7461696c77696e642d637373266c6f676f436f6c6f723d7768697465"&gt;&lt;img src="https://camo.githubusercontent.com/95759dac505a57f5a260db91eca6f7a0c852a095cb271cc6d37c413081c5f799/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5461696c77696e645f4353532d3338423241433f7374796c653d666f722d7468652d6261646765266c6f676f3d7461696c77696e642d637373266c6f676f436f6c6f723d7768697465" alt=""&gt;&lt;/a&gt;
&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/8e77945348567678f7ac7879dfb294400492ed429d16392c98db21a7c00934d2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f547970655363726970742d3030374143433f7374796c653d666f722d7468652d6261646765266c6f676f3d74797065736372697074266c6f676f436f6c6f723d7768697465"&gt;&lt;img src="https://camo.githubusercontent.com/8e77945348567678f7ac7879dfb294400492ed429d16392c98db21a7c00934d2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f547970655363726970742d3030374143433f7374796c653d666f722d7468652d6261646765266c6f676f3d74797065736372697074266c6f676f436f6c6f723d7768697465" alt=""&gt;&lt;/a&gt;
&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/804da4e59fbed07e7846683416f053087278d98d453dfc7577ba917d914737b6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5961726e2d3243384542423f7374796c653d666f722d7468652d6261646765266c6f676f3d7961726e266c6f676f436f6c6f723d7768697465"&gt;&lt;img src="https://camo.githubusercontent.com/804da4e59fbed07e7846683416f053087278d98d453dfc7577ba917d914737b6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5961726e2d3243384542423f7374796c653d666f722d7468652d6261646765266c6f676f3d7961726e266c6f676f436f6c6f723d7768697465" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://nextjs-tailwindcss-twitter-clone.vercel.app/" rel="nofollow noopener noreferrer"&gt;🌐 Live&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/fatihcandev/nextjs-tailwindcss-twitter-clone" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&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%2Fhfyrsgxb7pkcslolbzqa.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%2Fhfyrsgxb7pkcslolbzqa.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next.js is a React framework. It's been out there for years now and it increases its popularity day by day. It provides various features that solve various problems and improve the development experience. Some of them are:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;hybrid static &amp;amp; server rendering, TypeScript support, smart bundling, route pre-fetching, image optimization and more…&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I used Next.js before but it's been a while and the library's been improved very much since then so I wanted to get my hands dirty with it.&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%2F4qxwy1dhpysie5gtpagh.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%2F4qxwy1dhpysie5gtpagh.png" alt="image"&gt;&lt;/a&gt; &lt;br&gt;
Here is the cause of the civil war that's been going for a while now between front end devs. Let's see what Tailwind says in its docs.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;A utility-first CSS framework packed with classes like flex, pt-4, text-center and rotate-90 that can be composed to build any design, directly in your markup.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So, basically, it allows you to write CSS rapidly in HTML by writing pre-defined classes. Some old-school folks claimed that this was no way to write css and it'd cause chaos and some other said "Just try it, man! You'll see."&lt;br&gt;
So, I had tried it a while ago and it was really rapid, I mean, really. The only thing that slows you down is trying to remember some classes but otherwise your fingers are basically like Mr. Robot while hacking. And the solution for the chaos in your HTML/JSX is to export classes with but let's not get into detail and get distracted. I'll share the link to the docs at the end and you can get into it.&lt;/p&gt;



&lt;p&gt;We're gonna use create-next-app for pre-installed dependencies and pre-created folders to save time. See the manual setup here if you like.&lt;br&gt;
Run the command below.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn create-next-app nextjs-tailwindcss-twitter-clone&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;It'll install next, react and react-dom and create some directories for you.&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%2Fis5dzavffbwsqtu0d0rn.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%2Fis5dzavffbwsqtu0d0rn.png" alt="image"&gt;&lt;/a&gt; &lt;/p&gt;


&lt;h2&gt;
  
  
  TypeScript
&lt;/h2&gt;

&lt;p&gt;Now, let's setup TypeScript. Create an empty tsconfig.json file in the root and install the dependencies.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn add -D typescript @types/react @types/node&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Start the dev server and Next.js will write the configurations for you into tsconfig.json.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn run dev&lt;/code&gt;&lt;/p&gt;



&lt;p&gt;Allright! Let's get to Tailwind.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# If you're on Next.js v10
yarn add -D tailwindcss@latest postcss@latest autoprefixer@latest
# If you're on Next.js v9 or older
yarn add -D tailwindcss@npm:@tailwindcss/postcss7-compat @tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the installation, let's create the configuration file for Tailwind and PostCSS.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn tailwindcss init -p&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You'll see that two files named tailwind.config.js and postcss.config.js has been created. Those two files allow us to make configurations such as creating our own theme, using plugins and more.&lt;br&gt;
For now, we're gonna add Purge CSS support to allow Tailwind to tree-shake unused styles and optimize our production build. Edit purge property in the tailwind.config.js as below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can learn more about configuring Tailwind in the &lt;a href="https://tailwindcss.com/docs/configuration" rel="noopener noreferrer"&gt;configuration documentation&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  ESLint
&lt;/h2&gt;

&lt;p&gt;Ain't no project without ESLint. Let's install the dependencies.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add -D eslint eslint-config-airbnb eslint-config-prettier eslint-plugin-prettier eslint-plugin-react
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can use the config &lt;a href="https://github.com/fatihcandev/nextjs-tailwindcss-twitter-clone/blob/master/.eslintrc" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Prettier
&lt;/h2&gt;

&lt;p&gt;It literally makes your code prettier so let's install it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn add -D prettier&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Create a .prettierrc file and paste the config below into it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "singleQuote": true,  
  "semi": false,  
  "printWidth": 100
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;You can start cracking on &lt;a href="https://tailwindcss.com/docs/utility-first" rel="noopener noreferrer"&gt;Tailwind CSS&lt;/a&gt; and &lt;a href="https://nextjs.org/learn/basics/create-nextjs-app?utm_source=next-site&amp;amp;utm_medium=nav-cta&amp;amp;utm_campaign=next-website" rel="noopener noreferrer"&gt;Next.js&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>tailwindcss</category>
      <category>typescript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How did I publish my first React Native library to npm?</title>
      <dc:creator>Fatih</dc:creator>
      <pubDate>Fri, 04 Dec 2020 16:44:07 +0000</pubDate>
      <link>https://dev.to/fatihcandev/how-did-i-publish-my-first-react-native-library-to-npm-4b7</link>
      <guid>https://dev.to/fatihcandev/how-did-i-publish-my-first-react-native-library-to-npm-4b7</guid>
      <description>&lt;p&gt;Hi, everyone 👋 I'm Fatih. I'm a front end developer from Turkey and this is my first post about my first react native library that I published to npm 2 days ago.&lt;/p&gt;

&lt;p&gt;First of all, if you wanna take a look at it: &lt;br&gt;
&lt;a href="https://www.npmjs.com/package/@digieggs/rn-country-code-picker" rel="noopener noreferrer"&gt;NPM&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/DIGIEGGS/rn-country-code-picker" rel="noopener noreferrer"&gt;GitHub Repo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's a dropdown component that let's you pick a country dial-in code for your phone number input.&lt;/p&gt;

&lt;p&gt;So, it's been 5 months since I started to work as a professional front end developer. I mainly work with React but I am relatively new in React Native development. I was working on OTP login with firebase and I built a phone number input. Everything was okay but something was missing, a country code picker. So I checked the dropdown/picker packages but since they were not customizable and and I had my own design on my mind, I decided to build my own. At the end, I built a nice, searchable country code picker with flags and everything and my boss liked it a lot and suggested that I should publish it to NPM.&lt;/p&gt;

&lt;p&gt;It was a process that I've made some research to get it done and learned many things about creating a package and publishing it. So, I decided to share this steps with the community.&lt;/p&gt;
&lt;h1&gt;
  
  
  Initializing the project
&lt;/h1&gt;

&lt;p&gt;Initialize a React Native bare workflow project with TypeScript:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npx react-native init AwesomeTSProject --template react-native-template-typescript&lt;/code&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Dependencies and package.json configuration
&lt;/h1&gt;

&lt;p&gt;The most important thing is to get the package.json right. It contains all the necessary information about your soon-to-be package. Now, don't copy paste the info below, take a look at your package.json and edit/add fields accordingly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "name": "@digieggs-rn-country-code-picker", // Your package's name
  "version": "1.0.0", // Keep it 1.0.0 for now. It will increase automatically when you patch the project
  "main": "lib/module/index.js", // Entry point of the package
  "module": "lib/module/index.js", // Entry point of the package
  "react-native": "src/index.ts", // Entry point of the project
  "types": "lib/typescript/index.d.ts", // Entry point of the type definitions
  "description": "A searchable dropdown component to select a country code for your phone number input.", // Description to show on npmjs.com
  "files": [
    "lib/",
    "src/"
  ], // Entry point of the necessary files
  "keywords": [
    "react-native",
    "country",
    "country-code",
    "dialing code",
    "picker",
    "mobile",
    "ios",
    "android"
  ], // Some keywords to make the package easier to be found
  "bugs": {
    "url": "https://github.com/DIGIEGGS/rn-country-code-picker/issues"
  },
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
    "prepare": "bob build" // The command to build our package's core
  },
  "dependencies": {
    "react": "16.13.1",
    "react-native": "0.63.3",
    "react-native-svg": "^12.1.0"
  },
  "devDependencies": {
    ...
    "@react-native-community/bob": "^0.16.2", // The builder. I'll talk about it
  },
  "peerDependencies": { // Add the dependencies that you want the user to install manually here. In my case it react-native-svg for the icons in the component
    "react-native-svg": "^12.1.0"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/DIGIEGGS/rn-country-code-picker"
  }, // repository info to show on npmjs.com
  "author": "Fatih Can &amp;lt;contact@fatihcan.dev&amp;gt;", // author info to show on npmjs.com
  "license": "MIT", // license info,
  "@react-native-community/bob": {
    "source": "src",
    "output": "lib",
    "targets": [
      "module",
      "typescript"
    ]
  } // Config for the builder bob
}

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

&lt;/div&gt;


&lt;p&gt;After you are done with the package.json, let's install our dependencies with yarn or npm:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn&lt;/code&gt; or &lt;code&gt;npm install&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The most important dependency here is:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&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%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/callstack" rel="noopener noreferrer"&gt;
        callstack
      &lt;/a&gt; / &lt;a href="https://github.com/callstack/react-native-builder-bob" rel="noopener noreferrer"&gt;
        react-native-builder-bob
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      👷‍♂️ Simple set of CLIs to scaffold and build React Native libraries for different targets
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;This library will compile the ts files to js files and build type definitions of our components into a &lt;code&gt;lib&lt;/code&gt; folder.&lt;/p&gt;

&lt;h1&gt;
  
  
  TypeScript configuration
&lt;/h1&gt;

&lt;p&gt;After that, let's get to the tsconfig.json. You can copy/paste it if you like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "jsx": "react-native",
    "lib": ["dom", "esnext"],
    "moduleResolution": "node",
    "skipLibCheck": true,
    "resolveJsonModule": true,
    "strict": true
  },
  "include": ["src/index.ts"],
  "exclude": ["node_modules", "babel.config.js", "metro.config.js", "jest.config.js"]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Source folder and necessary files
&lt;/h1&gt;

&lt;p&gt;After that, let's create a src folder. This folder will contain the source of our package:&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%2Fpfzw8mhzyhrb28m5l0de.jpg" 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%2Fpfzw8mhzyhrb28m5l0de.jpg" alt="src"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that, create an index.ts file and export the main component like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export { default as CallingCodePicker } from './CallingCodePicker';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's almost done. Let's create the necessary ignore files and we will build our package.&lt;/p&gt;

&lt;p&gt;.gitignore&lt;br&gt;
&lt;/p&gt;

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

# generated files by bob
lib/

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

&lt;/div&gt;



&lt;p&gt;.eslintignore&lt;br&gt;
&lt;/p&gt;

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

# generated files by bob
lib/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.npmignore&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tsconfig.json
src

# Logs
*.log
npm-debug.log

# Dependency directory
node_modules

# Runtime data
tmp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Building the library
&lt;/h1&gt;

&lt;p&gt;Now, let's run the following command to build our package with bob:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn run prepare&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you see the following logs, it means our package is ready to test:&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%2Fe097ojuqyt3v1srqkl9n.jpg" 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%2Fe097ojuqyt3v1srqkl9n.jpg" alt="bob"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Testing
&lt;/h1&gt;

&lt;p&gt;Run the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm pack&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;builder-bob will compress our project into a .tgz file that allows us to install it with yarn/npm into another project to see if it being installed successfully.&lt;/p&gt;

&lt;p&gt;Now, you should see a .tgz file in the structure. Move it to Desktop and initialize another React Native project. I know... 🥱 Bear with me 👊&lt;/p&gt;

&lt;p&gt;After that project is initialized, change the following path with the path of your .tgz file and run:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install C:\Users\digieggs\Desktop\digieggs-rn-country-code-picker-1.0.4.tgz&lt;/code&gt;&lt;br&gt;
or&lt;br&gt;
&lt;code&gt;yarn add C:\Users\digieggs\Desktop\digieggs-rn-country-code-picker-1.0.4.tgz&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After a successfull installation, you can import the component like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import { CallingCodePicker } from '@digieggs/rn-country-code-picker'&lt;/code&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  GitHub configuration
&lt;/h1&gt;

&lt;p&gt;We need a GitHub repo if you wish to share the code with everyone and maintain the project. Run the following commands with appropriate names:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git init
git add .
git commit -m “Initial commit”
git remote add origin https://github.com/&amp;lt;username&amp;gt;/&amp;lt;package_name&amp;gt;.git
git push -u origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Don't forget to edit the &lt;code&gt;repository&lt;/code&gt; and &lt;code&gt;bugs&lt;/code&gt; section in package.json.&lt;/p&gt;

&lt;h1&gt;
  
  
  Publishing to NPM
&lt;/h1&gt;

&lt;p&gt;After that, we are ready to publish our package. Run the following command to define a user. It will ask you your username, password and email.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm adduser&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Make sure to confirm you email address before running the publish command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm publish&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And congrats! 🥳 The package is live and ready to be installed from anywhere with the following commands:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install &amp;lt;package_name&amp;gt;&lt;/code&gt;&lt;br&gt;
or&lt;br&gt;
&lt;code&gt;yarn add &amp;lt;package_name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;You've just built your first npm package. Publishing a package may seem hard but it's not. I hope it was a clear guide, it's my first tutorial blog post. Please feel free to ask questions if you got stuck anywhere.&lt;/p&gt;

</description>
      <category>react</category>
      <category>reactnative</category>
      <category>typescript</category>
      <category>npm</category>
    </item>
  </channel>
</rss>
