<?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: Breno Alves</title>
    <description>The latest articles on DEV Community by Breno Alves (@brenoalves).</description>
    <link>https://dev.to/brenoalves</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%2F815084%2F6cf11233-43fd-486c-a1ca-66de10e63637.png</url>
      <title>DEV Community: Breno Alves</title>
      <link>https://dev.to/brenoalves</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/brenoalves"/>
    <language>en</language>
    <item>
      <title>Bare minimum setup on VSCode to work on TS/JS projects</title>
      <dc:creator>Breno Alves</dc:creator>
      <pubDate>Thu, 06 Oct 2022 20:43:02 +0000</pubDate>
      <link>https://dev.to/brenoalves/bare-minimum-setup-on-vscode-to-work-on-tsjs-projects-jeh</link>
      <guid>https://dev.to/brenoalves/bare-minimum-setup-on-vscode-to-work-on-tsjs-projects-jeh</guid>
      <description>&lt;p&gt;There are plenty of VSCode Extensions on the marketplace but which one is necessary when it comes to working with TS/JS projects?&lt;/p&gt;

&lt;p&gt;I'll cover the bare minimum extensions to work on a well-established TS/JS project and some extras which I find very helpful in my day-to-day tasks.&lt;/p&gt;




&lt;h2&gt;
  
  
  Eslint
&lt;/h2&gt;

&lt;p&gt;When it comes to working with others developers in environments where we need to keep consistent code, we need to have something to make sure everyone is following certain rules and Eslint does exactly this.&lt;/p&gt;

&lt;p&gt;To use this extension you need to install Eslint on your project as a development dependency and a configuration file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i -D eslint
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you can find some good examples of configuration files at Eslint &lt;a href="https://eslint.org/docs/latest/user-guide/configuring/configuration-files" rel="noopener noreferrer"&gt;docs&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint" rel="noopener noreferrer"&gt;Eslint&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prettier and EditorConfig
&lt;/h2&gt;

&lt;p&gt;Those two tools work alongside Eslint to help developers format and follow all patterns established.&lt;/p&gt;

