Skip to content

boostpack/typescript-library-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

@boostpack/typescript-library-starter

CI npm version codecov License: MIT

A starter template for TypeScript libraries with all modern tooling included.

Start coding in seconds with zero configuration! πŸš€

Inspired by alexjoverm/typescript-library-starter

✨ Features

  • πŸ“¦ Rollup for optimized bundles (ESM + CommonJS)
  • πŸš€ TypeScript 5.7 with strict mode
  • πŸ”₯ Node.js 22 LTS support
  • πŸ§ͺ Jest for fast unit testing
  • πŸ“– TypeDoc for API documentation with versioning
  • πŸ” ESLint + Prettier + SonarJS for code quality
  • πŸ€– GitHub Actions for CI/CD
  • 🏷️ Semantic Release for automated versioning
  • πŸ“Š Codecov for coverage reports
  • 🎯 Commitlint with conventional commits

πŸš€ Quick Start

Use this template

  1. Click the "Use this template" button on GitHub
  2. Clone your new repository
  3. Install dependencies:
npm ci
  1. Start developing:

πŸ“– Documentation

πŸ“š Project Setup

Step 1: GitHub Repository Setup

  1. Create a new repository from this template
  2. Enable Renovate (choose one option):
    • Option A (Recommended): Install Renovate GitHub App for your repository
    • Option B: Use self-hosted Renovate workflow (requires RENOVATE_TOKEN secret)
  3. Enable GitHub Pages (Settings β†’ Pages β†’ Source: GitHub Actions)
  4. Add repository secrets (Settings β†’ Secrets and variables β†’ Actions):
    • NPM_TOKEN - Your npm automation token (create one here)
    • CODECOV_TOKEN - Your Codecov token (get it here)
    • RENOVATE_TOKEN - GitHub PAT for self-hosted Renovate (only if using Option B)

Step 2: Update Package Info

Edit package.json:

{
  "name": "@your-scope/your-library",
  "description": "Your library description",
  "repository": "your-username/your-repo",
  "author": "Your Name"
}

Step 3: Start Developing

# Install dependencies
npm install

# Run tests in watch mode
npm run test:watch

# Build the library
npm run build

# Run linter
npm run lint

# Generate docs
npm run docs

πŸ“ NPM Scripts

Script Description
npm run build Build library (ESM + CommonJS)
npm run prebuild Clean dist directory before build
npm test Run tests
npm run test:watch Run tests in watch mode
npm run lint Lint and fix code
npm run format Format code with Prettier
npm run prepare Install Husky hooks
npm run publish Publish with Semantic Release
npm run docs Generate API docs (not implemented)
npm run docs:serve Serve documentation (not implemented)
npm run docs:clean Clean generated docs (not implemented)

Note: API documentation generation is not yet implemented.

πŸ”§ Configuration

TypeScript

Strict mode is enabled by default. Edit tsconfig.json to customize compiler options.

Jest

Tests are located in test/ directory. Edit jest.config.js for custom configuration.

ESLint

This project uses a strict ESLint configuration with:

  • TypeScript rules
  • SonarJS for code quality
  • Prettier for formatting

Edit eslint.config.js to customize rules.

Commitlint

Follow conventional commits:

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation
  • test: Tests
  • refactor: Code refactoring

Support for task codes: feat: [TASK-123] add feature

🚒 Publishing

Automated Releases

This template uses Semantic Release for automated versioning and publishing.

Release trigger: Pushes to protected branches only.

Supported release branches:

  1. main/master β†’ Production release
  2. next β†’ Pre-release (@next tag)
  3. next-major β†’ Major pre-release (@next-major tag)
  4. alpha/beta β†’ Testing releases (@alpha/@beta tags)
  5. Maintenance branches (1.x, 2.15.x) β†’ Patch releases for specific versions

Setup: Mark your release branches as protected in GitHub repository settings (Settings β†’ Branches β†’ Add rule).

Releases are automated when you push to protected branches:

  • Version bumps based on commit messages
  • Changelog generation
  • npm publishing
  • GitHub releases

Manual Publishing

# Build the library
npm run build

# Publish to npm
npm publish

🀝 Contributing

Development Workflow

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests: npm test
  5. Commit using conventional commits
  6. Push and create a Pull Request

Commit Messages

We use conventional commits with support for task codes:

# Features
git commit -m "feat: add new feature"
git commit -m "feat(scope): [TASK-123] add feature with scope"

# Fixes
git commit -m "fix: resolve issue"
git commit -m "fix: [BUG-456] fix critical bug"

# Breaking changes
git commit -m "feat!: breaking change"

πŸ“‹ GitHub Actions

The CI/CD pipeline runs on every push and PR:

  • βœ… Linting (ESLint + Prettier)
  • βœ… Type checking (TypeScript)
  • βœ… Testing (Jest)
  • βœ… Coverage (Codecov)
  • βœ… Build validation
  • βœ… Bundle size check

πŸ—οΈ Project Structure

.
β”œβ”€β”€ src/                  # Source files
β”‚   └── index.ts         # Library entry point
β”œβ”€β”€ test/                # Test files
β”‚   └── *.test.ts       # Test suites
β”œβ”€β”€ dist/                # Built files (generated)
β”‚   β”œβ”€β”€ esm/            # ES modules
β”‚   β”œβ”€β”€ cjs/            # CommonJS
β”‚   └── index.d.ts      # TypeScript declarations
β”œβ”€β”€ docs/                # Documentation
β”‚   β”œβ”€β”€ guides/         # User guides (Markdown)
β”‚   └── contributing.md # Contributing guidelines
β”œβ”€β”€ .github/
β”‚   └── workflows/      # GitHub Actions
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json        # TypeScript config
β”œβ”€β”€ jest.config.js       # Jest config
β”œβ”€β”€ rollup.config.js     # Rollup config
β”œβ”€β”€ eslint.config.js     # ESLint config
└── renovate.json        # Renovate config

πŸ“„ License

MIT Β© Timur Popov


Made with ❀️ using TypeScript

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •