ts-minifier
is an advanced TypeScript compression tool that provides flexible code minification with comprehensive configuration options.
- 🚀 Multiple Compression Levels
- 📦 Single and Multiple File Output
- 🗺️ Source Map Generation
- 🔍 Detailed Logging
- 💻 CLI and Programmatic APIs
npm install ts-minifier
# Basic usage
npx ts-minifier -i src/**/*.ts
# Specify compression level
npx ts-minifier -i src -l aggressive
# Generate source maps
npx ts-minifier -i src -m
# Use configuration file
npx ts-minifier -c compress.config.json
import {
TypeScriptCompressor,
CompressionLevel
} from 'ts-minifier';
const compressor = new TypeScriptCompressor(true);
const result = compressor.compressFiles(['src'], {
level: CompressionLevel.MINIMAL,
outputFormat: 'single',
generateSourceMaps: true
});
console.log(result.stats);
-
level
: Compression intensity (none
,minimal
,aggressive
) -
outputFormat
: Output style (single
,multiple
) -
generateSourceMaps
: Enable/disable source map generation -
excludePatterns
: Files/directories to ignore -
customNamePatterns
: Custom renaming rules
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
MIT License, see LICENSE for more details.