/ts-lib-starter

Boilerplate to kick off a TypeScript library project.

Primary LanguageTypeScriptMIT LicenseMIT

TypeScript Library Starter

An opinionated boilerplate to kick off a TypeScript library project.

ci license

Highlights

Install

With npm:

npm install <package>

With yarn:

yarn add <package>

Usage

import { hello } from '<package>'

hello('world')

Development

Library development instructions.

Conventional Commits

When commiting code changes the Conventional Commits specification should be followed. This ensures, for example, that the CHANGELOG can be automatically generated.

Commit Types:

  • build:
  • chore:
  • ci:
  • docs:
  • style:
  • refactor:
  • perf:
  • test:

Scripts

The available yarn/npm scripts.

start

Builds the library in watch mode, which will trigger a re-build on changes.

build

Builds the library for production.

test

Launches the test runner.

test:watch

Launches the test runner in the interactive watch mode.

test:coverage

Launches the test runner and generates a coverage report.

format

Runs Prettier on the source code and fixes formatting.

format:check

Runs Prettier on the source code but only checks formatting.

lint

Lints the source code.

ts:check

Runs TypeScript type checking on the source code, but does not emit types.

docs

Generates API documentation.

Publishing

Release management is handled via standard-version, which should be installed globally:

yarn global add standard-version

To create a new release run:

yarn release

This will:

  • Increment the version in package.json
  • Generate the CHANGELOG
  • Create a new git release tag
  • Commit the changes to the local repo

Next sync your changes with the remote repository.

Then tag the release:

yarn release:tag

You can also run the release command with the --dry-run flag to get the simulated output without committing to gut or updating files.

Contributors

License

MIT