Skip to content

yeasin2002/unplugin-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

unplugin Starter

An advanced starter template for creating modern, universal build plugins that work seamlessly across Vite, Rollup, Webpack, esbuild, and other bundlers using unplugin. Built with TypeScript and featuring comprehensive tooling for testing, formatting, type-checking, and automated releases.

✨ Features

  • πŸ”Œ Universal Plugin Architecture - Write once, run everywhere with unplugin
  • πŸ“¦ Dual Package Exports - ESM and CommonJS support out of the box
  • 🎯 TypeScript First - Strict mode enabled with comprehensive type safety
  • βœ… Testing Ready - Vitest with 80%+ coverage requirements
  • 🎨 Code Quality - ESLint, Prettier, and automated formatting
  • πŸš€ Automated Releases - Conventional commits with release-it
  • πŸ” Type Checking - Continuous type validation with watch mode
  • πŸ“Š Bundle Size Tracking - Monitor your package size with size-limit
  • πŸͺ Git Hooks - Pre-commit checks with Husky and Lefthook

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • pnpm (recommended) or npm/yarn

Installation

# Clone this template
git clone https://github.com/yeasin2002/npm-starter.git my-plugin
cd my-plugin

# Install dependencies
pnpm install

# Start development
pnpm dev

πŸ“– Usage

πŸ› οΈ Development

Available Scripts

Development

pnpm dev              # Run tests in watch mode
pnpm typecheck        # Type check without emitting
pnpm typecheck:watch  # Type check in watch mode

Building

pnpm build            # Build for production (ESM + CJS)
pnpm clean            # Clean build artifacts and cache

Testing

pnpm test             # Run tests once
pnpm test:coverage    # Run tests with coverage report
pnpm test:watch       # Run tests in watch mode

Code Quality

pnpm lint             # Lint source code
pnpm lint:fix         # Lint and auto-fix issues
pnpm format:check     # Check code formatting
pnpm format:write     # Format code with Prettier

Pre-publish Checks

pnpm ci               # Run full CI pipeline
pnpm check-exports    # Verify package exports
pnpm size             # Check bundle size
pnpm size:why         # Analyze bundle size
pnpm audit            # Security audit

Release

pnpm release          # Create a new release with conventional changelog

πŸ“ Project Structure

src/
β”œβ”€β”€ core/              # Core functionality
β”‚   └── options.ts     # Plugin options and resolution
β”œβ”€β”€ index.ts           # Main plugin export (default)
β”œβ”€β”€ api.ts             # Public API functions
β”œβ”€β”€ vite.ts            # Vite-specific plugin
β”œβ”€β”€ webpack.ts         # Webpack-specific plugin
β”œβ”€β”€ rollup.ts          # Rollup-specific plugin
└── rspack.ts          # Rspack-specific plugin

test/
└── *.test.ts          # Vitest test files

dist/                  # Build output (auto-generated)
β”œβ”€β”€ index.js           # ESM build
β”œβ”€β”€ index.cjs          # CommonJS build
└── index.d.ts         # TypeScript declarations

πŸ”§ Configuration

TypeScript

Strict mode enabled with additional checks:

Testing

  • Framework: Vitest
  • Coverage: 80% minimum (lines, functions, branches, statements)
  • Provider: v8

Code Style

  • ESLint with TypeScript ESLint recommended rules
  • Prettier (single quotes, no semicolons, 100 char width)
  • EditorConfig for consistent formatting

Git Hooks

  • Pre-commit: Lint staged files
  • Commit message: Conventional commits validation

πŸ“¦ Publishing

Before Publishing

  1. Update package.json with your package details:

    • name
    • description
    • author
    • repository
    • homepage
    • keywords
  2. Run pre-publish checks:

pnpm run ci
  1. Create a release:
pnpm release

🀝 Contributing

Contributions are welcome! Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.

πŸ“„ License

MIT Β© Md Kawsar Islam Yeasin

πŸ”— Links

πŸ’‘ Tips

  • Keep your plugin focused on a single responsibility
  • Always resolve options with defaults before using them
  • Write tests for all public APIs
  • Use TypeScript strict mode for better type safety
  • Follow conventional commits for automated changelog generation
  • Monitor bundle size to keep your plugin lightweight

Made with ❀️ by Yeasin

About

Starter Template for creating unplugin Packages to create cross platform build tools plugins like vite,rollup, farm, webpack etc.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors