Skip to content

Template starter for creating npm package with typescript

License

Notifications You must be signed in to change notification settings

xituru/typescript-package-boilerplate

Repository files navigation

typescript-package-boilerplate

npm package version number Actions Status License

  • CI Publishing & Release
  • Multiple Formats (CJS, ESM & UMD)
  • Unit test with Jest
  • Code linter with TSLint
  • Commit linter with CommitLint & Husky

Installation

$ npm install

Build

# build multiple formats cjs, esm, and umd
$ npm run build

# build cjs format
$ npm run build:cjs

# build esm format
$ npm run build:esm

# build esm format
$ npm run build:umd

Test

# unit tests
$ npm run test

# test coverage
$ npm run coverage

See scripts in package.json for other predefined script commands.

Publishing & Release

This template is configured to use GitHub Actions CI/CD and semantic-release to automate Publishing to npm & Github Packages registry and Github Release.

  • Every time a pull request is submitted on master or main branch, it will automatically tested against multiple OS and Node.js versions with GitHub Actions.
  • Every time a push is submitted on master or main branch, it will automatically determine the type of release using @semantic-release/commit-analyzer also publish it to the registry, and this package is using default configuration, to modify the configuration just go there for more information.

CI Publishing

This template is using extra plugin @amanda-mitchell/semantic-release-npm-multiple for publishing to registry, to modify the configuration just go there for more information.

CI Release

This template is using extra plugin @semantic-release/github for releasing to Github Release, to modify the configuration just go there for more information.

Support

For feedbacks or issues, check out the Issues.