&lt;p&gt;To use Prettier you need to install it as a developer dependency and create a prettier config file (&lt;a href="https://prettier.io/docs/en/configuration.html" rel="noopener noreferrer"&gt;docs&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;npm i -D prettier
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and for EditorConfig you will need to create an editorConfig file as well (&lt;a href="https://editorconfig.org/#example-file" rel="noopener noreferrer"&gt;docs&lt;/a&gt;)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode" rel="noopener noreferrer"&gt;Prettier&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig" rel="noopener noreferrer"&gt;EditorConfig&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Extras
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Package Json Upgrade
&lt;/h3&gt;

&lt;p&gt;This extension is very helpful when you need to easily visualize which package you can upgrade and which versions are available  &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%2Fpxe3hygrzwxjk3vy06m1.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%2Fpxe3hygrzwxjk3vy06m1.png" alt="Package upgrade view"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=codeandstuff.package-json-upgrade" rel="noopener noreferrer"&gt;Package Json Upgrade&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Dev Containers
&lt;/h3&gt;

&lt;p&gt;Dev containers is very helpful when working with docker containers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers" rel="noopener noreferrer"&gt;Dev Containers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Github Copilot
&lt;/h3&gt;

&lt;p&gt;I can't put in a few words how much this is helpful nowadays... if you are not aware of what copilot is please check out some videos on youtube about it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://marketplace.visualstudio.com/items?itemName=GitHub.copilot" rel="noopener noreferrer"&gt;Copilot&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>typescript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>The bare minimum to work with Git</title>
      <dc:creator>Breno Alves</dc:creator>
      <pubDate>Thu, 06 Oct 2022 19:50:05 +0000</pubDate>
      <link>https://dev.to/brenoalves/barely-minimum-to-work-with-git-6b</link>
      <guid>https://dev.to/brenoalves/barely-minimum-to-work-with-git-6b</guid>
      <description>&lt;p&gt;Whether starting a solo project or working with someone else you got to have your things right. &lt;/p&gt;




&lt;h1&gt;
  
  
  Name and Email:
&lt;/h1&gt;

&lt;p&gt;The first step to configure Git is to configure your user name and email. We can do so by typing the following lines&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global user.name "My Name"
git config --global user.email "My Email"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  SSH key
&lt;/h1&gt;

&lt;p&gt;go to ssh folder on your computer and create a new one&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ~/.ssh

ssh-keygen -t ed25519 -C "My email"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you'll be asked many questions that you should read first but you can ignore those and just press enter for everyone.&lt;/p&gt;

&lt;p&gt;now run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat ./id_ed25519.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;now you can get your public key and use it on Github/Gitlab/GitBucket. I'll be showing you how to do it on Github.&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%2Fatezq5tp5ak9wyrgsjkv.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%2Fatezq5tp5ak9wyrgsjkv.png" alt="Showing Settings button"&gt;&lt;/a&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5m1jnw4e3z7i989modz7.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%2F5m1jnw4e3z7i989modz7.png" alt="Showing SSH/GPG button"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now use the public key we got before.&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%2Faa7uhb0lp8uetki7qjhe.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%2Faa7uhb0lp8uetki7qjhe.png" alt="Using previous key"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Every time you feel needed to edit your &lt;code&gt;.gitconfig&lt;/code&gt; you can do so by running the following line on your terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global --edit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Cool stuff
&lt;/h1&gt;

&lt;p&gt;There is a lot of cool stuff we can configure on Git but I'll list some of them here and leave them for a new article.&lt;/p&gt;



&lt;h3&gt;
  
  
  Configuring the initial branch
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global init.defaultBranch master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Configuring signature with GPG/SSH key
&lt;/h3&gt;

&lt;p&gt;Link: &lt;a href="https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification#ssh-commit-verification" rel="noopener noreferrer"&gt;Docs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>git</category>
      <category>github</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Air: Live reload on Golang applications</title>
      <dc:creator>Breno Alves</dc:creator>
      <pubDate>Sat, 19 Feb 2022 18:43:46 +0000</pubDate>
      <link>https://dev.to/brenoalves/air-live-reload-on-golang-applications-1fgk</link>
      <guid>https://dev.to/brenoalves/air-live-reload-on-golang-applications-1fgk</guid>
      <description>&lt;p&gt;Go is a programming language with advanced features and clean syntax. It has a robust and well-documented common library, and has focus on good software engineering and principles.&lt;/p&gt;

&lt;p&gt;Although Go is a great language, there's one downside: it needs to be recompiled every time after a single line change.&lt;/p&gt;

&lt;p&gt;So, to make our lives easier in this post we're gonna learn how to use Air as our live reload.&lt;/p&gt;




&lt;h2&gt;
  
  
  App
&lt;/h2&gt;

&lt;p&gt;Init with Go mod&lt;/p&gt;

&lt;p&gt;&lt;code&gt;go mod init helloworld&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Creating App Go file&lt;br&gt;
&lt;/p&gt;

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

import (
    "fmt"
    "net/http"
)

func main() {
    port := 3000
    fmt.Println("Starting Server on port", port)

    http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
        w.Write([]byte("Hello, World"))
    })
    http.ListenAndServe(":3000", nil)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Air:
&lt;/h2&gt;

&lt;p&gt;Installing Air.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;go get -u github.com/cosmtrek/air&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Air configuration file&lt;/p&gt;

&lt;p&gt;&lt;code&gt;air init&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Starting Air.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;air&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You'll have the following result:&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%2Fvuw93ob8jfntfdnuj146.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%2Fvuw93ob8jfntfdnuj146.png" alt="Air running"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now after any file change Air will reload your app automatically.&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%2F5cdzbee5kmal3hy0uuts.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%2F5cdzbee5kmal3hy0uuts.png" alt="Air reloading"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Air and Docker
&lt;/h2&gt;

&lt;p&gt;First we need to create a Dockerfile&lt;br&gt;
&lt;/p&gt;

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

FROM cosmtrek/air

RUN mkdir -p /app/dist
COPY ./ /app/
WORKDIR /app/

RUN go get -d -v ./...
RUN go install -v ./...

CMD ["air"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we need to create a docker-compose to make our life easier&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# docker-compose.yml

version: '3.7'
services:
  app:
    build: .
    ports:
      - '3000:3000'
    volumes:
      - ./:/app/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you just need to run &lt;code&gt;docker-compose up&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And you'll have the following result:&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%2Fajycxdq1fjn40l9p5a5w.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%2Fajycxdq1fjn40l9p5a5w.png" alt="Air in docker container"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;References:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Air: &lt;a href="https://github.com/cosmtrek/air" rel="noopener noreferrer"&gt;https://github.com/cosmtrek/air&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Golang-book: &lt;a href="https://www.golang-book.com/books/intro/1" rel="noopener noreferrer"&gt;https://www.golang-book.com/books/intro/1&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>go</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
