TS Lib Template

code style: prettierGitHub Workflow Statuslicense

A template project that make create a typescript library easily.

Usage

git clone git@github.com:wangkaiwd/typescript-library-template.git
npm install

Then run npm run dev to develop.

If you want to test your code in browser environment, you can write test code in example directory and set script src correctly

Feature

  • out of the box
  • Automatic linting and formatting use eslint and prettier
  • Build source code with rollup
  • Tests use jest to make sure code quality
  • Automatic generate changelog.md and GitHub Release, using commitizen
  • Intercept commit that have problems, using Husky ,lint-staged combine with git hook
  • Support auto publish script, you can run npm run release when publish
  • Using vitepress write document
  • GitHub Action continuous integration

Npm Scripts

recommend use ni to execute package manager command, it will auto select proper package manager, so that wo don't memory command which from different package manager.

If you wanna known about more detail about build and publish, you can read in here.

  • npm run dev:build with rollup watch mode and generate sourcemap for debug
  • npm run build:generate bundle which support commonjs,esModule,iife
  • npm run docs:dev: enable local server to write document which powered by vitepress
  • npm run docs:build: build your document
  • npm run test: run test case
  • npm run release: publish source code to npm and commit the latest changes to GitHub
  • npm run cm: utilize cz to execute git commit