| Crates.io | cg-bundler |
| lib.rs | cg-bundler |
| version | 1.1.10 |
| created_at | 2025-07-21 09:08:27.988313+00 |
| updated_at | 2025-07-24 11:34:15.511826+00 |
| description | A powerful Rust code bundler that combines multiple source files into a single, optimized file for competitive programming and code distribution. Features smart module expansion, code optimization, and minification. |
| homepage | https://github.com/MathieuSoysal/cg-bundler |
| repository | https://github.com/MathieuSoysal/cg-bundler |
| max_upload_size | |
| id | 1761871 |
| size | 115,563 |
A powerful Rust code bundler that combines multiple source files into a single, optimized file for competitive programming and code distribution.
๐ Documentation | ๐ Getting Started | ๐ก Examples | ๐ค Contributing
With cargo :
cargo install cg-bundler
cg-bundler > output.rs
Without cargo :
curl -L https://github.com/MathieuSoysal/cg-bundler/releases/latest/download/cg-bundler-linux-amd64 -o cg-bundler
bash cg-bundler > output.rs
cargo install cg-bundler
git clone https://github.com/MathieuSoysal/cg-bundler.git
cd cg-bundler
cargo install --path .
# Bundle current directory
cg-bundler
# Bundle specific project
cg-bundler /path/to/rust/project
# Output to file
cg-bundler -o bundled.rs
# Minify output
cg-bundler --minify -o compressed.rs
# Keep documentation and tests
cg-bundler --keep-docs --keep-tests
# NEW: Watch mode for live development
cg-bundler --watch -o output.rs
# Watch with verbose output and fast response
cg-bundler --watch -o output.rs --verbose --debounce 200
| Option | Short | Description |
|---|---|---|
--output |
-o |
Output file path (stdout if not specified) |
--keep-tests |
Keep test code in the bundled output | |
--keep-docs |
Keep documentation comments | |
--no-expand-modules |
Disable module expansion | |
--pretty |
Pretty print the output (format with rustfmt) | |
--minify |
-m |
Minify the output to a single line |
--m2 |
Aggressive minify with whitespace replacements | |
--verbose |
-v |
Verbose output |
--validate |
Validate project can be bundled without errors | |
--info |
Show project structure information | |
--watch |
-w |
NEW Watch for file changes and rebuild automatically |
--src-dir |
Source directory to watch (default: src) | |
--debounce |
Debounce delay in milliseconds (default: 500) | |
--help |
-h |
Print help information |
--version |
-V |
Print version information |
my_project/
โโโ Cargo.toml
โโโ src/
โ โโโ main.rs
โ โโโ lib.rs # Optional
โ โโโ utils.rs
โ โโโ game/
โ โ โโโ mod.rs
โ โ โโโ engine.rs
โ โโโ ai/
โ โโโ mod.rs
โ โโโ strategy.rs
// src/main.rs
use my_project::game::GameEngine;
use my_project::ai::Strategy;
fn main() {
let engine = GameEngine::new();
let strategy = Strategy::default();
engine.run_with_strategy(strategy);
}
// src/game/mod.rs
pub mod engine;
pub use engine::GameEngine;
// All modules expanded and combined
pub mod game {
pub struct GameEngine { /* ... */ }
impl GameEngine {
pub fn new() -> Self { /* ... */ }
pub fn run_with_strategy(&self, strategy: Strategy) { /* ... */ }
}
}
pub mod ai {
pub struct Strategy { /* ... */ }
impl Default for Strategy { /* ... */ }
}
use game::GameEngine;
use ai::Strategy;
fn main() {
let engine = GameEngine::new();
let strategy = Strategy::default();
engine.run_with_strategy(strategy);
}
We welcome contributions! Here's how to get started:
# Clone the repository
git clone https://github.com/MathieuSoysal/cg-bundler.git
cd cg-bundler
# Install dependencies and build
cargo build
# Run tests
cargo test
# Check formatting and linting
cargo fmt --check
cargo clippy -- -D warnings
Found a bug? Have a feature request? Please create an issue with:
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2024 CG Bundler Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Made with โค๏ธ by the Rust community
โญ Star us on GitHub | ๐ Report Bug | ๐ก Request Feature