<?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: Anton Kosyakov</title>
    <description>The latest articles on DEV Community by Anton Kosyakov (@akosyakov).</description>
    <link>https://dev.to/akosyakov</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%2F119130%2Ffeba488b-d485-454b-9e73-8604978a21bc.jpeg</url>
      <title>DEV Community: Anton Kosyakov</title>
      <link>https://dev.to/akosyakov</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/akosyakov"/>
    <language>en</language>
    <item>
      <title>Simple TypeScript setup to debug Mocha tests from VS Code</title>
      <dc:creator>Anton Kosyakov</dc:creator>
      <pubDate>Sun, 06 Jan 2019 10:21:38 +0000</pubDate>
      <link>https://dev.to/akosyakov/simple-typescript-setup-to-debug-mocha-tests-from-vs-code-571f</link>
      <guid>https://dev.to/akosyakov/simple-typescript-setup-to-debug-mocha-tests-from-vs-code-571f</guid>
      <description>&lt;p&gt;&lt;a href="https://github.com/TypeStrong/ts-node" rel="noopener noreferrer"&gt;ts-node&lt;/a&gt; is a convenient tool to run TypeScript code without compilation. In &lt;a href="https://github.com/theia-ide/theia" rel="noopener noreferrer"&gt;Theia&lt;/a&gt; project it enables us to debug any Mocha spec TS file in one click from &lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;VS Code&lt;/a&gt; or &lt;a href="https://www.gitpod.io" rel="noopener noreferrer"&gt;Gitpod&lt;/a&gt;. It worked quite well for a long time and provided fast turnarounds.&lt;/p&gt;

&lt;p&gt;Over time, the codebase grew and ts-node had to interpreter more and more code to run even a single file. Besides slowness, ts-node evaluates not exactly in the same way how TypeScript compiles. For instance, it &lt;a href="https://github.com/TypeStrong/ts-node#help-my-types-are-missing" rel="noopener noreferrer"&gt;ignores some properties from tsconfig&lt;/a&gt; leading to missing types.&lt;/p&gt;

&lt;p&gt;We &lt;a href="https://github.com/theia-ide/theia/pull/2563" rel="noopener noreferrer"&gt;started looking&lt;/a&gt; for a TypeScript setup to run and debug tests without ts-node. Generally, removing dependencies to ts-node was quite straightforward. We got immediate benefits like an instant startup of tests, fewer npm packages to install and so on.&lt;/p&gt;

&lt;p&gt;The missing part was to preserve fast turnarounds of tests execution for a single spec file from VS Code. One should be able to put a breakpoint in TS source code and debug it with one click. After changes, it was possible only with generated JS code.&lt;/p&gt;

