Looking to create a TypeScript library? You can use this repository as a starter kit which comes with all the necessary setup. It based on antfu/starter-ts with few improvements:
- Enforced
ESLintrules. TypeDocdocumentation generator.- Auto update of the
README.mdtable of content. - Auto update of library dependencies.
Huskyin place ofsimple-git-hooksas pre-commit linting validator
For demonstration purposes, I included a password generator called Sesame in this starter library.
To get started, simply replace the content in these 2 files with your own code:
src/index.tstest/index.test.ts
Happy coding 🙂 !
_description_
npm install your-package-nameReplace
your-package-name,thomaschampagne,starter-ts,thomaschampagne/starter-tsand_description_globally to use this template.
This below usage is for demonstration purposes.
const passwordLength = 24;
const password = Sesame.create(passwordLength);Replace this usage with yours.
- Install the latest version of pnpm globally
npm uninstall -g pnpm
npm install -g pnpm@latestNote: If you never installed pnpm before, you may need to reload your shell to access pnpm CLI.
- Then install the lib dependencies
pnpm installpnpm run buildpnpm run testpnpm run lintFix errors with:
pnpm run lint:fixpnpm run docsDocumentation is generated using TypeDoc.
pnpm run upgrade:libsRun common tasks all-in-once:
- Update to latest dependencies and install them
- TypeScript check
- Lint fixes
- Tests
- Build
- Update
README.mdtable of content - Generate documentation
pnpm run integratepnpm run readme:tocMIT License © 2023-PRESENT Thomas Champagne