@chris.troutner/npm-lib-boilerplate

A boilerplate for creating an npm library with Semantic Release, linting, and tests.

Usage no npm install needed!

<script type="module">
  import chrisTroutnerNpmLibBoilerplate from 'https://cdn.skypack.dev/@chris.troutner/npm-lib-boilerplate';
</script>

README

npm-lib-boilerplate

This repository is a code 'boilerplate' for starting a new npm library. It contains the following features:

  • Semantic Release configured to work with Travis CI.
  • Automatic linting using Standard JavaScript.
  • Unit and integration tests using Mocha and Chai, following the best practices and design patterns in this YouTube video:
    • Uses ECMAScript 2015 Class for business logic and utility libraries.
    • Follows TDD best practices.
    • Uses _this to maintain context to the instance of the class.
    • Uses Sinon stubs to mock external dependencies for unit tests.
    • Each function is wrapped in try/catch statements, allowing thrown errors to 'bubble up' to the top-level function, and give every function along the way an opportunity to handle exceptions.
    • Testing assertions focus on properties and structure, not values.

Licence

MIT