Skip to content

Stater kit for modern TypeScript library. Generate JS ready to be published on npm.

License

Notifications You must be signed in to change notification settings

fox1t/typescript-lib-starter

Repository files navigation

TypeScript Lib Starter TypeScript Lib Starter

GitHub CI TypeScript 4.0 prettier ESLlint node-tap

Starter kit for modern TypeScript libraries. Generates JavaScript ready to be published on npm.

Batteries included. Period.

Clone the repo

$ git clone git@github.com: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 git@github.com:{your_repository}.git

$ git add .

$ git commit -m "Initial commit"

$ git push -u origin master

Scripts

  • npm run build: build TypeScript sources to dist directory
  • npm publish: builds and publishes lib to npmjs.com
  • npm test: run tests in ./test directory using tap
  • npm run test:watch: watches ./src/ and ./test/ folders and restarts compilation and tests
  • npm run test:report: saves test report to out.tap file
  • npm run test:reporter: converts out.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 precommit lint hook
  • rimraf: removes lib folder crossplatform
  • chokidar-cli: file watcher
  • tap: test runner
  • tap-mocha-reporter: mocha reporter for tap
  • ts-node: runs tests without compiling
  • prettier
  • eslint
  • eslint-config-prettier: makes ESLint work nice with prettier
  • typescript

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)

built with typescript-lib-starter

Node.js libraries built with TypeScript Lib Starter

License

MIT

About

Stater kit for modern TypeScript library. Generate JS ready to be published on npm.

Resources

License

Stars

Watchers

Forks

Packages

No packages published