&lt;p&gt;I had started by reproducing the issue with &lt;a href="https://github.com/akosyakov/ts-mocha-debugging" rel="noopener noreferrer"&gt;a minimal setup&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;only TypeScript and Mocha installed;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/akosyakov/ts-mocha-debugging/blob/b40f7781caed2aa9223c37af380f74903938b73d/package.json#L15" rel="noopener noreferrer"&gt;watch&lt;/a&gt; npm script compiles TS code with &lt;code&gt;tsc -w&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;and &lt;a href="https://github.com/akosyakov/ts-mocha-debugging/blob/b40f7781caed2aa9223c37af380f74903938b73d/package.json#L16" rel="noopener noreferrer"&gt;test&lt;/a&gt; script runs all tests with &lt;code&gt;mocha lib/**/*.spec.js&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After that, I focused on getting the right launch configuration to debug tests from a single TS file. The issue boiled down to explaining VS Code which generated JS file to run for the currently opened TS file. Here &lt;a href="https://code.visualstudio.com/docs/editor/variables-reference" rel="noopener noreferrer"&gt;variable substitution&lt;/a&gt; came very handy. Particularly, &lt;code&gt;fileBasenameNoExtension&lt;/code&gt; variable provides a name of the currently opened file without an extension. For instance, if you open &lt;code&gt;src/repo.spec.ts&lt;/code&gt; file then it resolves to &lt;code&gt;repo.spec&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In the end, &lt;a href="https://github.com/akosyakov/ts-mocha-debugging/blob/b0b56ce858a86dbb1c99776b0915662dbb85b99c/.vscode/launch.json#L9" rel="noopener noreferrer"&gt;Mocha Tests&lt;/a&gt; configuration emerged. It executes tests from all files matching &lt;code&gt;**/${fileBasenameNoExtension}.js&lt;/code&gt;. In the case with &lt;code&gt;repo.spec.ts&lt;/code&gt; that are tests from files matching &lt;code&gt;../repo.spec.js&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can try it out with VS Code or &lt;a href="https://gitpod.io#https://github.com/akosyakov/ts-mocha-debugging" rel="noopener noreferrer"&gt;from your browser with Gitpod&lt;/a&gt; (requires OAuth with GitHub):&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sUXqLMk---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://user-images.githubusercontent.com/3082655/50573829-99274f80-0ddb-11e9-9c70-b88520888678.gif" class="article-body-image-wrapper"&gt;&lt;img alt="Debugging TypeScript Mocha Tests" src="https://res.cloudinary.com/practicaldev/image/fetch/s--sUXqLMk---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://user-images.githubusercontent.com/3082655/50573829-99274f80-0ddb-11e9-9c70-b88520888678.gif" width="800" height="631"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>mocha</category>
      <category>vscode</category>
      <category>node</category>
    </item>
    <item>
      <title>Sustainable Node.js development with only a browser</title>
      <dc:creator>Anton Kosyakov</dc:creator>
      <pubDate>Fri, 14 Dec 2018 13:07:59 +0000</pubDate>
      <link>https://dev.to/akosyakov/sustainable-nodejs-development-with-only-a-browser-4i12</link>
      <guid>https://dev.to/akosyakov/sustainable-nodejs-development-with-only-a-browser-4i12</guid>
      <description>&lt;p&gt;Nowadays, there are many collaborative platforms for showcasing JS code snippets and frameworks. Most of them run in your browser, some even manage to magically run Node.js applications in the cloud. They abstract away many possibilities in order to focus on prototyping and learning.&lt;/p&gt;

&lt;p&gt;This simplification (or even magic) eventually turns out to be a hard wall. Once we leave the prototype stage, we need to be able to control and freely combine different versions of frontend and Node.js frameworks, connect to the database that best fits our use case, use different JS flavors and deployment services.&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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2A7zkVCKjkjvyutzD5hFn_Tw.jpeg" 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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2A7zkVCKjkjvyutzD5hFn_Tw.jpeg"&gt;&lt;/a&gt;Photo by &lt;a href="https://unsplash.com/photos/fQxMGkYXqFU?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Clark Young&lt;/a&gt; on &lt;a href="https://unsplash.com/search/photos/%22workshop%22?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this blog post, I will show you a transparent way of getting started with Node.js easily without the magic. The approach taken provides a low entry barrier without the wall once you grow out of it. You will learn how to write Node.js applications in a browser-based environment, that has all the depth of a full local dev environment with VS Code but the friendly onboarding of JSFiddle. These environments can be freely shared to work together and showcase your applications.&lt;/p&gt;

&lt;p&gt;The dev environment is called &lt;a href="https://www.gitpod.io/" rel="noopener noreferrer"&gt;Gitpod&lt;/a&gt; and is entirely free for open-source development.&lt;/p&gt;

&lt;h4&gt;
  
  
  Table of Contents
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Hello World&lt;/li&gt;
&lt;li&gt;Automating Node.js setup&lt;/li&gt;
&lt;li&gt;Working with Pull Requests&lt;/li&gt;
&lt;li&gt;Working Together&lt;/li&gt;
&lt;li&gt;Developing full-stack Node.js applications&lt;/li&gt;
&lt;li&gt;Summary&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;NOTE: This is a cross-post from &lt;a href="https://medium.com/gitpod" rel="noopener noreferrer"&gt;Gitpod blog&lt;/a&gt;. Follow to get more content like this earlier!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Hello World
&lt;/h3&gt;

