project-share-zip
v2.0.0
Published
Create a shareable ZIP of a Git project while respecting ignore rules.
Maintainers
Readme
project-share-zip
Create a normal .zip of the current Git project for sharing with ChatGPT or another code-review tool.
The goal is deliberately small: run one command and get the project files you normally want to share, without node_modules, build output, private ignored config, or other Git-ignored files.
Install
npm install --save-dev project-share-zipAdd a script:
{
"scripts": {
"pkg": "project-share-zip"
}
}Then run:
npm run pkgThis package uses the same CLI for its own npm run pkg script, so changes to the tool are exercised against the project itself too.
A project in C:\code\my-app creates:
C:\code\my-app\my-app.zipWhat gets included
The file list comes from Git, so the package automatically respects:
.gitignorefiles.git/info/exclude- your global Git ignore file
It includes all tracked files plus untracked files that are not ignored, so current working-tree changes can be shared even before they are committed.
This follows normal Git behavior: ignore rules do not stop a file from being included once that file is tracked. Use --exclude for tracked files or directories that should remain in version control but should not be shared.
The package additionally always excludes:
node_modulesat any depth- every
package-lock.json - the output ZIP itself
The ZIP contains the actual working-tree bytes on disk; it does not archive a committed snapshot or run files through Git clean/line-ending filters.
Share-only exclusions
Use --exclude for project files that should stay in version control but should not be shared in the ZIP. The option is repeatable, so the exclusions can live directly in the project's npm script:
{
"scripts": {
"pkg": "project-share-zip --exclude ./sensitive --exclude ./private-notes.txt"
}
}Each value is a literal file or directory path relative to the project root. Excluding a directory excludes everything below it, including tracked files. Globs are intentionally not interpreted.
You can also pass exclusions directly:
npx project-share-zip --exclude ./sensitive --exclude ./fixtures/privateGit's built-in .git/info/exclude and global Git ignore file remain supported for untracked files. Like .gitignore, they do not exclude files that are already tracked.
Custom output path
npm run pkg -- --output ./tmp/code-review.zipOr directly:
npx project-share-zip --output ./tmp/code-review.zipImportant security note
This is a convenience tool, not a secret scanner. Before uploading a ZIP, make sure untracked private files are covered by .gitignore, .git/info/exclude, or your global Git ignore file, and use --exclude for private files that remain tracked.
Requirements
- Node.js 20.19 or newer
- Git available on
PATH - Run the command from the Git repository root
Why not npm pack?
npm pack is excellent for creating the package you intend to publish, but its file selection can be controlled by package.json#files and .npmignore. Those rules often intentionally omit source, tests, or project metadata, which makes them a poor fit for sharing a working project snapshot.
