A minimal starter for small TypeScript libraries and packages.
This repository uses TypeScript, Vitest, ESLint flat config, Yarn 4, and GitHub Actions to provide a small CommonJS library template. The package name and repository URL intentionally remain placeholders (---name--- and ---repo---) until real package metadata is provided.
- Install
- Usage
- Project Layout
- Development
- Continuous Integration
- Publishing
- API
- Maintainers
- Contributing
- License
This project requires Node.js 22 or newer. Yarn 4.14.1 is managed through Corepack.
corepack enable
corepack prepare yarn@4.14.1 --activate
yarn installBuild the CommonJS output and load the root entrypoint:
yarn build
node -e "require('./dist')"Consumers should import only the published root entrypoint:
const library = require('---name---');
console.log(library);Deep imports from src/ or internal dist/ paths are not part of the public package contract.
src/- TypeScript source files.test/- Vitest tests.dist/- Generated CommonJS output.dist/types/- Generated declaration files.coverage/- Generated Vitest coverage reports.tsconfig.base.json- Shared TypeScript strictness and runtime settings.tsconfig.json- Development typecheck project forsrc/andtest/.tsconfig.build.json- Build-only TypeScript project for published output.eslint.config.cjs- ESLint flat config.vitest.config.ts- Vitest test and coverage configuration.
Run the full local validation suite:
yarn testUseful scripts:
yarn clean- remove generated build and coverage output.yarn lint- lint the project with ESLint.yarn typecheck- typecheck source and tests without emitting files.yarn tests- run Vitest with V8 coverage.yarn build- compile TypeScript to CommonJS indist/.yarn test-publish- run a package dry-run with the generated output.
GitHub Actions runs on pushes, pull requests, merge queues, and manual dispatches.
- Node.js CI runs on Node.js 22, 24, and 26. Each job installs with Corepack-managed Yarn 4.14.1, then runs linting, typechecking, Vitest coverage, builds, and a package dry-run.
- The Node.js 24 job also runs
yarn npm audit --recursive --all. - CodeQL analyzes JavaScript and TypeScript with the extended security and quality query packs after an install and build.
- Dependabot checks npm and GitHub Actions updates weekly and groups related update pull requests.
Before publishing, replace the package identity placeholders in package.json:
{
"name": "---name---",
"repository": {
"type": "git",
"url": "---repo---"
}
}Verify package contents:
yarn test-publishPublish:
yarn releaseThis starter does not export a library API yet. Add public exports from src/index.ts when real package behavior is introduced.
The published package surface is the root entrypoint only through exports["."].
Questions and changes can go through GitHub issues and pull requests. Keep changes focused, run yarn test before submitting, and include tests for behavior changes.
MIT (c) Everett Morgan. See LICENSE.