<?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: Aashish Karki</title>
    <description>The latest articles on DEV Community by Aashish Karki (@karkipy).</description>
    <link>https://dev.to/karkipy</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%2F516839%2F3995d314-e7f0-439a-9b6b-1ac6e1ce9323.png</url>
      <title>DEV Community: Aashish Karki</title>
      <link>https://dev.to/karkipy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/karkipy"/>
    <language>en</language>
    <item>
      <title>Building and uploading a non signed react-native apk to slack using github action </title>
      <dc:creator>Aashish Karki</dc:creator>
      <pubDate>Tue, 16 Mar 2021 05:48:57 +0000</pubDate>
      <link>https://dev.to/karkipy/building-and-uploading-a-non-signed-react-native-apk-to-slack-using-github-action-14aa</link>
      <guid>https://dev.to/karkipy/building-and-uploading-a-non-signed-react-native-apk-to-slack-using-github-action-14aa</guid>
      <description>&lt;p&gt;Building an apk takes huge amount of time and resource this can hog your local machine too much and make it a bit difficult to work on it. Also when working in react-native we can build a debug free apk without signing it, this comes in handy before rolling an authentic release. So to tackle the resource we use github action which uses a linux image to build our app for us and then send it to slack channel. For that add a devDependency @slack/bolt, and we move forward.&lt;/p&gt;

&lt;p&gt;Github Action:&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;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Push to slack channel&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
     &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;master&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;ship-pr&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Push to slack&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v2&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Use Node.js ${{ matrix.node-version }}&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/setup-node@v1&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;node-version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;14.x.x'&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Build android apk and send to slack&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
          &lt;span class="s"&gt;yarn&lt;/span&gt;
          &lt;span class="s"&gt;yarn package:android&lt;/span&gt;
          &lt;span class="s"&gt;cd android &amp;amp;&amp;amp; ./gradlew wrapper --gradle-version 5.5 &amp;amp;&amp;amp; ./gradlew assembleRelease -x bundleReleaseJsAndAssets&lt;/span&gt;
          &lt;span class="s"&gt;cd ..&lt;/span&gt;
          &lt;span class="s"&gt;yarn shipit:android&lt;/span&gt;
        &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;SLACK_TOKEN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.SLACK_TOKEN }}&lt;/span&gt;
          &lt;span class="na"&gt;SLACK_SIGNING_SECRET&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.SLACK_SIGNING_SECRET }}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;We use node 14 version as a package @slack/bolt (which will be used to send apk to slack) uses node version &amp;gt; 10.&lt;/p&gt;

&lt;p&gt;In build step here yarn package:android is run which in returns packages react-native assets in android for us the corresponding script for this will be written in root package.json as :&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="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;"android"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"react-native run-android"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="err"&gt;......&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"test"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"jest"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"package:android"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;" react-native bundle --platform android --dev false --entry-file index.ts --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res"&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="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;

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

&lt;/div&gt;



&lt;p&gt;Currently the latest image of ubuntu and even macos use gradle version 6 or higher, this might be an issue for us as most of react native app 0.63.* version are mostly based on gradle 5, this is an issue as using gradle 6 or higher doesn't resolve dependencies issue for us. So we use gradle-version 5.5 and then apk is built and placed inside android/app/build/outputs/apk/release/app-release.apk&lt;/p&gt;

&lt;p&gt;so we send this to our slack channel, to do that we can create a simple bit with file write and channel join access &lt;a href="https://api.slack.com/apps?new_app=1"&gt;https://api.slack.com/apps?new_app=1&lt;/a&gt; after giving the bot access we need to grab token which we receive after creating access to bot and signing secrets which is available in general information screen. We set that in github environments and then, yarn shipit:android command to send the file to slack channel, the corresponding script for this will be written in root as:&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="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;"android"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"react-native run-android"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="err"&gt;......&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"package:android"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&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;"build:android"&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 &amp;amp;&amp;amp; node ./shipit.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="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Contents of shipit.js will be something as.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="c1"&gt;// Require the Bolt for JavaScript package (github.com/slackapi/bolt)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="p"&gt;}&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@slack/bolt&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// For Node.JS, you need to import the fs (file system) module&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createReadStream&lt;/span&gt; &lt;span class="p"&gt;}&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fs&lt;/span&gt;&lt;span class="dl"&gt;'&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;path&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;path&lt;/span&gt;&lt;span class="dl"&gt;'&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;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;SLACK_TOKEN&lt;/span&gt; 
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;slackBot&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;signingSecret&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;SLACK_SIGNING_SECRET&lt;/span&gt; 
&lt;span class="p"&gt;});&lt;/span&gt;