&lt;p&gt;Let’s get started by developing a simple “Hello World” application and learning the basics of Node.js development.&lt;/p&gt;

&lt;h4&gt;
  
  
  Start a new project
&lt;/h4&gt;

&lt;p&gt;Gitpod treats any GitHub repository as a project which can be opened. Let’s start by creating a new repository for our Hello World project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;open your GitHub dashboard and select &lt;code&gt;New Repository&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;enter a repository name and click &lt;code&gt;Create repository&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, we can open the created project in Gitpod. You can do it by simply prefixing the repository URL with &lt;strong&gt;gitpod.io#&lt;/strong&gt;. For example, I’ve called my repository node-hello-world and it can be opened in Gitpod with &lt;code&gt;gitpod.io#https://github.com/akosyakov/node-hello-world&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The first time, you will need to sign in Gitpod with your GitHub account. GitHub will ask you to authorize read access to your email address. Write access to repositories can be granted later on &lt;a href="https://gitpod.io/access-control/" rel="noopener noreferrer"&gt;your access control page&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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AK8cn3G30eQouKmWQb228LQ.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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AK8cn3G30eQouKmWQb228LQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Gitpod starts a new workspace, which is a Linux-based cloud container, and provides access to it via a VS Code powered online IDE. Workspaces are started on demand and automatically shut-down if you don’t use them. They are continuously replicated and never deleted, so you always can restart a workspace later from &lt;a href="https://gitpod.io/workspaces/" rel="noopener noreferrer"&gt;your Gitpod dashboard&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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AmXM-VDzzmpXCvlAVvQIjVw.gif" 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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AmXM-VDzzmpXCvlAVvQIjVw.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you don’t want to create a new project from scratch, click on&lt;/em&gt; &lt;a href="https://gitpod.io/#snapshot/0d82ae08-c328-4cb5-96e5-7233d5de0c11" rel="noopener noreferrer"&gt;&lt;em&gt;a snapshot link&lt;/em&gt;&lt;/a&gt; &lt;em&gt;of my workspace to try Hello World application. I will cover later how one can make a workspace snapshot.&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Writing a Node.js application
&lt;/h4&gt;

&lt;p&gt;By default, each workspace is preconfigured with standard tools like Node.js, npm, yarn and nvm. Later we will learn how to change the Node.js setup. Now, let’s code something and run it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;open the command palette (&lt;code&gt;F1&lt;/code&gt;) and select &lt;code&gt;New File&lt;/code&gt; command;&lt;/li&gt;
&lt;li&gt;create a new file with &lt;code&gt;app.js&lt;/code&gt; name and type the following content:
&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello World&lt;/span&gt;&lt;span class="dl"&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="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;from Gitpod!&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;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2Ab-63v0Asfa09vfzG" 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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2Ab-63v0Asfa09vfzG"&gt;&lt;/a&gt;As you type, you can see that Gitpod validates your code. It also provides you with smart completions and documentation on hover.&lt;/p&gt;

&lt;h4&gt;
  
  
  Run / Debug a Node.js application
&lt;/h4&gt;

&lt;p&gt;In order to run the application, type &lt;code&gt;node app.js&lt;/code&gt; into the terminal.&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%2Fcdn-images-1.medium.com%2Fmax%2F600%2F0%2AKzrRQ41oARG7XoQB" 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%2Fcdn-images-1.medium.com%2Fmax%2F600%2F0%2AKzrRQ41oARG7XoQB"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Of course, you can have more than one terminal to your cloud workspace.&lt;/p&gt;

