<?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>Forem: Bennett(he/him)</title>
    <description>The latest articles on Forem by Bennett(he/him) (@baharajr).</description>
    <link>https://forem.com/baharajr</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%2F136073%2F4d8b241c-c59b-41ed-9868-5335b8497d40.jpeg</url>
      <title>Forem: Bennett(he/him)</title>
      <link>https://forem.com/baharajr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/baharajr"/>
    <language>en</language>
    <item>
      <title>Release Ionic APK with GitHub Actions</title>
      <dc:creator>Bennett(he/him)</dc:creator>
      <pubDate>Sat, 05 Feb 2022 07:43:19 +0000</pubDate>
      <link>https://forem.com/baharajr/release-ionic-apk-with-github-actions-27hc</link>
      <guid>https://forem.com/baharajr/release-ionic-apk-with-github-actions-27hc</guid>
      <description>&lt;p&gt;Recently I was tasked with creating CI/CD that would add Android APK to releases in GitHub with every PR to main from an ionic codebase. I had never worked with ionic before and the person working on the codebase wasn’t that cooperative so I decided to dive in and explore the codebase to accomplish my task. Here are the steps I followed.&lt;/p&gt;

&lt;p&gt;Step 1.&lt;br&gt;
I created a bash script with all the initial plugins installation for android in the ionic codebase as shown in the image below.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LdzhX8uu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6tp9zcq5jrr6jzw9ry1q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LdzhX8uu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6tp9zcq5jrr6jzw9ry1q.png" alt="Image description" width="800" height="339"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 2.&lt;br&gt;
I installed Cordova globally in the execution context of the workflow: &lt;code&gt;npm i -g cordova&lt;/code&gt;&lt;br&gt;
Installed dependencies with: &lt;code&gt;npm i&lt;/code&gt;&lt;br&gt;
Step 3.&lt;br&gt;
Since I wasn’t using Android Studio in the workflow, I had to use jetifier so I installed it and run &lt;code&gt;npx jetify&lt;/code&gt; to migrate Java, XML, POM, and ProGuard references that point to android.support.* packages, changing them so they point to the corresponding androidx.* packages.(As per docs on jetifier)&lt;/p&gt;

&lt;p&gt;Step 4.&lt;br&gt;
I was going to use capacitor to create my android build folder from which I would build the APK so I first built the source codes that generate a .www folder that capacitor uses to generate the android artifacts and then ran: &lt;br&gt;
&lt;code&gt;npx ionic capacitor copy android &amp;amp;&amp;amp; npx cap sync android&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Step 5.&lt;br&gt;
Move into the android folder and use gradlew to build the final APK with: &lt;code&gt;cd android &amp;amp;&amp;amp; ./gradlew assembleDebug&lt;/code&gt;&lt;br&gt;
NB: For some reason, it doesn’t work without being in the android folder.&lt;/p&gt;

&lt;p&gt;The final APK will be in &lt;code&gt;app/build/outputs/apk/debug/&lt;/code&gt;&lt;/p&gt;

</description>
      <category>ionic</category>
      <category>github</category>
      <category>githubaction</category>
    </item>
    <item>
      <title>Deploying a NestJs App with TypeORM &amp; PostgreSQL on Heroku</title>
      <dc:creator>Bennett(he/him)</dc:creator>
      <pubDate>Fri, 05 Feb 2021 21:39:37 +0000</pubDate>
      <link>https://forem.com/baharajr/deploying-a-nestjs-app-with-typeorm-postgresql-on-heroku-55n1</link>
      <guid>https://forem.com/baharajr/deploying-a-nestjs-app-with-typeorm-postgresql-on-heroku-55n1</guid>
      <description>&lt;p&gt;I recently created a simple full-stack todo app written in &lt;a href="https://angular.io/"&gt;Angular&lt;/a&gt; for the frontend and &lt;a href="https://nestjs.com/"&gt;NestJs&lt;/a&gt; for the backend.&lt;/p&gt;

&lt;p&gt;I had to host the app on a live server for testing. I decided to Heroku free dyno that I normally use for hobby apps.&lt;/p&gt;

&lt;p&gt;Steps I followed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I personally use the Heroku &lt;a href="https://devcenter.heroku.com/articles/heroku-cli"&gt;CLI&lt;/a&gt;. So install one if you don't. &lt;/li&gt;
&lt;li&gt;Login to Heroku via command line
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;heroku&lt;/span&gt; &lt;span class="nx"&gt;login&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create your app on Heroku (This can be done via command line or through the &lt;a href="//heroku.com"&gt;web&lt;/a&gt;).
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;heroku&lt;/span&gt; &lt;span class="nx"&gt;create&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;devto&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;h2&gt;
  
  
  Deployment
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;There are a &lt;a href="https://devcenter.heroku.com/categories/deployment"&gt;couple of ways&lt;/a&gt; to perform deployment in Heroku

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://devcenter.heroku.com/articles/git"&gt;Deploying with Git&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://devcenter.heroku.com/categories/deployment-integrations"&gt;Deployment Integrations&lt;/a&gt; etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Setting App the Database
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Head over to your dashboard at the &lt;a href="https://dashboard.heroku.com/"&gt;web&lt;/a&gt; interface, then select your app and view resources.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BbzriI7e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/0rll2qxi5ckz8grabt4t.png" width="800" height="446"&gt;
From Resources, go down to &lt;code&gt;Add-ons&lt;/code&gt;. Search and select your desired Add-on. In our case that will be Heroku Postgres.&lt;/li&gt;
&lt;li&gt;Select your billing plan and submit your form
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JEZ1haqm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/d2mn398iq9o9wvi58c13.png" width="800" height="343"&gt;
&lt;/li&gt;
&lt;li&gt;You'll see that the add-on has been attached as a database.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A3NY5PJv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/zn1nw9ovsz68as9e3108.png" width="800" height="152"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Connecting your database to your App.
&lt;/h2&gt;

