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
eslintandprettier - Build source code with
rollup - Tests use
jestto make sure code quality - Automatic generate
changelog.mdandGitHub Release, usingcommitizen - Intercept commit that have problems, using
Husky,lint-stagedcombine withgit hook - Support auto publish script, you can run
npm run releasewhen publish - Using
vitepresswrite document GitHub Actioncontinuous integration
Npm Scripts
recommend use
nito 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
rollupwatch mode and generatesourcemapfor 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
npmand commit the latest changes toGitHub - npm run cm: utilize
czto executegit commit
TypeScript Library Template