<?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: Gabriel José Oliveira</title>
    <description>The latest articles on DEV Community by Gabriel José Oliveira (@gabrieljoseoliveira).</description>
    <link>https://dev.to/gabrieljoseoliveira</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%2F743535%2Fa38c49a0-b194-40f1-a210-ac7b90b9b56c.jpeg</url>
      <title>DEV Community: Gabriel José Oliveira</title>
      <link>https://dev.to/gabrieljoseoliveira</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gabrieljoseoliveira"/>
    <language>en</language>
    <item>
      <title>A quick guide for package.json dependencies management</title>
      <dc:creator>Gabriel José Oliveira</dc:creator>
      <pubDate>Thu, 25 Nov 2021 00:49:06 +0000</pubDate>
      <link>https://dev.to/gabrieljoseoliveira/a-quick-guide-for-packagejson-dependencies-management-ada</link>
      <guid>https://dev.to/gabrieljoseoliveira/a-quick-guide-for-packagejson-dependencies-management-ada</guid>
      <description>&lt;p&gt;If you've just studied html, css and basic javascript and are starting with some framework that uses node, like react, you may have some doubts about managing dependencies. &lt;/p&gt;

&lt;p&gt;So let's take a look at some useful commands and get rid of the fear of play with package.json!&lt;/p&gt;

&lt;h2&gt;
  
  
  let's start
&lt;/h2&gt;

&lt;p&gt;First, let's create the package.json file using the following command in the terminal:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm init -y&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;With this command, we generate a standard package.json file 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;{
  "name": "project-name",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" &amp;amp;&amp;amp; exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When working with node, some dependencies are used for development purposes and others will remain until the end. So we will have two fields:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"dependencies": {},
"devDependencies: {}"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's start by installing a normal dependency and then we'll pass it on to the development dependencies and understand how to manipulate their versions. Let's use express as example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install express&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"dependencies": {
    "express": "^4.17.1"
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's understand what this symbol and numbers represent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"dependencies": {
    //          prefix
    "express": "^    4.     17.    1",
    //               major  minor  patch
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Patch: normally, when a bug is fixed, the patch value is updated.&lt;/p&gt;

&lt;p&gt;Minor: when new features are added but compatibility is not broken, the minor value is updated.&lt;/p&gt;

&lt;p&gt;Major: when new features are added and there is a break in compatibility with previous features, the major value is updated.&lt;/p&gt;

&lt;p&gt;Prefix: some symbols used by the node to update dependencies using the &lt;code&gt;npm update&lt;/code&gt; command, such as ^ or ~. &lt;/p&gt;

&lt;p&gt;We can use them to install a dependency like: &lt;code&gt;npm install express@~2.0.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;When we use the "^", we are saying that we only want to keep the "patch" and "minor" up to date.&lt;/p&gt;

&lt;p&gt;When we use the "~", we are saying that we only want to keep the "minor" up to date.&lt;/p&gt;

&lt;p&gt;Without the prefix we are looking for an exact version. &lt;/p&gt;

&lt;p&gt;If we use "-E" like &lt;code&gt;npm install express -E&lt;/code&gt;, there will be no prefix and the dependency will never be updated.&lt;/p&gt;

