Open-Source packaging tooling

Lean packages.
Less baggage.

Open-source tools that keep development artifacts out of your published packages — without removing them from your repository.

$ vendor/bin/php-lean lint --dry-run
Scanning repository against .gitattributes export-ignore rules...
Found 4 non-runtime items missing export-ignore:
- tests/
- phpunit.xml
- .github/
- phpstan.neon
✓ Package archive size reduced: 2.1 MB → 180 KB (-91.4%)
$ _

How lean packaging works

A transparent three-step process that eliminates distribution bloat while keeping your repository and development setup completely intact.

01 — Inspect

Detect development-only files and artifacts in your repository.

02 — Configure

Create or update your ecosystem's native packaging exclusions.

03 — Ship

Publish a cleaner distribution archive while keeping your repository's state intact.

Why lean distribution matters

Published packages are consumed thousands or millions of times. Unintentional files waste bandwidth, slow down CI, and reveal internal repository structure.

Smaller distribution archives

Minimizes archive payload size, reducing download latency and disk consumption across CI runners, server deployments, and local development environments worldwide.

Explicit package exclusions

Helps prevent accidental publication of development artifacts, internal documentation, test data, and repository configuration.

Language-native tooling

No alien configuration formats or heavy runtime wrappers. Every tool works directly with your ecosystem’s native manifests and package manager standards.

Open-source & community-driven

Transparent, permissively licensed (MIT), and built collaboratively by developers who care about sustainable, efficient software distribution.

Tools & Utilities

Explore the specialized packages available across the lean-packages ecosystem.

php-lean

A library and CLI tool for validating and managing .gitattributes export-ignore rules to ensure development-only files do not get packaged in published Composer distribution archives.

composer require --dev stolt/php-lean

cargo-lean

A Cargo subcommand for validating, auditing, and optimizing Cargo.toml package exclusion lists to prevent unnecessary files from inflating crates.io distribution tarballs.

cargo install cargo-lean

py-lean

A Python tool for detecting, configuring, and fixing missing source-exclude patterns in pyproject.toml to ensure repository-only files are omitted from source distributions.

uv tool install py-lean-package
JavaScript v0.1.1
lean-packages/js-lean

js-lean

A CLI tool for validating and optimizing lean JavaScript & TypeScript package distribution by checking package.json files allowlists and .npmignore files.

npm install -D js-lean

Companion Tools & Utilities

Additional focused tools within the lean-packages organization:

Frequently asked questions

Essential answers about lean packaging, archive optimization, non-destructive workflows, and CI integration.

What is a lean distribution archive?

A lean distribution archive contains only the runtime code, build assets, metadata, and license files strictly necessary for your package to function in consumer projects or production environments. It excludes test suites, CI workflows, code quality configurations, benchmarks, developer scripts, and documentation that inflate package downloads, bandwidth costs, and node storage.

Do these tools delete files from my repository?

No. All lean-packages tools operate entirely non-destructively. They never delete, modify, or remove files from your local working tree or git history. Instead, they inspect your repository and manage standard packaging exclusion manifests (such as .gitattributes, Cargo.toml, pyproject.toml, or package.json) so that development files remain in git but are omitted from distribution releases.

Does every language use the same exclusion mechanism?

No. Each tool adheres strictly to its ecosystem's native packaging standards. For example, PHP relies on .gitattributes export-ignore attributes for Composer packages, Rust uses the [package].exclude manifest list in Cargo.toml, Python utilizes MANIFEST.in or modern pyproject build backend rules, and JavaScript uses the package.json files allowlist or .npmignore.

Can I integrate lean-packages into CI/CD?

Yes. Every CLI tool provides a linting or verification command that returns non-zero exit codes when unexcluded development artifacts or misconfigured packaging manifests are detected. You can easily integrate them into GitHub Actions, GitLab CI, or pre-release release scripts to automatically prevent package bloat from reaching registries.

How can I contribute for a yet unsupported language/ecosystem?

We welcome community collaboration! You can open an issue or pull request in our GitHub organization proposing a new ecosystem tool, sharing packaging specifications, or helping expand file pattern rules and test suites across existing projects.

Ship lean software everywhere

All tools in the lean-packages family are open-source under the MIT license. We welcome contributors, language toolchain suggestions, and feedback on distribution packaging.

Command copied to clipboard