Template repository for Bun-powered TypeScript npm libraries in the OpenHoo style.
It includes Bun, TypeScript, Biome, tsup, Bun test coverage, hooversion commit and release automation, npm trusted publishing, and Git hooks.
Use GitHub's Use this template button, or create a project with Bun:
bun create openhoo/npm-library-template my-library
cd my-library
bun installBefore publishing a new project from this template, replace the template identity everywhere it is used:
package.json:name,description,repository.url,bugs.url, andhomepageREADME.md: title, badges, install command, and package exampleshooversion.config.ts: packagenameandscopes.github/workflows/release.yml: package name in the "Check published package version" stepCHANGELOG.md: package heading
bun add @openhoo/npm-library-templateimport { createGreeting } from "@openhoo/npm-library-template";
console.log(createGreeting("OpenHoo"));bun install
bun run checkbun install configures the tracked Git hooks. The pre-commit hook runs Biome on staged files, and the commit-msg hook validates commit messages with hooversion before Git accepts them.
bun run check runs Biome linting and formatting checks with warnings treated as failures, type checking, Bun tests with coverage thresholds, and the package build.
Useful scripts:
bun run test
bun run test:coverage
bun run typecheck
bun run build
bun run biome:fixCommits merged to main are evaluated by hooversion after CI passes. When a release is produced, the release workflow creates the release commit, tag, and GitHub release automatically, then publishes the package through npm trusted publishing.
Configure npm trusted publishing for this repository and package on npmjs.com. The workflow uses Bun for installs, checks, and package metadata lookups; npm publishing uses the registry's trusted OIDC flow and does not require an npm token secret.
If main is protected by rulesets that require pull requests, status checks, or code scanning, add github-actions[bot] (User actor id 41898282) as an always-allowed bypass actor on those rulesets so Hooversion can push automatic release commits and tags.
Use Conventional Commit messages so hooversion can lint commits and determine releases.
MIT. See LICENSE.