&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;sendApk&lt;/span&gt;&lt;span class="p"&gt;()&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;fileName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;..&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;android&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;app&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;build&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;outputs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;apk&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;release&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;app-release.apk&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Call the files.upload method using the built-in WebClient&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;slackBot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;files&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;upload&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="c1"&gt;// The token you used to initialize your app is stored in the `context` object&lt;/span&gt;
      &lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;channels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#general&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;initial_comment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Here&lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="s2"&gt;'s new updated build :smile:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="c1"&gt;// Include your filename in a ReadStream here&lt;/span&gt;
      &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;createReadStream&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fileName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Sucessfully sent&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;oops: &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;sendApk&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;


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

&lt;/div&gt;



&lt;p&gt;And in each trigger of our action apk is sent to slack, but be sure to mention bot to that channel first and is part of the channel &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Managing npm and git packages.</title>
      <dc:creator>Aashish Karki</dc:creator>
      <pubDate>Tue, 05 Jan 2021 15:23:40 +0000</pubDate>
      <link>https://dev.to/karkipy/managing-npm-and-git-packages-3hoh</link>
      <guid>https://dev.to/karkipy/managing-npm-and-git-packages-3hoh</guid>
      <description>&lt;p&gt;Github has come up with their own package registry solution. &lt;a href="https://github.com/features/packages"&gt;https://github.com/features/packages&lt;/a&gt; similar to npm package the packages are hosted in github, I use git mostly so it makes sense for me to host packages there also provides mechanism for private packages.&lt;/p&gt;

&lt;p&gt;Let's dive into the usage for github packages. We publish packages under a owner's scope. Say my github username is karkipy so the scope is &lt;a class="comment-mentioned-user" href="https://dev.to/karkipy"&gt;@karkipy&lt;/a&gt;
, and the package name will be the combination of your scope and the repo name itself such as  &lt;a class="comment-mentioned-user" href="https://dev.to/karkipy"&gt;@karkipy&lt;/a&gt;
/randomPackage.&lt;/p&gt;

&lt;p&gt;Now to publish this package into github registry we can specify it in the package.json file about which registry it should refer to such as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;publishConfig&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;registry&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://npm.pkg.github.com&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To publish :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm publish
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;should do the trick, now installing packages both from npm and github can be tricky as we have to specify from which we are installing packages, if only github is mentioned then the conflict will arise as many fundamental packages may not have been hosted by github package registry or if only npm is mentioned then the package from github will not be installed. So we need to specify packages to be installed from multiple organization.&lt;/p&gt;

&lt;p&gt;Create an .npmrc for this particular configuration, make sure it is in root. Configuration for the file should be something as :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;//npm.pkg.github.com/:_authToken&lt;span class="o"&gt;=&lt;/span&gt;GITPERSONALACCESSTOKEN

@karkipy:registry&lt;span class="o"&gt;=&lt;/span&gt;https://npm.pkg.github.com/

//registry.npmjs.org/:_authToken&lt;span class="o"&gt;=&lt;/span&gt;NPM_TOKEN

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

&lt;/div&gt;



&lt;p&gt;Personal access token should be granted for the private packages that you publish in github similar to that NPM_TOKEN does the same.&lt;/p&gt;

&lt;p&gt;NPM_TOKEN: &lt;a href="https://docs.npmjs.com/creating-and-viewing-access-tokens"&gt;https://docs.npmjs.com/creating-and-viewing-access-tokens&lt;/a&gt;&lt;br&gt;
GITPERSONALACCESSTOKEN: &lt;a href="https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token"&gt;https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>FastLane and github action for React Native app deployment .</title>
      <dc:creator>Aashish Karki</dc:creator>
      <pubDate>Mon, 14 Dec 2020 15:04:43 +0000</pubDate>
      <link>https://dev.to/karkipy/fastlane-and-github-action-for-react-native-app-deployment-jd8</link>
      <guid>https://dev.to/karkipy/fastlane-and-github-action-for-react-native-app-deployment-jd8</guid>
      <description>&lt;p&gt;fastlane provides a simple implementation for deployment of android and ios app. Github action provides pipelines to simplify the release process.&lt;/p&gt;

