node-starter

Node.js CI Quality Gate Status

What is this?

A good start to pretty much every Node.js project!

What's in it?

  • ESLint and Prettier (using AirBnB's ruleset)
    • Ensures consistent formatting between developers!
  • Commitlint
  • Jest
    • Ensures that we can test our JavaScript.
  • VSCode debugger
    • Ensures that we spend less time writing console.logs.
    • There's one debugger that runs the tests, and another for the whole project.
  • Husky
    • Ensures that only work that is formatted correctly, and passes tests is committed.
  • A GitHub Action runs the tests and pushes to sonarcloud when opening new pull request.

How do I use this repo?

  1. node-starter is a 'repository template', and is best used as a base for a new repository. Here's how you can do that.
  2. Update 'name' property in the package.json file.
  3. If you want to use sonarcloud, create a new project.
  4. Add the repository through Github and add the details to the sonar-project.properties file.
  5. Click on 'Github Action' copy the the SONAR_TOKEN- and in the GitHub UI (https://github.com/{organisation}/{project}/settings/secrets/actions) create a new key called SONAR_TOKEN.
  6. Run nvm use
  7. Run npm i
  8. Run npm start

Run commands

  • npm run start: Starts the project
  • npm run test: Runs the tests - once
  • npm run test:watch: Continually watches and runs the tests on code changes
  • npm run lint: Formats the source code using ESLint