@vrdons/module-template
v0.0.4
Published
Module template
Readme
Module Template
A modern TypeScript module template with comprehensive tooling for development, building, and publishing.
Features
- 🚀 TypeScript - Full TypeScript support with modern ES2024 target
- 📦 Dual Package - Supports both CommonJS and ESM formats
- 🔧 Build System - Fast builds with tsup
- 🎯 Linting - ESLint with TypeScript, Prettier, and JSON/Markdown support
- 🪝 Git Hooks - Automated linting and commit message validation with Husky
- 📋 Conventional Commits - Enforced commit message format
- 🔄 Automated Releases - Scripts for GitHub and NPM releases
- 📝 Changelog Generation - Automatic changelog generation
- 🧪 Testing Ready - Test directory structure included
Quick Start
Installation
# Clone the template
git clone https://github.com/vrdons/module-template.git
cd module-template
# Install dependencies
npm installDevelopment
# Build the project
npm run build
# Lint code
npm run lint
# Fix linting issues
npm run lint:fixProject Structure
module-template/
├── src/ # Source code
│ └── index.ts # Main entry point
├── dist/ # Built output (generated)
├── tests/ # Test files
├── scripts/ # Build and automation scripts
│ ├── actions/ # GitHub Actions and release scripts
│ ├── husky/ # Git hook scripts
│ └── utils/ # Utility functions
├── .github/ # GitHub workflows
├── .husky/ # Husky git hooks
└── ...config filesScripts
| Script | Description |
|--------|-------------|
| npm run build | Build the project with tsup |
| npm run lint | Run ESLint on all files |
| npm run lint:fix | Fix ESLint issues automatically |
| npm run changelog | Generate changelog from commits |
| npm run release:git | Create GitHub release |
| npm run release:npm | Publish to NPM |
Configuration
TypeScript
The project uses modern TypeScript configuration with:
- Target: ES2024
- Module: NodeNext with full ESM/CJS interop
- Output: Dual package (ESM + CJS) with type declarations
Build System
tsup is configured to:
- Bundle TypeScript source code
- Generate both ESM and CJS formats
- Create type declaration files
- Clean output directory on each build
- Run post-build patches
Code Quality
- ESLint: TypeScript, Prettier, JSON, and Markdown linting
- Prettier: Code formatting with consistent style
- Husky: Pre-commit hooks for linting and commit message validation
- Commitlint: Enforces conventional commit format
Package Exports
The module supports both CommonJS and ESM imports:
// ESM
import { version } from 'module-template';
// CommonJS
const { version } = require('module-template');Development Workflow
- Make changes to source code in
src/ - Build with
npm run build - Lint with
npm run lint - Commit using conventional commit format
- Release with automated scripts
Commit Message Format
This project follows Conventional Commits:
type(scope): description
feat: add new feature
fix: resolve bug
docs: update documentation
style: formatting changes
refactor: code restructuring
test: add tests
chore: maintenance tasksRelease Process
GitHub Release
npm run release:gitNPM Release
npm run release:npmLicense
MIT License - see LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Follow the commit message format
- Submit a pull request
Author
vrdons - GitHub Profile
This template provides a solid foundation for TypeScript modules with modern tooling and best practices. Customize it according to your project's specific needs.
