Creating a Dev Container for TypeScript and VS Code — Part 2

Full-time Node.js dev container for less installation effort and more consistency.

Manfred Lange
15 min readFeb 6, 2022

--

Building on what we created in part 1, in this article we’ll cover:

  • Initializing the Node.js project with npm
  • “Hello, world!” console app in TypeScript
  • “Hello, world!” web app in TypeScript
  • Being specific about versioning
  • Keeping dependencies up to date

Introduction

At the end of part 1, we have a dev container with Node.js and npm installed. We also have a suitable set of VS Code extensions for TypeScript development.

In part 2 we will complete the creation of the dev container by initializing the npm package and by installing the TypeScript compiler. We will also investigate a simple way to run a console application and a web site. We will conclude the article with some thoughts about managing dependencies.

The complete source code for this article is available on github.

Italics: As in the previous part, all is designed to run on Linux, MacOS and Windows without code changes. However, I will use italics to describe differences that are operating system specific where necessary.

Pre-Requisites

For this article you need the following prerequisites:

Linux only: You also need docker engine for Linux.

MacOS only: You also need Docker Desktop for MacOS.

Windows only: You also need

Initializing the NPM Package

By convention when you start a Node.js code base, you initialize the containing directory with the following command:

--

--

Manfred Lange

CTO at MacroActive https://www.macroactive.com. I write about improving flow of value in software engineering. LinkedIn https://www.linkedin.com/in/manfredlange