&lt;p&gt;fastlane can be installed via command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gem &lt;span class="nb"&gt;install &lt;/span&gt;fastlane
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;as we will be using github action so we presume the runner image will have the tools and software installed for us. &lt;/p&gt;

&lt;p&gt;Specification are listed in &lt;a href="https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners"&gt;https://docs.github.com/en/free-pro-team@latest/actions/reference/specifications-for-github-hosted-runners&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For iOS setup the faslane file for ios. Inside the ios folder create a folder named fastlane with files AppFile and FastFile. But first setup a github repo to host credentials for code sign. Setup : &lt;a href="https://docs.fastlane.tools/actions/match/"&gt;https://docs.fastlane.tools/actions/match/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AppFile: provide app identifier and app id and team id to it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;app_identifier &lt;span class="s2"&gt;"com.example.karkipy"&lt;/span&gt;
apple_id &lt;span class="s2"&gt;"aashish@karkipy.com"&lt;/span&gt;
team_id &lt;span class="s2"&gt;"1233343455"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;FastFile: is where we write script to build and deploy our app. Be sure to host your credentials in a private repo in git.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;default_platform&lt;span class="o"&gt;(&lt;/span&gt;:ios&lt;span class="o"&gt;)&lt;/span&gt;

platform :ios &lt;span class="k"&gt;do
  &lt;/span&gt;desc &lt;span class="s2"&gt;"Build for ios"&lt;/span&gt;
  lane :build &lt;span class="k"&gt;do&lt;/span&gt; |options|
    &lt;span class="c"&gt;# Create a custom keychain for code signing&lt;/span&gt;
    create_keychain&lt;span class="o"&gt;(&lt;/span&gt;
      name: &lt;span class="s1"&gt;'keychain'&lt;/span&gt;,
      password: &lt;span class="s1"&gt;'password'&lt;/span&gt;,
      default_keychain: &lt;span class="nb"&gt;true&lt;/span&gt;,
      unlock: &lt;span class="nb"&gt;true&lt;/span&gt;,
      &lt;span class="nb"&gt;timeout&lt;/span&gt;: 3600,
      add_to_search_list: &lt;span class="nb"&gt;true&lt;/span&gt;
    &lt;span class="o"&gt;)&lt;/span&gt;

    match&lt;span class="o"&gt;(&lt;/span&gt;
      storage_mode: &lt;span class="s1"&gt;'git'&lt;/span&gt;,
      &lt;span class="nb"&gt;type&lt;/span&gt;: &lt;span class="s2"&gt;"appstore"&lt;/span&gt;,
      keychain_name: &lt;span class="s1"&gt;'keychain'&lt;/span&gt;,
      keychain_password: &lt;span class="s1"&gt;'password'&lt;/span&gt;,
      &lt;span class="nb"&gt;readonly&lt;/span&gt;: &lt;span class="nb"&gt;true&lt;/span&gt;,
      git_url: &lt;span class="s1"&gt;'https/github/url'&lt;/span&gt; &lt;span class="c"&gt;## where secrets is hosted.&lt;/span&gt;
    &lt;span class="o"&gt;)&lt;/span&gt;

    &lt;span class="c"&gt;# Building the iOS app&lt;/span&gt;
    gym&lt;span class="o"&gt;(&lt;/span&gt;
      workspace: &lt;span class="s2"&gt;"./Example.xcworkspace"&lt;/span&gt;,
      include_bitcode: &lt;span class="nb"&gt;true&lt;/span&gt;,
      include_symbols: &lt;span class="nb"&gt;true&lt;/span&gt;,
      silent: &lt;span class="nb"&gt;true&lt;/span&gt;,
      clean: &lt;span class="nb"&gt;true&lt;/span&gt;,
      scheme: &lt;span class="s2"&gt;"Example"&lt;/span&gt;,
      export_method: &lt;span class="s2"&gt;"app-store"&lt;/span&gt;
    &lt;span class="o"&gt;)&lt;/span&gt;
  end


  desc &lt;span class="s2"&gt;"Upload to testflight"&lt;/span&gt;
  lane :testflight_release_to_app_store &lt;span class="k"&gt;do&lt;/span&gt; |options|
    build
    upload_to_testflight&lt;span class="o"&gt;(&lt;/span&gt;
      skip_submission: &lt;span class="nb"&gt;true&lt;/span&gt;,
      skip_waiting_for_build_processing: &lt;span class="nb"&gt;true&lt;/span&gt;
    &lt;span class="o"&gt;)&lt;/span&gt;
  end

  desc &lt;span class="s2"&gt;"Upload to production"&lt;/span&gt;
  lane :production_release_to_app_store &lt;span class="k"&gt;do&lt;/span&gt; |options|
    build
    upload_to_app_store&lt;span class="o"&gt;(&lt;/span&gt;
      skip_screenshots: &lt;span class="nb"&gt;true&lt;/span&gt;,
      skip_metadata: &lt;span class="nb"&gt;true&lt;/span&gt;
    &lt;span class="o"&gt;)&lt;/span&gt;
  end
