A minimal starter for small TypeScript libraries and packages.
This repository provides a lightweight TypeScript project with source files in src/, tests in tests/, and compiled output in dist/. It uses Mocha + Chai for testing, NYC for coverage, and ESLint (flat config, Airbnb base + @typescript-eslint).
- Node.js (18+ recommended)
- Yarn 4 (managed by Corepack)
To ensure the correct Yarn version:
corepack enable
corepack prepare yarn@4.9.3 --activateInstall dependencies:
- Using Yarn:
yarn install
Run tests (lints first, then runs Mocha with coverage):
- Using Yarn:
yarn test
Lint the code:
- Using Yarn:
yarn lint
View coverage (after running tests):
- Open
coverage/index.htmlin your browser.
- lint: Lints the TypeScript sources with ESLint.
yarn lint
- tests: Runs the test suite with Mocha via
ts-node, instrumented by NYC (generatescoverage/).yarn tests
- test: Runs
lintthentests.yarn test - test-publish: Dry-run the publish step to verify package contents.
yarn test-publish
- publish: Publishes the package (uses
npm publishunder the hood).yarn publish
src/— TypeScript source filestests/— Mocha + Chai tests (viats-node)dist/— Compiled output (generated bytsc)dist/types/— Type declaration files (fromdeclaration: true)
coverage/— Test coverage reports (generated by NYC)tsconfig.json— TypeScript configuration (ESNext target, CommonJS module)eslint.config.cjs— ESLint flat config (Airbnb base +@typescript-eslint)package.json— Project metadata & scripts
Before publishing, update placeholders in package.json:
{
"name": "---name---",
"description": "---description---",
"repository": "---repo---"
}- Dry-run:
yarn test-publish
- Publish:
yarn publish
Feel free to open issues or PRs. Keep edits small and include tests where applicable.
See the LICENSE file for license details.