Pack-src efficiently archives source code directories into clean ZIP files while respecting ignore rules. With features like deterministic output, a polished CLI, and zero configuration, packing code never felt easier or faster. Perfect for large repositories with smart ignoring of unnecessary files.
pack-src is a powerful tool designed for efficiently packing source code directories into clean ZIP archives. This utility is built for speed and smart handling of file exclusions, ensuring reliable and reproducible packaging of your projects. Key features include:
.packsrcignore, .gitignore, .dockerignore, and .npmignore, along with built-in defaults.To pack files in a directory, execute the following commands:
# To pack the current directory
pack-src
# To pack a specific directory
pack-src ./my-project
# To specify the output file name
pack-src ./my-project -o snapshot.zip
# To include a timestamp in the filename
pack-src ./my-project --timestamp
# Example output: my-project-2026-05-21.zip
# To perform a dry run and preview files without creating the archive
pack-src ./my-project --dry-run
# To list the files that will be included
pack-src ./my-project --list-files
# To print compression statistics
pack-src ./my-project --stats
# To set the compression level (0 = store, 9 = maximum)
pack-src ./my-project -c 9
# To include .env files (excluded by default)
pack-src ./my-project --include-env
# To disable .gitignore
pack-src ./my-project --no-gitignore
# To disable all built-in exclusions
pack-src ./my-project --no-default-ignore
# To overwrite existing output files
pack-src ./my-project --overwrite
# Quiet mode (suitable for CI)
pack-src ./my-project -q
The ignore rules are prioritized as follows:
node_modules, dist, and more.pack-src provides predictable naming conventions for the generated ZIP files:
| Command | Output File |
|---|---|
pack-src ./my-project | my-project.zip |
pack-src ./my-project --timestamp | my-project-2026-05-21.zip |
pack-src ./my-project -o out/snap.zip | out/snap.zip |
pack-src has demonstrated impressive performance metrics, particularly when tested on large projects. For example:
| Tool | Time | Memory |
|---|---|---|
pack-src | ~180ms | ~18MB |
zip -r (naive) | ~240ms | ~24MB |
tar czf | ~160ms | ~15MB |
For developers looking to integrate packing functionality into their applications, pack-src provides an intuitive API:
import { runPack, collectFiles, IgnoreEngine } from 'pack-src';
// Pack a directory
await runPack({
source: './my-project',
output: 'snapshot.zip',
compression: 6,
stats: true,
});
If interested in contributing to pack-src, clone the repository and follow the established development practices. The project encourages contributions through a well-defined process.
No comments yet.
Sign in to be the first to comment.