A NodeJS + TypeScript starter template for creating npm packages.
This template includes the following configuration/setup:
-
ESLint as linter, Prettier as formatter, and Jest as the test runner and code coverage report generator.
-
A simple configuration (
.travis.yml
) to setup continuous integration (CI) with Travis CI which sends code coverage reports to codecov. -
Devcontainer is preconfigured to be used with Visual Studio Code.
Note: Access to the repository must be granted by the user to Travis CI and codecov to run automated builds and analyze code coverage reports.
This project uses yarn as the package manager.
Simply click on the "Use this template" button on Github or click here to generate your project from this template.
-
yarn start
- Starts the./src/index.ts
script by compiling it on the fly to JS usingts-node
. -
yarn start:w
- Starts the above script in "watch" mode usingnodemon
. Any file changes you make will restart the above script. -
yarn clean
: Removes build and coverage directories. -
yarn lint
: Run ESLint on all typescript files and report errors to the console. -
yarn build
: Compile TypeScript files todist
directory. -
yarn report
: Collect coverage metrics fromjest
and report it tocodecov
. (Uploading to codecov will fail if it doesn't have access to your Github repository)
With VSCode, it is possible to create a full-featured development environment inside a Docker Container and allows teams to share the same development environment (settings, extensions, launch.json, etc.,) regardless of the host operating system. The editor settings are configured in .devcontainer/devcontainer.json
and container information in docker-compose.yml
.
Please make sure the following software is installed on your machine.
- Docker Desktop
- VSCode
- VSCode Remote - Containers extension (or VSCode Remote Development extension pack)
- After cloning this repo, open the project in VSCode.
- Click on the prompt on the bottom-right which says to reopen the folder in a container.
- It should pull and instantiate development containers for this project with preconfigured VSCode settings and extensions.
- If everything went well, you should see the project open in the VSCode editor with the bottom-left showing
Dev Container: node-ts-starter-template
, which indicates the editor is successfully connected to the docker container.