TS Lib Template
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
andprettier
- Build source code with
rollup
- Tests use
jest
to make sure code quality - Automatic generate
changelog.md
andGitHub Release
, usingcommitizen
- Intercept commit that have problems, using
Husky
,lint-staged
combine withgit 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 generatesourcemap
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 toGitHub
- npm run cm: utilize
cz
to executegit commit