Skip to content

Loa212/my-package-template

Repository files navigation

my-package-template

A modern TypeScript package template using Bun for builds/testing and Biome for linting/formatting.

Features

  • TypeScript with strict type checking
  • Bun for fast builds and testing
  • Biome for linting and formatting
  • Dual ESM/CJS output
  • Type declarations included
  • Ready for npm publishing

Getting Started

Prerequisites

Installation

bun install

Development

# Run the package
bun run dev

# Build the package
bun run build

# Run tests
bun test

# Run tests in watch mode
bun test --watch

# Lint
bun run lint

# Format
bun run format

# Check (lint + format)
bun run check

# Fix all issues
bun run check:fix

# Type check
bun run type-check

Usage

import { greet } from "my-package-template";

// Simple usage
greet("Hello, world!");

// With options
greet({
  message: "Hello!",
  times: 3,
  logger: console.log,
});

Project Structure

src/
├── index.ts      # Main entry point, exports all modules
├── greet.ts      # Example module
├── greet.test.ts # Tests
└── types.ts      # Type definitions

Building

The build script generates:

  • dist/index.js - ESM module
  • dist/index.cjs - CommonJS module
  • dist/index.d.ts - TypeScript declarations
bun run build

Testing

Tests use Bun's built-in test runner:

bun test

Publishing

  1. Update version in package.json
  2. Run the CI check: bun run ci
  3. Publish: npm publish

Preview what will be published:

bun run npm-dry-run

Configuration

Biome

See biome.json for linting and formatting rules.

TypeScript

See tsconfig.json for TypeScript configuration.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors