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
ESLint
rules. TypeDoc
documentation generator.- Auto update of the
README.md
table of content. - Auto update of library dependencies.
Husky
in place ofsimple-git-hooks
as 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.ts
test/index.test.ts
Happy coding 🙂 !
_description_
npm install your-package-name
Replace
your-package-name
,thomaschampagne
,starter-ts
,thomaschampagne/starter-ts
and_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@latest
Note: If you never installed pnpm
before, you may need to reload your shell to access pnpm
CLI.
- Then install the lib dependencies
pnpm install
pnpm run build
pnpm run test
pnpm run lint
Fix errors with:
pnpm run lint:fix
pnpm run docs
Documentation is generated using TypeDoc.
pnpm run upgrade:libs
Run common tasks all-in-once:
- Update to latest dependencies and install them
- TypeScript check
- Lint fixes
- Tests
- Build
- Update
README.md
table of content - Generate documentation
pnpm run integrate
pnpm run readme:toc
MIT License © 2023-PRESENT Thomas Champagne