end

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

&lt;/div&gt;



&lt;p&gt;For Android, create folder named fastlane inside android with similar setup of ios, uses AppFile and FastFile&lt;/p&gt;

&lt;p&gt;AppFile: contains package name and path to secret json key that provided by Google. Steps : &lt;a href="https://docs.fastlane.tools/actions/supply/#setup"&gt;https://docs.fastlane.tools/actions/supply/#setup&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;json_key_file&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"app/api.json"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="c"&gt;# path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one&lt;/span&gt;
package_name&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"com.example.karkipy"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;


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

&lt;/div&gt;



&lt;p&gt;FastFile: contains steps for fastlane to build and deploy android app&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;default_platform&lt;span class="o"&gt;(&lt;/span&gt;:android&lt;span class="o"&gt;)&lt;/span&gt;

platform :android &lt;span class="k"&gt;do
  &lt;/span&gt;desc &lt;span class="s2"&gt;"Build aab file"&lt;/span&gt;
  lane :build &lt;span class="k"&gt;do
    &lt;/span&gt;gradle&lt;span class="o"&gt;(&lt;/span&gt;
      task: &lt;span class="s1"&gt;'bundle'&lt;/span&gt;,
      build_type: &lt;span class="s1"&gt;'Release'&lt;/span&gt;
    &lt;span class="o"&gt;)&lt;/span&gt;
  end

  desc &lt;span class="s2"&gt;"Release for alpha testing"&lt;/span&gt;
  lane :alpha_release_to_play_store &lt;span class="k"&gt;do
    &lt;/span&gt;build
    upload_to_play_store&lt;span class="o"&gt;(&lt;/span&gt;
      package_name: &lt;span class="s1"&gt;'com.example.karkipy'&lt;/span&gt;,
      track: &lt;span class="s2"&gt;"alpha"&lt;/span&gt;,
      skip_upload_apk: &lt;span class="nb"&gt;true&lt;/span&gt;,
      aab: &lt;span class="s2"&gt;"app/build/outputs/bundle/release/app-release.aab"&lt;/span&gt;
    &lt;span class="o"&gt;)&lt;/span&gt;
  end

  desc &lt;span class="s2"&gt;"Release for production"&lt;/span&gt;
  lane :production_release_to_play_store &lt;span class="k"&gt;do
    &lt;/span&gt;build
    upload_to_play_store&lt;span class="o"&gt;(&lt;/span&gt;
      package_name: &lt;span class="s1"&gt;'com.example.karkipy'&lt;/span&gt;,
      track: &lt;span class="s2"&gt;"production"&lt;/span&gt;,
      skip_upload_apk: &lt;span class="nb"&gt;true&lt;/span&gt;,
      aab: &lt;span class="s2"&gt;"app/build/outputs/bundle/release/app-release.aab"&lt;/span&gt;
    &lt;span class="o"&gt;)&lt;/span&gt;
  end
end

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

&lt;/div&gt;



&lt;p&gt;Now we move to Deploying our app using github actions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;name: Publish Staging App to App Store and Play Store

on:
  release:
    types: &lt;span class="o"&gt;[&lt;/span&gt;published]