&lt;p&gt;Next up, let’s see how we can debug the application:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;create a debug configuration (&lt;code&gt;Debug&lt;/code&gt; -&amp;gt; &lt;code&gt;Add Configuration&lt;/code&gt;) and select &lt;code&gt;Node.js: Launch Program&lt;/code&gt; configuration snippet in the content assist of the opened editor;&lt;/li&gt;
&lt;li&gt;add a breakpoint into &lt;code&gt;app.js&lt;/code&gt; file, by clicking on the gutter on the left;&lt;/li&gt;
&lt;li&gt;open the Debug View (&lt;code&gt;View&lt;/code&gt; -&amp;gt; &lt;code&gt;Debug&lt;/code&gt;),&lt;/li&gt;
&lt;li&gt;press the green &lt;code&gt;play&lt;/code&gt; icon to start debugging (or press &lt;code&gt;F5&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Our program should run, and when a breakpoint hits you can inspect call stack, variables and even use the debug console to evaluate expressions.&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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AVHUqe81CKwdHq7uK" 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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AVHUqe81CKwdHq7uK"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Working with Git
&lt;/h4&gt;

&lt;p&gt;Let’s have a look at how we can share our changes through Git. Open the &lt;code&gt;Git&lt;/code&gt; view, stage your changes, enter a commit message and click &lt;code&gt;commit&lt;/code&gt;. You can also open a diff editor by clicking on changed files and push new commits to GitHub with &lt;code&gt;Git: Push...&lt;/code&gt; command.&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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AFqWgZy08qIkj3qVp" 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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AFqWgZy08qIkj3qVp"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have not granted write access to your repositories yet, Gitpod will ask for it. Grant permissions and try to push again.&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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AbHchL7DVfmfdYWqjWsqRaw.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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AbHchL7DVfmfdYWqjWsqRaw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Automating Node.js setup &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;As mentioned above each workspace by default is preconfigured with standard tools, like Node.js 8.x.&lt;/p&gt;

&lt;p&gt;Let’s assume that we agreed on using Node.js 10.x for our project instead. Usually, all developers have to update their local Node.js versions and often switch between them depending on what project or branch is used.&lt;/p&gt;

&lt;p&gt;With Gitpod, it is different. You can configure a workspace with a specific Node.js version for each branch via Docker images, without changing the local setup for any developer at all.&lt;/p&gt;

&lt;p&gt;The easiest way to initialize the config is to use Gitpod’s CLI. The CLI will walk you through the most important configuration options and create a &lt;code&gt;.gitpod.yml&lt;/code&gt; file that is located in the root of your repository.&lt;/p&gt;

&lt;p&gt;In the terminal type &lt;code&gt;gp init&lt;/code&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;For the first option choose: &lt;code&gt;docker file&lt;/code&gt;. It will create a &lt;code&gt;Dockerfile&lt;/code&gt; that sits next to &lt;code&gt;.gitpod.yml&lt;/code&gt;. Here you can add any kind of tools and dependencies you will need for development. When starting a fresh workspace, Gitpod will pick that Dockerfile up and provide a cloud container based on that.&lt;/li&gt;
&lt;li&gt;Now press enter until the tasks section. Type &lt;code&gt;node app.js&lt;/code&gt;. The tasks are automatically started whenever a workspace gets started. You can have multiple tasks and use different lifecycles. Each task will be opened in a separate terminal.&lt;/li&gt;
&lt;/ol&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%2Fcdn-images-1.medium.com%2Fmax%2F800%2F0%2AyVXQ8QGJEmCnNQ52" 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%2Fcdn-images-1.medium.com%2Fmax%2F800%2F0%2AyVXQ8QGJEmCnNQ52"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The created files will be automatically opened in the editor. Let’s change the config so that it starts two tasks in separate terminals:&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;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;

  &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Dockerfile&lt;/span&gt;

&lt;span class="na"&gt;tasks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;

  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;init&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;node --version&lt;/span&gt;

  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;node app.js&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And change the Dockerfile to use Node.js 10.x as the base image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; node:10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To try it our we need to push the config back to GitHub and open a new workspace. Let’s do this through a pull request, so we learn about the GitHub integration on the way.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Here is&lt;/em&gt; &lt;a href="https://gitpod.io#snapshot/ea0d6704-a513-4c94-b8e7-fe72c3d8e5fb" rel="noopener noreferrer"&gt;&lt;em&gt;another snapshot link&lt;/em&gt;&lt;/a&gt; &lt;em&gt;to try our configuration without opening a pull request. You can learn more about workspace configuration&lt;/em&gt; &lt;a href="https://docs.gitpod.io/40_Configuration.html" rel="noopener noreferrer"&gt;&lt;em&gt;here&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Working with Pull Requests
&lt;/h3&gt;

&lt;p&gt;Gitpod provides seamless integration with GitHub features like creating and reviewing pull requests.&lt;/p&gt;

&lt;h4&gt;
  
  
  Creating a new Pull Request
&lt;/h4&gt;

&lt;p&gt;Let’s open a new pull request from Gitpod:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;commit your changes using the &lt;code&gt;Git&lt;/code&gt; view (see above);&lt;/li&gt;
&lt;li&gt;use &lt;code&gt;Git: Checkout&lt;/code&gt; command or click the branch item in the status bar to create a new branch. Name it somehow, e.g. &lt;code&gt;gitpodify&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;next up open the &lt;code&gt;Pull Request&lt;/code&gt; view on the right. You cannot create a new pull request yet, because first the new branch should be published to GitHub, click &lt;code&gt;publish changes&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;after that, the &lt;code&gt;Pull Request&lt;/code&gt; view will be updated and you can open a new pull request.&lt;/li&gt;
&lt;/ul&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%2Fuser-images.githubusercontent.com%2F3082655%2F50008295-00f43280-ffb4-11e8-9e05-7d88db16200c.gif" 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%2Fuser-images.githubusercontent.com%2F3082655%2F50008295-00f43280-ffb4-11e8-9e05-7d88db16200c.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Reviewing a Pull Request
&lt;/h4&gt;

&lt;p&gt;As I’ve mentioned at the beginning Gitpod treats each GitHub repository as a project. Actually, it is even smarter and can figure out from any GitHub URL which branch should be opened and how.&lt;/p&gt;

&lt;p&gt;Let’s go to the pull request page on GitHub and prefix its URL with &lt;strong&gt;gitpod.io#&lt;/strong&gt;, just like we did initially. Opening a PR with new workspace image can take some time since Gitpod needs to build the image. But it is only rebuilt when changed.&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%2Fuser-images.githubusercontent.com%2F3082655%2F50009585-9e9d3100-ffb7-11e8-945f-c7ec20cd7505.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%2Fuser-images.githubusercontent.com%2F3082655%2F50009585-9e9d3100-ffb7-11e8-945f-c7ec20cd7505.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, Gitpod opens with a branch for your pull request. PR file changes are presented on the left sidebar to review. Our init and command workspace tasks are executed in terminals, Node.js is 10.x now, and &lt;code&gt;Hello World&lt;/code&gt; is printed.&lt;/p&gt;

&lt;p&gt;While reviewing in Gitpod, you can comment, change the code to address comments, suggest new changes, etc. When you are done, merge your pull request from Gitpod as well.&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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AKIZkXiyQv3aZzsjA" 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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2AKIZkXiyQv3aZzsjA"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Working Together
&lt;/h3&gt;

&lt;p&gt;Since Gitpod workspaces are running in the cloud, we can share them in similar ways how you share documents in Google Docs.&lt;/p&gt;

&lt;h4&gt;
  
  
  Helping others with Node.js development
&lt;/h4&gt;

&lt;p&gt;You can share you running workspaces with colleagues to collaborate on exactly the same codebase, development tools, running terminals, and applications. It is particularly useful to assist each other on some tricky configuration, dependency or code problem.&lt;/p&gt;

&lt;p&gt;In order to share a running workspace: click on your account avatar, select &lt;code&gt;Share Running Workspace&lt;/code&gt;, enable sharing, copy a link and share the copied link with your colleagues.&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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2Ayp7USviOYhUm_P40" 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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2Ayp7USviOYhUm_P40"&gt;&lt;/a&gt;Both users use exactly the same workspace and see the shared output in terminals.&lt;/p&gt;

&lt;h4&gt;
  
  
  Showcasing Node.js applications
&lt;/h4&gt;

&lt;p&gt;You can take a complete snapshot (clone) of your workspace, even including your IDE layout, and share it as a link. Think about workspace snapshots like code snippets on JSFiddle. It is useful in the same way: to share reproducible examples on issues, Stack Overflow answers, for tutorials and workshops. But at the same, you share the complete development setup and present it in the appropriate way.&lt;/p&gt;

&lt;p&gt;In order to share a workspace snapshot: click on your account avatar, select &lt;code&gt;Share Workspace Snapshot&lt;/code&gt;, copy a link and share the copied link where you want.&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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2A-n2I6-4fPuKK70_5" 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%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F0%2A-n2I6-4fPuKK70_5"&gt;&lt;/a&gt;The &lt;a href="https://gitpod.io#snapshot/14dc69f1-0e8c-4a36-b221-0ab16e91326e" rel="noopener noreferrer"&gt;shared workspace snapshot&lt;/a&gt; preserves not only the development setup but the IDE layout and even selection in the editor.&lt;/p&gt;

&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Developing full-stack Node.js applications
&lt;/h3&gt;

&lt;p&gt;So far, we’ve only had a look at a simple Node.js application. In case you wonder whether it will scale to sophisticated applications you can try any of the following repositories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/gitpod-io/nodejs-shopping-cart" rel="noopener noreferrer"&gt;Node.js Shopping Cart&lt;/a&gt; is a reference Node.js application demonstrating how to use the Express framework. You can open it in Gitpod with &lt;a href="https://gitpod.io#https://github.com/gitpod-io/nodejs-shopping-cart" rel="noopener noreferrer"&gt;one-click&lt;/a&gt; and follow along &lt;a href="https://dev.to/akosyakov/debugging-nodejs-applications-in-theia-c74-temp-slug-7735617"&gt;this blog post&lt;/a&gt; explaining in details how to debug the app.&lt;/li&gt;
&lt;li&gt;Gitpod is based on an open-source IDE framework — &lt;a href="http://theia-ide.org" rel="noopener noreferrer"&gt;Theia&lt;/a&gt;. It’s built with a lot of JS technologies, including Node.js, Express, TypeScript and React. And, of course, &lt;a href="https://github.com/theia-ide/theia/blob/master/doc/Developing.md#run-the-browser-example-with-gitpod" rel="noopener noreferrer"&gt;Gitpod is used to develop Theia&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;You even can develop Electron applications in Gitpod, like VS Code. Chris demonstrates it in &lt;a href="https://medium.com/gitpod/developing-native-ui-applications-in-gitpod-15af2967c24e" rel="noopener noreferrer"&gt;this blog post&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Summary
&lt;/h3&gt;

&lt;p&gt;Gitpod provides the complete Node.js development experience right from a browser. It enables you to automate your development setup, quickly onboard developers, streamline code review and testing processes on GitHub, help each other in real time, showcase your applications and setups. Also, it is entirely free for open source development!&lt;/p&gt;

&lt;p&gt;If you have any questions, &lt;a href="https://spectrum.chat/gitpod" rel="noopener noreferrer"&gt;join Gitpod Community on Spectrum&lt;/a&gt;! We are listening intensely to all feedback.&lt;/p&gt;




</description>
      <category>productivity</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>node</category>
    </item>
  </channel>
</rss>
