<?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: Jhon William</title>
    <description>The latest articles on DEV Community by Jhon William (@john_0519).</description>
    <link>https://dev.to/john_0519</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%2F1957679%2Fe5d2d539-acb0-4134-b09f-3cc50989a728.jpg</url>
      <title>DEV Community: Jhon William</title>
      <link>https://dev.to/john_0519</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/john_0519"/>
    <language>en</language>
    <item>
      <title>Deploying any app to GitHub Pages</title>
      <dc:creator>Jhon William</dc:creator>
      <pubDate>Wed, 21 Aug 2024 20:47:12 +0000</pubDate>
      <link>https://dev.to/john_0519/deploying-any-app-to-github-pages-2j17</link>
      <guid>https://dev.to/john_0519/deploying-any-app-to-github-pages-2j17</guid>
      <description>&lt;p&gt;GitHub Pages is a website holder for you &amp;amp; your projects. You can host your code directly from your GitHub repo. This article will help you how to manage your app in the master branch and deploy the code in the gh-pages branch easily.&lt;/p&gt;

&lt;p&gt;You can choose any front-end framework like React, Vue, Gatsby, Next, Nuxt, Gridsome, and build the app in the master branch and build the code using the npm run build command and host directly using the gh-pages branch.&lt;/p&gt;

&lt;p&gt;The quickest way to put your app to GitHub Pages is by using a package - gh-pages.&lt;/p&gt;

&lt;p&gt;'''bash&lt;br&gt;
npm i gh-pages -D&lt;/p&gt;

&lt;p&gt;or you can install the package globally&lt;br&gt;
'''bash&lt;br&gt;
npm i gh-pages -g&lt;br&gt;
Add this simple script to your package.json&lt;br&gt;
'''json&lt;br&gt;
{&lt;br&gt;
  "scripts": {&lt;br&gt;
    "deploy": "npm run build &amp;amp;&amp;amp; gh-pages -d dist"&lt;br&gt;
  }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Note: Assuming the build folder to be dist&lt;/p&gt;

&lt;p&gt;When you run npm run deploy all the contents of the build folder will be pushed to your repository’s gh-pages branch.&lt;br&gt;
If you are creating a User page in GitHub&lt;br&gt;
Create a repository with your username like username.github.io, Create a branch called code or you can name the branch anything. Build the app in this branch and when it comes to deploying the app use the gh-pages command to push the build folder contents to the gh-pages branch&lt;/p&gt;

&lt;p&gt;Note: In this case, you need to push your build directory to master branch, use the following command&lt;br&gt;
'''json&lt;br&gt;
{&lt;br&gt;
    "scripts": {&lt;br&gt;
        "deploy": "npm build &amp;amp;&amp;amp; gh-pages -d dist -b master",&lt;br&gt;
  }&lt;br&gt;
}&lt;br&gt;
After running npm run deploy you should see your website at &lt;a href="http://username.github.io" rel="noopener noreferrer"&gt;http://username.github.io&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run gh-pages --help to list all the supported options of the gh-pages package&lt;/p&gt;

