# npm-build-zip

> `npm run zip` to generate a .zip archive file. Zero CLI deps.

Latest version **2.0.1** (published 2026-07-05) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install npm-build-zip
pnpm add npm-build-zip
yarn add npm-build-zip
bun add npm-build-zip
```

Provides the command `npm-build-zip`.

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2026-07-05 |
| First published | 2019-06-10 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=22 |
| Dependencies | 2 |
| Unpacked size | 13.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 7 |
| Author | Roberto SLopez |
| Maintainers | roberto_slopez |
| Keywords | pack, react, create-react-app, zip |

## Links

- npm: https://www.npmjs.com/package/npm-build-zip
- Repository: https://github.com/roberto-slopez/npm-build-zip
- Homepage: https://github.com/roberto-slopez/npm-build-zip#readme
- Issues: https://github.com/roberto-slopez/npm-build-zip/issues
- npm.io page: https://npm.io/package/npm-build-zip

## Dependencies (2)

- [archiver](https://npm.io/package/archiver.md) ^7.0.1
- [npm-packlist](https://npm.io/package/npm-packlist.md) ^1.4.4

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2026-07-05
- 2.0.0 — 2026-06-24
- 1.0.4 — 2023-06-19
- 1.0.3 — 2021-02-01
- 1.0.2 — 2019-10-03
- 1.0.1 — 2019-09-03
- 1.0.0 — 2019-06-10

## README

## Installation

```
npm install --save-dev npm-build-zip
```

Requires Node.js **>= 22** (v1.x supports Node 18+).

## Example

Modify YourApp/package.json:

```json
"scripts": {
    "zip": "npm-build-zip"
}
```

Create the .zip file containing the build folder:

```bash
npm run zip
```

### Arguments

| Flag | Alias | Default | Description |
| --- | --- | --- | --- |
| `--source=<dir>` | `--src`, `-s` | `./build` | Folder to zip. |
| `--destination=<dir>` | `--dst`, `-d` | `.` (cwd) | Output folder. Created if missing. |
| `--includes=pkg1,pkg2` | `--in` | `''` | Comma-separated list of packages to bundle (`npm-packlist bundled`). |
| `--name=demo` | `-n` | `''` | Suffix appended to the filename, or full name with `--name_only`. |
| `--name_only` | `--no` | `false` | When passing `--name`, use it as the full filename. |
| `--info` | `-i` | `false` | Print the archive path. |
| `--verbose` | `-v` | `false` | Print every file added to the archive. |
| `--include_hidden` | `--all` | `false` | Include dotfiles and bypass `.gitignore`/`.npmignore`. |
| `--exclude=*.map,**/*.test.js` | `-x` | `''` | Comma-separated globs to exclude (Node 22+, `fs.promises.glob`). |
| `--no-timestamp` | — | `false` | Embed `1980-01-01 00:00` mtimes for reproducible builds. |
| `--help` | `-h` | — | Show usage. |
| `--version` | `-V` | — | Show version. |

### Filename resolution

By default the file is named `<sanitized-package-name>_<sanitized-package-version>[.<suffix>].zip`.

- If both `--name` and `--name_only` are set, the file is named `<name>.zip` and `package.json#name`/`#version` are not required.
- If `package.json` is missing or has no `name`/`version`, the command exits with a clear error explaining how to fix it.

## Migrating from 1.x

The 2.0.0 release drops three runtime dependencies (`archiver-promise`, `sanitize-filename`, `yargs`) and switches to ESM-first. The user-facing CLI is unchanged — all flags and aliases work the same way. The breaking changes are:

- **Node.js >= 22 is required** (was 18). If you can't upgrade, pin to `1.2.x`.
- **CJS `require('npm-build-zip')` is still supported** via `index.cjs` shim, but `pack` returns a Promise — `.then()` or `await` is required.
- ESM users: `import { pack } from 'npm-build-zip'` works as expected.

## License

Apache-2.0

---
_Source: https://npm.io/package/npm-build-zip · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
