Skip to content

Easily zip your codebase while excluding unnecessary files like a pro! Say goodbye to bloated archives and hello to clean, lightweight packages. πŸŽ‰

License

Notifications You must be signed in to change notification settings

star-plan/code-packager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“¦ CodePackager β€” The Ultimate Code Packaging Tool πŸš€

Easily zip your codebase while excluding unnecessary files like a pro! Say goodbye to bloated archives and hello to clean, lightweight packages. πŸŽ‰

✨ Features

  • 🎯 Multiple Presets: Choose from 4 built-in presets for different packaging needs

    • basic: Exclude common build files and caches
    • git-friendly: Keep .git directory but exclude large files
    • complete: Exclude all unnecessary files including .git
    • lightweight: Keep only core source code
  • 🧹 Smart Comment Removal: Remove comments from Python, JavaScript, Java, C/C++ files

  • πŸ—œοΈ Multiple Compression Methods: Support for deflate, lzma, and bzip2 compression

  • πŸ“Š Detailed Statistics: Get comprehensive packaging statistics

  • 🌍 Cross-Platform: Works seamlessly on Windows, macOS, and Linux

  • ⚑ Fast & Efficient: Optimized for large codebases with blazing-fast execution

πŸ€” Why Use CodePackager?

When working with large codebases, manual packaging can be a nightmare. CodePackager simplifies the process by:

  • Automatically skipping files you don't need (e.g., node_modules, *.log, __pycache__)
  • Providing flexible preset configurations for different scenarios
  • Offering advanced features like comment removal and multiple compression methods
  • Keeping your archives clean and deploy-ready
  • Saving time and reducing human errors

πŸš€ Quick Start

Installation

  1. Clone the repository

    git clone https://github.com/Deali-Axy/code-packager.git
    cd code-packager
  2. Install dependencies

    pdm install

Basic Usage

# Basic packaging with default preset
python -m src.code_packager /path/to/source output.zip

# Use a specific preset
python -m src.code_packager /path/to/source output.zip --preset git-friendly

# Remove comments and use LZMA compression
python -m src.code_packager /path/to/source output.zip --preset complete --remove-comments --compression lzma

# List all available presets
python -m src.code_packager --list-presets

πŸ“‹ Command Line Options

Usage: python -m src.code_packager [OPTIONS] SOURCE_DIR OUTPUT_ZIP

Arguments:
  SOURCE_DIR    Source code directory to package
  OUTPUT_ZIP    Output zip file path

Options:
  -p, --preset PRESET       Choose preset: basic, git-friendly, complete, lightweight (default: basic)
  -c, --config CONFIG       Use custom configuration file
  -r, --remove-comments     Remove comments from source code files
  --compression METHOD      Compression method: deflate, lzma, bzip2 (default: deflate)
  -l, --list-presets        List all available presets
  -v, --verbose             Show detailed output
  -h, --help                Show help message

πŸ“‚ Preset Configurations

Preset Description Use Case
basic Excludes common build files, caches, and IDE files General development projects
git-friendly Keeps .git directory but excludes large objects Sharing projects with version history
complete Excludes everything unnecessary including .git Final release or distribution
lightweight Keeps only essential source code Minimal code sharing

πŸ“‚ Example Directory Structure

Before packaging:

project/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.py
β”‚   └── utils/
β”‚       └── helpers.py
β”œβ”€β”€ node_modules/          # Excluded
β”œβ”€β”€ __pycache__/          # Excluded
β”œβ”€β”€ build/                # Excluded
β”œβ”€β”€ .git/                 # Depends on preset
β”œβ”€β”€ .vscode/              # Excluded
└── .gitignore

After packaging (basic preset):

code_package.zip
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.py
β”‚   └── utils/
β”‚       └── helpers.py
β”œβ”€β”€ .git/
└── .gitignore

πŸ”§ Advanced Features

Comment Removal

Supports removing comments from:

  • Python (.py)
  • JavaScript (.js, .jsx, .ts, .tsx)
  • Java (.java)
  • C/C++ (.c, .cpp, .h, .hpp)

Custom Configuration

Create your own exclusion rules by using the --config option with a custom configuration file.

Compression Methods

  • deflate: Fast compression, good compatibility (default)
  • lzma: Best compression ratio, slower
  • bzip2: Good balance between speed and compression

🀝 Contributing

Contributions are welcome! Please feel free to:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

For bug reports and feature requests, please open an issue.

πŸ“„ License

This project is licensed under the MIT License. See LICENSE for details.


Made with ❀️ by DealiAxy

About

Easily zip your codebase while excluding unnecessary files like a pro! Say goodbye to bloated archives and hello to clean, lightweight packages. πŸŽ‰

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages