This repository should be used as a simple, pre-configured workflow to get started with TypeScript development for Node.JS.
Getting started with this setup only requires two steps.
- Clone the repository
git clone https://github.com/opdime/ts-setup - Adjust
package.json(package name, version, description, keywords, author, license, URLs) - Install the packages
npm -i
npm testStarts Jest.npm run test-watchStarts Jest in watch mode.npm buildRuns the TypeScript compiler for the project.npm run build-watchRuns the TypeScript compiler for the project in watch mode.npm startStarts Nodemon for the compiled code.
The prepublish script is defined, to run the build command before publishing,
so the most up-to-date code get published.
Code written in this setup should be contained inside the src/ folder.
As soon as you start building that code, it compiled code will be stored
in the dist/ folder.
Nodemon is configured to watch for changes inside the dist/ folder.
So, at the moment, the nodemon and compiler instance have to be run separately.
This setup offers a TypeScript configuration which is applicable for most use cases. The compilation target, by default, is ES5.
This setup also contains a tslint.json. The default configuration
is meant to be very strict and verbose. For example, the linter is
configured to forbid the annotation string[] and encourages the usage
of Array<string>. As stated before, this linter config is meant to
encourage verbose, explicit, and precise code. This should reduce
issues, caused by too compact code.