Typescript Library Starter โ
Quickly scaffold modern TypeScript library in 10 seconds. Powered by Bunup - the fastest TypeScript bundler available โก๏ธ.
Features โ
- ๐ Zero Config: Get started in seconds with sensible defaults
- ๐ฆ Modern Setup: ESM and CJS output formats, TypeScript declarations
- ๐งฉ Monorepo Support: Create workspace-based projects with ease
- ๐ง Complete Tooling: Testing, linting, formatting, and CI workflows included
- ๐ฆ Git Hooks: Enforced code quality with Husky pre-commit hooks
- ๐ Conventional Commits: Standardized commit messages with commitlint
- ๐ข Release Automation: GitHub Actions for testing and publishing
- ๐งน Modern Tooling: Biome for linting and formatting
Getting Started โ
Installation โ
You can create a new project without installing the package by using:
bunx create-bunup@latest
npx create-bunup@latest
pnpx create-bunup@latest
Once you run the command, you'll be guided through an interactive process:
$ bunx create-bunup@latest
โน TypeScript Library Starter
? Where would you like to create your project? โบ my-ts-lib
? GitHub username and repo name (username/repo): โบ username/my-ts-lib
? Package description: โบ A TypeScript library
? Select a package manager:
โฏ bun - Fast all-in-one JavaScript runtime
pnpm - Fast, disk space efficient package manager
? Set up as a monorepo? โบ (y/N)
# If you chose "yes" to monorepo:
? Name for first package: โบ my-package
Step-by-Step Setup โ
Change into the created project directory:
shcd my-ts-lib
Install dependencies:
shbun install # or pnpm install
Enable Git hooks:
shbun run prepare # or pnpm prepare
Create a GitHub repository:
- Go to GitHub
- Create a new repository with the same name as your project
Initialize Git repository:
The CLI automatically initializes a Git repository for you and adds the remote if you provided a GitHub repository. You only need to make your first commit:
shgit add . git commit -m "chore: initial commit"
Setup for Releases:
Generate an npm token:
- Go to npmjs.com and sign in
- Navigate to your profile โ Access Tokens โ Generate New Token (Classic)
- Give it a descriptive name (e.g., "Bunup Publishing")
- Select "Automation" as the token type
- Click "Generate Token" and copy it immediately
Add npm token to GitHub repository:
- Go to your GitHub repository
- Navigate to Settings โ Secrets and variables โ Actions
- Click "New repository secret"
- Name:
NPM_TOKEN
- Value: Paste your npm token
- Click "Add secret"
Development Workflow โ
After completing the setup, here's how to use your project:
Common Commands โ
bun run dev
# or
pnpm dev
bun run test
# or
pnpm test
bun run lint
# or
pnpm lint
bun run format:fix
# or
pnpm format:fix
bun run tsc
# or
pnpm tsc
bun run build
# or
pnpm build
Committing Code โ
The project uses Conventional Commits for standardized commit messages:
# Example commit messages:
git commit -m "feat: add user authentication"
git commit -m "fix: resolve issue with data loading"
git commit -m "docs: update API documentation"
git commit -m "chore: update dependencies"
Pre-commit hooks will run automatically to check your code quality before each commit. The hooks run type checking, linting, and formatting validation.
CI/CD Workflows โ
The project comes with three GitHub Actions workflows:
- CI: Runs on pull requests and pushes to main, validating types, linting, and tests
- Release: Triggered by tags, builds and publishes the package to npm with provenance
- Issue Management: Automatically marks issues as stale after 30 days of inactivity
๐ Releasing Your Package โ
When you're ready to release your package, simply run:
bun run release
# or
pnpm release
This will:
- Prompt you for a new version (patch, minor, or major)
- Update package.json version
- Create a Git tag
- Push changes and tag to GitHub
The GitHub Actions workflow will automatically:
- Build the package
- Generate a GitHub release with changelog
- Publish to npm with provenance
Happy coding!