&lt;span class="nb"&gt;jobs&lt;/span&gt;:
  release-ios:
    name: Build Staging app and release  to testflight app
    needs: &lt;span class="o"&gt;[&lt;/span&gt;increment-app-build]
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v1
      - name: Use Node.js &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="p"&gt;{ matrix.node-version &lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;
        uses: actions/setup-node@v1
        with:
          node-version: &lt;span class="s1"&gt;'10.x'&lt;/span&gt;
      - name: Login Github User
        run: &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"machine github.com&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;  login &lt;/span&gt;&lt;span class="nv"&gt;$PERSONAL_ACCESS_TOKEN&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/.netrc
        &lt;span class="nb"&gt;env&lt;/span&gt;:
          PERSONAL_ACCESS_TOKEN: &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="p"&gt;{ secrets.PERSONAL_ACCESS_TOKEN &lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;
      - name: Install packages
        run: |
          yarn &lt;span class="nb"&gt;install&lt;/span&gt;
      - name: Bundle and Upload to AppStore
        run: |
          &lt;span class="nb"&gt;cd &lt;/span&gt;ios &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; pod &lt;span class="nb"&gt;install
          &lt;/span&gt;fastlane ios testflight_release_to_app_store
        &lt;span class="nb"&gt;env&lt;/span&gt;:
          FASTLANE_PASSWORD: &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="p"&gt;{ secrets.APPLE_ID_PASSWORD &lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;
          MATCH_PASSWORD: &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="p"&gt;{ secrets.MATCH_PASSWORD &lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;

  release-android:
    name: Build staging app and release to alpha track android
    needs: &lt;span class="o"&gt;[&lt;/span&gt;increment-app-build]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: &lt;span class="s1"&gt;'10.x'&lt;/span&gt;
      - uses: actions/setup-ruby@v1
        with:
          ruby-version: &lt;span class="s1"&gt;'2.x'&lt;/span&gt;
      - name: Install packages
        run: |
          yarn &lt;span class="nb"&gt;install
          &lt;/span&gt;yarn react-native &lt;span class="nb"&gt;link&lt;/span&gt;
      - name: Install Fastlane
        run:  gem &lt;span class="nb"&gt;install &lt;/span&gt;fastlane
      - name: Bundle and Upload to PlayStore
        run: |
          &lt;span class="nb"&gt;cd &lt;/span&gt;android
          fastlane android alpha_release_to_play_store
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: FASTLANE_PASSWORD and MATCH_PASSWORD are values need to be provided from environment so we pass it to the env for ios deployment, MATCH_PASSWORD is created during our credential creation and FASTLANE_PASSWORD is our apple id password. Also we are loginng into github using personal access token which gives us access to the repository which has our credentials hosted.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Advantage of  React Native Debug</title>
      <dc:creator>Aashish Karki</dc:creator>
      <pubDate>Tue, 08 Dec 2020 17:00:52 +0000</pubDate>
      <link>https://dev.to/karkipy/advantage-of-react-native-debug-2jh3</link>
      <guid>https://dev.to/karkipy/advantage-of-react-native-debug-2jh3</guid>
      <description>&lt;p&gt;One of the advantages of using react native is the use of dev mode build, the build access the js bundle from your local device. &lt;/p&gt;

&lt;p&gt;In case of device being used in local network we can access the said bundle using a shake gesture and addressing the proper ip address and port i.e. usually 8081.&lt;/p&gt;

&lt;p&gt;Say we have a project where you are working on a specific feature and would require another person to see the progress of the said feature, we can achieve this by hosting the js bundle across the internet. Note: if any module/library that uses native module is added we must have a updated build.&lt;/p&gt;

&lt;p&gt;Firstly create a tmpDir folder in root then we generate the js bundle.&lt;/p&gt;

&lt;p&gt;ios:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn react-native bundle &lt;span class="nt"&gt;--platform&lt;/span&gt; ios &lt;span class="nt"&gt;--dev&lt;/span&gt; &lt;span class="nb"&gt;false&lt;/span&gt; &lt;span class="nt"&gt;--entry-file&lt;/span&gt; index.js &lt;span class="nt"&gt;--bundle-output&lt;/span&gt; tmpDir/index.ios.bundle.js &lt;span class="nt"&gt;--assets-dest&lt;/span&gt; tmpDir
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;android:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn react-native bundle &lt;span class="nt"&gt;--platform&lt;/span&gt; android &lt;span class="nt"&gt;--dev&lt;/span&gt; &lt;span class="nb"&gt;false&lt;/span&gt; &lt;span class="nt"&gt;--entry-file&lt;/span&gt; index.js &lt;span class="nt"&gt;--bundle-output&lt;/span&gt; tmpDir/index.bundle
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we host the said directory. And after that it is same as using a local network, shake and update the build access point. Android and iOS will auto detect the js bundle they require. &lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
