A basic boilerplate for node projects
- Typescript
- Rollup
- Jest
- ESlint
- Prettier
- Continuous Integration (CI) is done via GitHub Actions
- Testing supports Typescript
- ESLint is configured to work with Typescript, Prettier, and Jest
- Husky is added for git-hooks. The pre-commit hook checks similar things as the CI
-
Edit the
package.json
file and specify project attributes. All of the following should be customized:name
version
description
repository
author
license
bugs
homepage
-
Edit the
.github/CODEOWNERS
file and add your github user name -
Edit the Continuous Integration badge in the
README.md
. See the github docs on action badges -
Edit (or delete) the Dependabot badge in the
README.md
. Use<username>/<reponame>
syntax -
Install the dependencies
npm install
oryarn install
-
Run a dev build of
src/index.ts
code withnpm run dev
-
Build the code
npm run build
This template supports building a distributable, a binary, and static js files from typescript files.
Building is done with rollup
.
Binaries are built from the code that lives in src/bin.ts
. If you don't want binaries you can delete the src/bin.ts
file and the entry in rollup.config.js
Note: you might want to change the line in package.json
"node-typescript-boilerplate": "./dist/bin.js"
to:
"[NAME OF SCRIPT]": "./dist/bin.js"
The distributable is built from src/index.ts
. If you don't want a distributable you can delete the src/index.ts
file and the entry in rollup.config.js
If you are trying to publish a package for use by another codebase, you'll want to use this.
Sometimes you want to just transpile TS to JS. Files in src/static
here will appear in dist/static
. If you don't want static file transpilation that aren't binaries or distributables you can delete the files in src/static/
file and the entry in rollup.config.js