badges-ts is a TypeScript/Node.js CLI for generating SVG project badges (npm version, coverage, and typedoc) with configurable colors, file paths, and templates.
npm install @jonloucks/badges-ts
For one-off usage, you can also run with npx.
npx badges-ts discover
npx badges-ts generate --verbose
By default this creates:
npm-badge.svgcoverage-summary.svgtypedoc-badge.svgnpx badges-ts apply-version
This updates src/version.ts and creates release notes for the current package version if a release notes file does not already exist.
badges-ts discover — Reads project metadata from package.json.badges-ts generate — Generates npm, coverage, and typedoc badges.badges-ts apply-version — Writes src/version.ts and creates release-notes file from template.badges-ts badges-ts coverage-report — Generates code coverage report.badges-ts badges-ts coverage-gate — Validates code coverage gates.badges-ts version — Prints CLI version.badges-ts help — Prints usage.--dry-run, -d — Preview writes without writing files.--quiet, -q — Suppress standard output.--trace, -t — Enable trace logs.--warn, -w — Enable warning logs.--verbose — Enable verbose output.badges-ts supports both environment variables and a project config file (badges-ts.json).
See Configuration Profiles for ready-to-use examples (default, monorepo, and CI-only).
Example:
{
"kit.badges.folder": "badges",
"kit.coverage.summary.path": "coverage/coverage-summary.json",
"kit.coverage.summary.badge.path": "main-coverage.svg",
"kit.npm.badge.path": "main-npm.svg",
"kit.typedoc.badge.path": "main-typedoc.svg",
"kit.template.badge.path": "src/data/badge-template.svg.dat",
"kit.above.90.percent.color": "#377526",
"kit.0.percent.color": "#ff0000"
}
The default badge SVG template is custom/original and stored at src/data/badge-template.svg.dat.
You can override it with KIT_TEMPLATE_BADGE_PATH:
KIT_TEMPLATE_BADGE_PATH=./my-template.svg npx badges-ts generate
npm install
npm run build
npm run test
npm run lint
npm run docs
npm run badges
MIT