&lt;p&gt;Useful npm scripts of gh-pages&lt;br&gt;
If your source code of the app is in a private repository, create a public repository named about, the source code will reside in the private repository and the static content generated from the build will go into the public repository&lt;br&gt;
'''json&lt;br&gt;
{&lt;br&gt;
  "scripts": {&lt;br&gt;
    "deploy": "gridsome build &amp;amp;&amp;amp; gh-pages -d dist -b master",&lt;br&gt;
  }&lt;br&gt;
}&lt;br&gt;
To include dotfiles while pushing the changes to the branch&lt;/p&gt;

&lt;p&gt;'''json&lt;br&gt;
{&lt;br&gt;
  "scripts": {&lt;br&gt;
    "deploy": "npm run build &amp;amp;&amp;amp; gh-pages -d dist -t"&lt;br&gt;
  }&lt;br&gt;
}&lt;br&gt;
To change the commit message when publishing the change&lt;br&gt;
'''json&lt;br&gt;
{&lt;br&gt;
  "scripts": {&lt;br&gt;
    "deploy": "npm run build &amp;amp;&amp;amp; gh-pages -d dist -m Build 21082020v1"&lt;br&gt;
  }&lt;br&gt;
}&lt;/p&gt;

</description>
    </item>
    <item>
      <title>50 Essential Tips for Every Developer</title>
      <dc:creator>Jhon William</dc:creator>
      <pubDate>Wed, 21 Aug 2024 04:36:08 +0000</pubDate>
      <link>https://dev.to/john_0519/50-essential-tips-for-every-developer-2bi8</link>
      <guid>https://dev.to/john_0519/50-essential-tips-for-every-developer-2bi8</guid>
      <description>&lt;p&gt;Whether you are starting to program or you are twenty years into your career, there is something here for you. Enjoy!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You are never ready. That's the fun part.&lt;/li&gt;
&lt;li&gt;Focus on one thing at a time.&lt;/li&gt;
&lt;li&gt;Just start! You'll figure everything out automatically.&lt;/li&gt;
&lt;li&gt;Build. Build. Build again.&lt;/li&gt;
&lt;li&gt;Sleep is important.&lt;/li&gt;
&lt;li&gt;Asking for help is not a sign of weakness.&lt;/li&gt;
&lt;li&gt;Watching every tutorial won't make you a developer.&lt;/li&gt;
&lt;li&gt;Writing your own code will make you a developer.&lt;/li&gt;
&lt;li&gt;You only need the fundamentals.&lt;/li&gt;
&lt;li&gt;Always plan your work.&lt;/li&gt;
&lt;li&gt;Have other hobbies. If programming is your hobby, explore new fields.&lt;/li&gt;
&lt;li&gt;Expect more from yourself than others will.&lt;/li&gt;
&lt;li&gt;Take your time and write tests.&lt;/li&gt;
&lt;li&gt;Read blog posts. Listen to podcasts. Subscribe to newsletters.&lt;/li&gt;
&lt;li&gt;Learn to read the documentation.&lt;/li&gt;
&lt;li&gt;Make a lot of mistakes.&lt;/li&gt;
&lt;li&gt;Quit looking for perfection. If it works, it works.&lt;/li&gt;
&lt;li&gt;If it works, touch it.&lt;/li&gt;
&lt;li&gt;Take a break.&lt;/li&gt;
&lt;li&gt;Connect with more people.&lt;/li&gt;
&lt;li&gt;Pair program if you can.&lt;/li&gt;
&lt;li&gt;Teach others what you know.&lt;/li&gt;
&lt;li&gt;Look for mentorship. If you can mentor someone, do it.&lt;/li&gt;
&lt;li&gt;Read more books. Fiction and Non-fiction.&lt;/li&gt;
&lt;li&gt;If you honestly think you are bad, pretend you are a good programmer and never stop pretending.&lt;/li&gt;
&lt;li&gt;Do not quit.&lt;/li&gt;
&lt;li&gt;If the tools you use feel like magic, start digging in and see under the hood.&lt;/li&gt;
&lt;li&gt;If you don't understand, copying is not the best idea.&lt;/li&gt;
&lt;li&gt;Watch conference talks on YouTube.&lt;/li&gt;
&lt;li&gt;Attend meetups and conferences too if you can.&lt;/li&gt;
&lt;li&gt;Always be a team player unless you work as an independent person.&lt;/li&gt;
&lt;li&gt;Readability is way more important than shortness.&lt;/li&gt;
&lt;li&gt;Learn more what you like than what you think you should.&lt;/li&gt;
&lt;li&gt;Find a balance between theory and practice.&lt;/li&gt;
&lt;li&gt;Invest in your development setup.&lt;/li&gt;
&lt;li&gt;Learn. Keyboard. Shortcuts.&lt;/li&gt;
&lt;li&gt;Be consistent.&lt;/li&gt;
&lt;li&gt;Try a new language.&lt;/li&gt;
&lt;li&gt;Define your payment terms explicitly.&lt;/li&gt;
&lt;li&gt;Enjoy your little winnings.&lt;/li&gt;
&lt;li&gt;Don't be scared to show off your work.&lt;/li&gt;
&lt;li&gt;Learn to comment your code.&lt;/li&gt;
&lt;li&gt;Listen to advice but make your own decisions.&lt;/li&gt;
&lt;li&gt;Support other developers. Sponsorships and the likes.&lt;/li&gt;
&lt;li&gt;Learn from everything and everyone and never miss the opportunity to learn.&lt;/li&gt;
&lt;li&gt;You should not be afraid to have simple solutions to simple problems.&lt;/li&gt;
&lt;li&gt;Take care of your mental and physical health.&lt;/li&gt;
&lt;li&gt;Try explaining concepts in writing and publishing.&lt;/li&gt;
&lt;li&gt;At the end of it all, there is family.&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>next over remix</title>
      <dc:creator>Jhon William</dc:creator>
      <pubDate>Wed, 21 Aug 2024 03:01:05 +0000</pubDate>
      <link>https://dev.to/john_0519/next-over-remix-1i6</link>
      <guid>https://dev.to/john_0519/next-over-remix-1i6</guid>
      <description>&lt;p&gt;According to my 2023 goals, my first task of the year was to convert my website to Remix and Tailwind. I completed the Tailwind conversion back in February, and the Remix conversion took me just over a month. Here's how it went.&lt;/p&gt;

&lt;h2&gt;
  
  
  🍰 conversion process
&lt;/h2&gt;

&lt;p&gt;Converting from Next.js to Remix was pretty straightforward. I started by swapping out the next.config.js for a remix.config.js. Then I had to map the _app.tsx and _document.tsx files to the Remix equivalent root.tsx file.&lt;/p&gt;

&lt;p&gt;Next I moved all of my pages into the routes folder and modified the structure slightly. All of the getStaticProps calls had to be converted to Remix loader functions, and I had to use the Remix meta function for SEO information. Then I swapped out the Next  component for the Remix one.&lt;/p&gt;

&lt;p&gt;Ultimately the pull request was only a four line difference if you don't count the package-lock.json file. Both frameworks were structured in a similar manner, but something about Remix felt simpler.&lt;br&gt;
😖 issues&lt;br&gt;
The project wasn't without issues though. The first problem I noticed was that sometimes page transitions weren't loading data correctly. That's because the loader functions must be exported inline, rather than at the bottom of the file.&lt;br&gt;
export const loader = () =&amp;gt; {}&lt;br&gt;
The next issue I hit was a very weird one. Once deployed to Vercel, I was no longer able to read my local markdown files. After some deep searching, I found that referencing process.cwd() does not work the same in Remix as it does in Next.js when hosted on Vercel. The solution was to use dirname to construct paths, so that they can be statically analyzed by the hosting platform.&lt;br&gt;
const postsPath =${dirname}/../content/posts``&lt;br&gt;
Another similar problem I ran into was with gatsby-remark-vscode causing build failures. Internally it looks for some other files in nearby directories, which were not in their expected locations because I had told Remix to bundle all server dependencies. Unfortunately I never found a solution to this problem.&lt;/p&gt;

&lt;p&gt;But the last issue I ran into was enough to put a stop to the project. Because Remix is an SSR framework, I was sending API requests to fetch my latest YouTube videos on every page load, which depleted my quota and caused me to get rate limited for the rest of the day.&lt;/p&gt;

&lt;p&gt;I investigated using cache headers on the request sent from the server and from the browser, but nothing seemed to have any effect. Instead of go further down the caching rabbit hole with something like Redis, or set up a cron job to pull my latest videos, I decided that it was too much infrastructure for a static site.&lt;/p&gt;

&lt;p&gt;🏎️ performance&lt;br&gt;
But regardless, I wanted to see how a fully server rended application performed when compared to my existing Next.js site.&lt;/p&gt;

&lt;p&gt;Next.js Remix&lt;br&gt;
Requests 52 27&lt;br&gt;
Transferred 992kb 990kb&lt;br&gt;
Resources 2mb 2mb&lt;br&gt;
Finish 1.2s 1.5s&lt;br&gt;
DOMContentLoaded 500ms 750ms&lt;br&gt;
Load 850ms 1.2s&lt;/p&gt;

&lt;p&gt;Despite the fact that Next.js had many more network requests to fetch neighboring pages, it was faster in nearly every way! The loading experience was identical in both applications, with no noticable differences in layout shift or perceived loading time.&lt;/p&gt;

&lt;p&gt;🎬 conclusion&lt;br&gt;
Given the issues I ran into, it showed me that Remix isn't the right choice for a static blog. While the simplicity and developer experience is amazing, Remix really shines for authenticated web applications. That's why we're using it at Atlassian for our latest internal tools.&lt;/p&gt;

&lt;p&gt;With that being said, I'm going to stick with Next.js for now. I'm still hosting on Vercel, and they go together like peanut butter and jelly. However, I'm still debating on how far I push into the Next.js ecosystem. I recently made an effort to remove the component from my codebase, as it locked me into using Next.js. But their new @next/font module is very enticing...&lt;/p&gt;

&lt;p&gt;At the end of the day, I should stop rewriting my website and start finishing all of the blog ideas I have!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>🧪 vscode test current file task</title>
      <dc:creator>Jhon William</dc:creator>
      <pubDate>Wed, 21 Aug 2024 02:22:55 +0000</pubDate>
      <link>https://dev.to/john_0519/vscode-test-current-file-task-1bn8</link>
      <guid>https://dev.to/john_0519/vscode-test-current-file-task-1bn8</guid>
      <description>&lt;p&gt;While setting up a new project at Atlassian, I decided to dive into some &lt;code&gt;vscode&lt;/code&gt;workspace settings to see how I could improve the developer experience. I found the task system to be pretty interesting and extensible, so I created a custom task to run tests against the currently open file.&lt;/p&gt;

&lt;p&gt;Custom task definitions are placed in &lt;code&gt;.vscode/tasks.json&lt;/code&gt;. Most of the fields are straightforward, but the &lt;code&gt;command&lt;/code&gt; property has some interesting bits. There are all sorts of variables you can use to get information about the current file and directory you're in. You can also do things like run a task when a workspace is opened with the &lt;code&gt;runOn&lt;/code&gt; property. Here's what my task definition looked like.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{&lt;br&gt;
    "version": "2.0.0",&lt;br&gt;
    "tasks": [&lt;br&gt;
        {&lt;br&gt;
            "label": "test current file",&lt;br&gt;
            "type": "shell",&lt;br&gt;
            "command": "npm run test &lt;br&gt;
                        ${fileBasenameNoExtension}.test${fileExtname}",&lt;br&gt;
            "group": "test",&lt;br&gt;
            "presentation": {&lt;br&gt;
                "clear": true,&lt;br&gt;
                "close": false,&lt;br&gt;
                "panel": "dedicated"&lt;br&gt;
            }&lt;br&gt;
        }&lt;br&gt;
    ]&lt;br&gt;
}&lt;/code&gt;&lt;br&gt;
To run this task, open up the command palette by pressing&lt;code&gt;Cmd+P&lt;/code&gt;. Then select &lt;code&gt;Tasks: Run Tasks&lt;/code&gt; to view a list of custom tasks. Finally, choose the &lt;code&gt;test current file&lt;/code&gt; task from the list. If you ask me, this is a much better workflow than executing &lt;code&gt;npm run test&lt;/code&gt; and then entering in the exact file path you're looking for.&lt;/p&gt;

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