Skip to content

dft street manager developer environment setup and on boarding

Heather Campbell edited this page May 14, 2018 · 23 revisions

Environment setup

Macs are highly recommended for developers, as the tooling for Gov Digital services projects is much easier to use (**nix based terminal commands etc.). However it is possible is develop on a Windows machine using Docker containers to maintain consistency with others.

Installing Git

You will also need a GitHub user account and it is recommended you add your GitHub account to the Kainos organisation (contact Systems).

For Mac

Already installed and available in terminal.

For Windows

Install Git Bash, here.

Installing NodeJS

NodeJS is the JavaScript runtime engine we will be building the application with, so the application will have a single language (JavaScript) for both client side and server side components.

We will be using 8.x.x LTS version (as of writing 8.11.1).

For Mac

Install latest LTS via NVM (Node Version Manager) - follow the instructions here

NVM allows you to install and control which version of Node you run, making staying consistent with production and team version much easier.

For Windows

Install via here

Installing Docker

Docker is the containerisation framework (virtualisation) we will be using to host instances of our applications in production. Developers will need docker to run instances of containers locally, allowing them to run and test the solution in the same containers that production will use.

For Mac

Install app from here

For Windows

Install app from here

(Optional) Installing OhMyZsh for Mac terminal

Collection of terminal plugins that make using it much nicer, such as coloured output and showing your current git branch.

Install instructions are here.

(Optional) Installing VSCode for IDE

We aren't prescriptive on IDE, but VSCode is a great choice for new NodeJS devs and experienced devs. It is an ATOM based text editor with a large collection of extensions that make NodeJS development easier, including syntax completion and simple debugging.

Install it here

Recommended extensions:

  • Node.js Extension Pack
  • Debugger for Chrome
  • TSLint

Cheat Sheet for Mac

User settings (Code -> Preferences -> Settings):

{
    "editor.tabSize": 2,
    "files.trimTrailingWhitespace": true
    ...
}

FAQs

  • How do I run and test a Node application?

First install dependencies with npm install, then run the application using a command script in the package.json file under scripts section, with start and test being the default ones needed.

To run them:

npm install # installs dependencies under folder node_modules
npm start # runs whatever commands are defined under "\"scripts\":{\"start\": \"...\"}"
npm test # runs whatever commands are defined under "\"scripts\":{\"test\": \"...\"}"
npm run my-custom-script # runs a custom command under "\"scripts\":{\"my-custom-script\": \"...\"}"

You can chain commands inside scripts (e.g. "\"scripts\":{\"start\": \"npm run build && node start.js"}") and there are special commands that hook before and after others like preinstall.

  • How do I install packages? -

See Package Management

  • How do I test my code?

See Testing Strategy

  • How do I debug?

See here for how to debug a running Node app using Chrome DevTools.

See here for recipes to debug your Node app in VSCode directly by setting up .vscode\launch.json configurations. Here is a recipe to debug your Mocha tests, allowing you to debug the open test file with F5.

You can debug from TypeScript directly using the ts-node package, see here.

  • What code conventions are we using? -

See Code Quality

Useful links

Street Manager on-boarding

TODO

  1. Accounts

  2. Background

  3. Technical documentation

Clone this wiki locally