&lt;p&gt;There a few ways to do this, but the most secure is using &lt;a href="https://devcenter.heroku.com/articles/config-vars"&gt;environmental variables&lt;/a&gt;.&lt;br&gt;
We will use the nonsecure direct approach in this article and you can through the &lt;a href="https://devcenter.heroku.com/articles/config-vars"&gt;official documentation&lt;/a&gt; for setting env variables.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on the navigator toggle icon near your profile icon and select Data. Select your database in the `Datastore and then select Settings.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PhT93P0L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/ukr2lt9javr0uphlaj4b.png" width="800" height="160"&gt;
On Database Credentials, click the View Credentials button to reveal the credentials
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cwsnp2Qp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/o7ouojtorzoc75hvd2ed.png" width="800" height="225"&gt;
The credentials will be used in your TypeORM database configuration and connect directly to your database in Heroku. An example:-
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QldI-2B0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/aqadflpj64qjtope1ydh.png" width="800" height="925"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Add, commit and push changes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;And after, add and commit all your changes then push to heroku&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;git push heroku master&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;And your app will be live with a database connection. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Happy Coding.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PS: Heroku added &lt;a href="https://help.heroku.com/O0EXQZTA/how-do-i-switch-branches-from-master-to-main"&gt;documentation&lt;/a&gt; to change the default branch&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>nestjs</category>
      <category>typescript</category>
      <category>typeorm</category>
      <category>heroku</category>
    </item>
    <item>
      <title>Answer: error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class</title>
      <dc:creator>Bennett(he/him)</dc:creator>
      <pubDate>Mon, 25 May 2020 21:24:13 +0000</pubDate>
      <link>https://forem.com/baharajr/answer-error-ng6002-appears-in-the-ngmodule-imports-of-appmodule-but-could-not-be-resolved-to-an-ngmodule-class-261p</link>
      <guid>https://forem.com/baharajr/answer-error-ng6002-appears-in-the-ngmodule-imports-of-appmodule-but-could-not-be-resolved-to-an-ngmodule-class-261p</guid>
      <description>&lt;div class="ltag__stackexchange--container"&gt;
  &lt;div class="ltag__stackexchange--title-container"&gt;
    
      &lt;div class="ltag__stackexchange--title"&gt;
        &lt;div class="ltag__stackexchange--header"&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%2Fstackoverflow-logo-b42691ae545e4810b105ee957979a853a696085e67e43ee14c5699cf3e890fb4.svg" alt=""&gt;
          &lt;a href="https://stackoverflow.com/questions/60290309/error-ng6002-appears-in-the-ngmodule-imports-of-appmodule-but-could-not-be-res/60291072#60291072" rel="noopener noreferrer"&gt;
            &lt;span class="title-flare"&gt;answer&lt;/span&gt; re: error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="ltag__stackexchange--post-metadata"&gt;
          &lt;span&gt;Feb 18 '20&lt;/span&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;a class="ltag__stackexchange--score-container" href="https://stackoverflow.com/questions/60290309/error-ng6002-appears-in-the-ngmodule-imports-of-appmodule-but-could-not-be-res/60291072#60291072" rel="noopener noreferrer"&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%2Fstackexchange-arrow-up-eff2e2849e67d156181d258e38802c0b57fa011f74164a7f97675ca3b6ab756b.svg" alt=""&gt;
        &lt;div class="ltag__stackexchange--score-number"&gt;
          19
        &lt;/div&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%2Fstackexchange-arrow-down-4349fac0dd932d284fab7e4dd9846f19a3710558efde0d2dfd05897f3eeb9aba.svg" alt=""&gt;
      &lt;/a&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--body"&gt;
    
&lt;p&gt;Fixed it by opting out of Ivy as per documentation. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://angular.io/guide/ivy" rel="noreferrer noopener"&gt;https://angular.io/guide/ivy&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Change tsconfig.app.json to opt out of Ivy.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;"enableIvy": false
&lt;/code&gt;&lt;/pre&gt;

    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--btn--container"&gt;
    &lt;a href="https://stackoverflow.com/questions/60290309/error-ng6002-appears-in-the-ngmodule-imports-of-appmodule-but-could-not-be-res/60291072#60291072" class="ltag__stackexchange--btn" rel="noopener noreferrer"&gt;Open Full Answer&lt;/a&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
    </item>
    <item>
      <title>Do you always remember to catch `undefines`?</title>
      <dc:creator>Bennett(he/him)</dc:creator>
      <pubDate>Sat, 04 Apr 2020 08:45:34 +0000</pubDate>
      <link>https://forem.com/baharajr/do-you-always-remember-to-catch-undefines-5e39</link>
      <guid>https://forem.com/baharajr/do-you-always-remember-to-catch-undefines-5e39</guid>
      <description></description>
      <category>discuss</category>
    </item>
  </channel>
</rss>
