/nod

Node.js module generator/boilerplate with Babel, Jest, Typescript, Documentation and more

Primary LanguageTypeScriptMIT LicenseMIT

nod

NodeJS module generator/boilerplate.

Features

  • Babel - Write next generation JavaScript today.
  • Debug - JS debugging utility that works both in node.js and browsers.
  • Jest - JavaScript testing framework used by Facebook.
  • ESLint - Make sure you are writing a quality code.
  • Prettier - Enforces a consistent style by parsing your code and re-printing it.
  • Typescript - A static type checker for JavaScript by Microsoft.
  • Circle CI - Automate tests, linting and releases for every push or pull request.
  • Documentation - A documentation system so good, you'll actually write documentation.
  • Semantic Release - Fully automated version management and package publishing.

Install

git clone this repo

$ git clone https://github.com/rjchow/nod my-module
$ cd my-module
$ rm -rf .git
$ npm install # or yarn

Just make sure to edit package.json, README.md and LICENSE files accordingly with your module's info.

Commands

$ npm test # run tests with Jest
$ npm run coverage # run tests with coverage and open it on browser
$ npm run lint # lint code
$ npm run docs # generate docs
$ npm run build # generate docs and transpile code

Setting up CI with automatic semantic-release versioning

  • Obtain CircleCI API token
  • Modify package.json with:
    • package name
    • package repository

Run npx semantic-release-cli setup --ask-for-passwords

Logging

Turn on debugging by using the DEBUG environment variable for Node.js and using localStorage.debug in the browser.

E.g:

DEBUG="PLACEHOLDER_PROJECT_NAME:*" npm run dev

Commit message format

This boiler plate uses the semantic-release package to manage versioning. Once it has been set up, version numbers and Github release changelogs will be automatically managed. semantic-release uses the commit messages to determine the type of changes in the codebase. Following formalized conventions for commit messages, semantic-release automatically determines the next semantic version number, generates a changelog and publishes the release.

By default semantic-release uses Angular Commit Message Conventions. The commit message format can be changed with the preset or config options of the @semantic-release/commit-analyzer and @semantic-release/release-notes-generator plugins.

Tools such as commitizen, commitlint or semantic-git-commit-cli can be used to help contributors and enforce valid commit messages.

Here is an example of the release type that will be done based on a commit messages:

Commit message Release type
fix(pencil): stop graphite breaking when too much pressure applied Patch Release (1.0.x)
feat(pencil): add 'graphiteWidth' option Minor Feature Release (1.x.0)
perf(pencil): remove graphiteWidth option

BREAKING CHANGE: The graphiteWidth option has been removed.
The default graphite width of 10mm is always used for performance reasons.
Major Breaking Release (x.0.0)

API

Table of Contents

License

MIT © Diego Haz