A complete Node.js project template using TypeScript and following general best practices. It allows you to skip the tedious details for the following:
Once you’ve enabled CI, test coverage, and dependency reports for your project, this README.md file shows how to add the badges shown above. This project template even enables automated changelog generation as long as you follow Conventional Commits, which is made simple through the included Commitizen CLI.
Clone this repo into the directory you want to use for your new project, delete the Git history, and then reinit as a fresh Git repo:
$ git clone https://github.com/chriswells0/node-typescript-template.git <your project directory>
$ cd <your project directory>
$ rm -rf ./.git/
$ git init
$ npm install
It’s a common practice to prefix the source code project name with node-
to make it clear on GitHub that it’s a Node.js project while omitting that prefix in the NPM project since it’s understood on npmjs.com. Thus, the order of these replacements matter.
Be sure to check both GitHub and NPMJS to be sure your project name isn’t taken before starting!
Use exact searches to perform the following replacements throughout this project for the most efficient rebranding process:
Chris Wells
https://chriswells.io
chriswells0/node-typescript-template
typescript-template
description
to suit your project.keywords
list.author
section, add email
if you want to include yours.Before committing to a project based on this template, it’s recommended that you read about Conventional Commits and install Commitizen CLI globally.
Some additional steps need to be performed for a new project. Specifically, you’ll need to:
$ git add .
$ git cz
$ git remote add origin git@github.com:<your GitHub username>/<your project name>
$ git push -u origin master
npm publish
These steps need to be performed whenever you make changes:
src
directory.npm run build
test
directory. If your code is not awesome, you may have to fix some things here.npm run cover:check
git add
and git cz
git push
and wait for the CI builds to complete. Again, success depends upon the awesomeness of your code.Follow these steps to update your NPM package:
npm run changelog:unreleased
npm version [major | minor | patch] -m "chore(release): Bump version to %s."
npm version 1.0.0 -m "chore(release): Bump version to %s."
npm publish
This section is here as a reminder for you to explain to your users how to contribute to the projects you create from this template.
Author: chriswells0
GitHub: https://github.com/chriswells0/node-typescript-template
#nodejs #javascript #typescript