Skip to content

Scripts Reference

All available npm scripts and their purposes.

Build Scripts

ScriptCommandDescription
buildtsdownBuild ESM/CJS bundles to dist/
devtsdown --watchBuild in watch mode

Build Output

After running bun run build:

dist/
├── index.mjs       # ESM bundle
├── index.cjs       # CommonJS bundle
├── index.d.mts     # ESM type declarations
└── index.d.cts     # CJS type declarations

Test Scripts

ScriptCommandDescription
testvitest runRun tests once
test:watchvitestRun tests in watch mode
test:coveragevitest run --coverageRun tests with coverage

Coverage Output

After bun run test:coverage:

coverage/
├── html/           # Interactive HTML report
├── coverage-final.json  # JSON data for CI
└── text output     # Terminal summary

Lint Scripts

ScriptCommandDescription
lintbiome check . && eslintCheck code quality
lint:fixbiome check --write . && eslint --fixFix auto-fixable issues
lint:docseslintCheck JSDoc only
formatbiome format --write .Format code
typechecktsc --noEmitCheck TypeScript types

Quality Scripts

ScriptCommandDescription
knipknipFind unused code/deps

Knip Output

Shows unused:

  • Exports
  • Dependencies
  • Files
  • Types

Release Scripts

ScriptCommandDescription
changesetchangesetCreate a changeset
releasechangeset publishPublish to npm (CI only)

Documentation Scripts

ScriptCommandDescription
docs:devvitepress dev docsStart docs dev server
docs:buildvitepress build docsBuild docs for production
docs:previewvitepress preview docsPreview built docs

Setup Scripts

ScriptCommandDescription
preparelefthook installInstall git hooks

Runs automatically after bun install.

Common Workflows

Development

bash
# Start development
bun run dev          # Watch mode build
bun run test:watch   # Watch mode tests

Before Committing

bash
# Manual checks (also run automatically by Lefthook)
bun run lint
bun run typecheck
bun run test

Before Releasing

bash
# Full validation
bun run build
bun run lint
bun run typecheck
bun run test:coverage
bun run knip

# Create changeset
bun run changeset

Documentation

bash
# Local development
bun run docs:dev

# Build and preview
bun run docs:build
bun run docs:preview

Exit Codes

All scripts return:

  • 0 - Success
  • 1 - Failure (errors found)

Failed scripts block git commits (via Lefthook) and CI builds.

Released under the MIT License.