TypeScript Lib Starter
Starter kit for modern TypeScript libraries. Generates JavaScript ready to be published on npm.
Batteries included. Period.
- Prettier and ESLlint for formatting and linting
- ts-node for tests execution
- node-tap for testing and code coverage
- tap-mocha-reporter for test reporting
- GitHub Actions configuration file for github actions workflow
Clone the repo
$ git clone [email protected]:fox1t/typescript-lib-starter.git {your_project_name}
$ cd {your_project_name}
Remove reference to this starter and re-init package.json
$ rm -rf .git && git init && npm init
Install development dependencies
$ npm i
Add remote origin and make initial commit
$ git remote add origin [email protected]:{your_repository}.git
$ git add .
$ git commit -m "Initial commit"
$ git push -u origin master
Scripts
npm run build
: build TypeScript sources to dist directorynpm publish
: builds and publishes lib to npmjs.comnpm test
: run tests in./test
directory using tapnpm run test:watch
: watches./src/
and./test/
folders and restarts compilation and testsnpm run test:report
: saves test report toout.tap
filenpm run test:reporter
: convertsout.tap
file to junit
External typings augmentation
This starter is already configured to allow you to extend typings of external packages. The logic behind it is based on this official template. To augment a module, just create a folder with the same name as the module you are augmenting and add an index.d.ts in it. Here you can find a real world example.
Automatic Test and Code Coverage
Includes azure-pipelines.yml
configuration file. You can build, test and publish code coverage on Azure DevOps for free with GitHub integration for OSS projects.
Dev Dependencies
husky
: runs precommitlint
hookrimraf
: removeslib
folder crossplatformchokidar-cli
: file watchertap
: test runnertap-mocha-reporter
: mocha reporter for tapts-node
: runs tests without compilingprettier
eslint
eslint-config-prettier
: makes ESLint work nice with prettiertypescript
Spread the word
If you use this starter, add this badge to your project to help standardising TS library development.
[![built with typescript-lib-starter](https://img.shields.io/badge/built%20with-typescript--lib--starter%20-blue.svg)](https://github.com/fox1t/typescript-lib-starter)
Node.js libraries built with TypeScript Lib Starter
License
MIT