&lt;p&gt;Now, what if we want to move express into the &lt;code&gt;"devDependencies: {}"&lt;/code&gt;? For that we use the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install express --save-dev&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And with that our express will be inside &lt;code&gt;"devDependencies: {}"&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"devDependencies": {
    "express": "^4.17.1"
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To get our express back to production dependencies, we use the following command: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install express --save-prod&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Finally, we can use &lt;code&gt;npm install express@latest&lt;/code&gt; to get the latest version (may not be stable) and &lt;code&gt;npm uninstall express&lt;/code&gt; to uninstall the dependency.&lt;/p&gt;

&lt;p&gt;To list all our dependencies, we can use &lt;code&gt;npm ls&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;But sometimes our projects have a lot of dependencies, so if we just want to see the main ones we've installed, we can use a depth control like: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm ls --depth=0&lt;/code&gt; and keep increasing.&lt;/p&gt;

&lt;p&gt;To check if any dependencies are out of date we can use &lt;code&gt;npm outdated&lt;/code&gt; and we will be informed of updates according to the prefixes used.&lt;/p&gt;

&lt;h3&gt;
  
  
  I hope you have enjoyed!
&lt;/h3&gt;

&lt;p&gt;And if you have any other command tips, leave it in the comments.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>npm</category>
    </item>
    <item>
      <title>I made a web game and I need your opinion</title>
      <dc:creator>Gabriel José Oliveira</dc:creator>
      <pubDate>Thu, 04 Nov 2021 18:40:43 +0000</pubDate>
      <link>https://dev.to/gabrieljoseoliveira/i-made-a-web-game-and-i-need-your-opinion-4ej4</link>
      <guid>https://dev.to/gabrieljoseoliveira/i-made-a-web-game-and-i-need-your-opinion-4ej4</guid>
      <description>&lt;p&gt;Hello World! This is my first post here and I would like to show you my game, talk a little about it and ask your opinion about.&lt;/p&gt;

&lt;p&gt;Game: (&lt;a href="https://labirinto-sequencial-psi.vercel.app/tutorialE.html" rel="noopener noreferrer"&gt;https://labirinto-sequencial-psi.vercel.app/tutorialE.html&lt;/a&gt;)&lt;br&gt;
GitHub: (&lt;a href="https://github.com/gjoliveira/Labirinto-Sequencial" rel="noopener noreferrer"&gt;https://github.com/gjoliveira/Labirinto-Sequencial&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;In the game menu there is a link for you to leave your opinion and report any bugs, let me know what you think of the ideas execution and if there is anything I can improve. So far, the game has performed better in Chrome and Edge browsers.&lt;/p&gt;

&lt;p&gt;As you can see, on github I linked the project and explained a little bit about it, the article from which the idea was taken is not in English but let's talk more about the premise below.&lt;/p&gt;

&lt;h2&gt;
  
  
  The idea and the rules
&lt;/h2&gt;

&lt;p&gt;The project's idea was for students to answer questions while walking through a different maze, the maze is composed of colored ribbons glued to the floor, which must be passed in order: blue, red and yellow.&lt;/p&gt;

&lt;p&gt;Wrong collor? go back to the beginning. Beat the team of students who reach the end of the maze by correctly answering the questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Now doing it virtually
&lt;/h2&gt;

&lt;p&gt;In the "live action" game, it may take a while, but the virtual version will run quickly. So I made new rules and things that only a virtual environment offers and increased the playing time.&lt;/p&gt;

&lt;p&gt;There's also a step counter, timer and life hearts to add some challenge.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to do this?
&lt;/h2&gt;

&lt;p&gt;There are several frameworks and engines for games, but as I was already studying javascript I decided to bet on the web environment and on Phaser Js framework.&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%2Fsx2abl4yphcy7jpxostv.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%2Fsx2abl4yphcy7jpxostv.png" alt="Phaser Js logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Phaser has a simple system to understand, each scene in the game is a class with 3 functions, one to load files, another to arrange game objects, and the third is a function that updates every time.&lt;/p&gt;

&lt;p&gt;Simple, but I had never done anything like it and the project took 2 months. I didn't have a good knowledge of object orientation at that time.&lt;/p&gt;

&lt;p&gt;I try to be talented in the art world, but that's another story 🤣, the game was all done in windows Paint, with the exception of the main character's sprite and some other objects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reviews about our projects make them better
&lt;/h2&gt;

&lt;p&gt;I don't know how it's performing on other devices and I need to know if I'm on the right track. Please, leave your comment. 😉✌&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>webdev</category>
      <category>gamedev</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
