This post and accompanying repository have been archived. However, there is a new repository (starter template) which includes Typescript, Babel, Jest and Rollup configuration.
Github template repository for quickly starting new node modules with typescript.
Are you tired of setting up TypeScript and other dependencies before even writing a single line of code? I am, so I have decided to create a small template repository with some of the tools that I use for everyday development.
You can go check out the repository on github or continue reading to learn about included tasks, continuous integration, git hooks etc.
- Typescript is set to
strictconfiguration with source map generation.
- ESLint is set up to use standardJS configuration for typescript, with a few overrides which I think make good common sense. You can see the overrides inside the .eslintrc.js file.
- Unit testing is done via Jest in combination with ts-jest
- Prettier configuration with a few custom rules.
- Code coverage.
prepublishOnly: run before publishing the module to npm.
build: build typescript.
build:watch: build and watch typescript for changes.
test: run all tests and generate code coverage.
test:watch: run and watch tests for changes (with typeahead feature)
ci:testtask that is executed by the continuous integration provider (CircleCI) runs tests and uploads code coverage.
format: format all files with prettier (
fix:src: run ESLint on
fix:tests: run ESLint on
fix:teststask in parallel.
docs: generate typescript documentation via typedoc
CircleCI is used for continuous integration.
Tests are run for node versions 8, 10 and 12.
If you are using VS Code as your editor,
there is one debug configuration which is set up to debug currently focused test file inside the editor.
Typescript documentation is generated via typedoc.
Currently, it is set up to go into
docs/api directory and it is generated in markdown so it can be displayed on Github.
- Private members are excluded.
- Only exported properties are documented.
This repository template has provided me a quick way to start working on a node module with typescript. Feel free to fork the repository and create your version of the template. For example, you can replace StandardJS with Airbnb style guide.
I hope you find it useful.