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.jsonfile and specify project attributes. All of the following should be customized:nameversiondescriptionrepositoryauthorlicensebugshomepage
-
Edit the
.github/CODEOWNERSfile 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 installoryarn install -
Run a dev build of
src/index.tscode 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