Registry / devops / zip-build

zip-build

JSON →
library1.8.0jsnpmunverified

zip-build is a specialized Node.js command-line utility designed for automating the archival of project build artifacts. It streamlines the process of zipping or tarring a specified output directory, making it particularly useful for deployment pipelines or versioned backups. The package automatically generates archive filenames based on the project's `name` and `version` fields extracted from `package.json`, and can optionally include a timestamp for uniqueness. Currently, at version 1.8.0, it demonstrates active maintenance through its GitHub repository, though a formal release cadence is not explicitly defined. Its key differentiators include flexible output formatting (supporting both `.zip` and `.tar`), customizable filename templating, and an optional interactive mode for guided execution. It primarily serves as a `devDependency` to be integrated into `npm scripts` for an automated build workflow, rather than offering a direct programmatic API for `import` into JavaScript or TypeScript modules.

npm install zip-build
INSTALL
IMPORT
SIG · ZIP-BUILD
Z
zip-build
devopsjavascriptv1.8.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

zipBuild
This package is a CLI tool, primarily used via npm scripts or direct terminal execution. It does not expose a documented programmatic API for direct JavaScript/TypeScript imports.
import { zipBuild } from 'zip-build';
zip-build is intended for command-line usage. Attempts to import its functionality directly as a module will not work as expected for its core archiving features. To use its functionality programmatically, consider `child_process.spawn` or `exec` to invoke the CLI.
Default Export
This package is a CLI tool and does not provide a default export for programmatic use.
import zipBuildCommand from 'zip-build';
There is no default export. The package's primary interface is the `zip-build` command available in your terminal after installation.
CommonJS Require
This package is a CLI tool and does not expose a CommonJS module for requiring its core functionality.
const zipBuild = require('zip-build');
Attempting to `require('zip-build')` will likely provide access to its internal module structure, but not a stable or documented API for executing its archiving logic. Direct CLI invocation is the recommended approach.

Demonstrates how to integrate `zip-build` into an npm script workflow, showing installation, directory creation, and archiving with custom naming.

// package.json snippet to demonstrate integration into a build workflow // Add this 'scripts' block to your project's package.json: /* { "name": "my-project-name", "version": "1.2.3", "scripts": { "clean": "rm -rf dist build", "prebuild": "npm run clean", "build": "mkdir build && echo 'Hello, this is a build artifact!' > build/main.txt && zip-build build dist --format zip --template 'app_%VERSION%_release_%TIMESTAMP%.%EXT%' --override", "postbuild": "echo 'Build and archiving complete! Check the dist directory.'", "test-zip": "npm run build && ls dist" }, "devDependencies": { "zip-build": "^1.8.0" } } */ // To run this quickstart example: // 1. Ensure 'zip-build' is installed as a devDependency in your project: // npm install --save-dev zip-build // 2. Add the provided 'scripts' block to your project's package.json file. // 3. Open your terminal in the project root and run: // npm run build // This will create a 'build' directory, place a dummy file inside, then archive // that directory into a 'dist' folder with a name like 'app_1.2.3_release_1678886400000.zip'. // The --override flag ensures it can run multiple times without error.
zip-build --version
Debug
Known issues
gotchaBy default, `zip-build` will not override an existing archive file. If an output file with the generated name already exists in the `zipDir`, the command will fail.
fix
To allow overwriting, always include the `--override` (or `-o`) flag when running `zip-build`, e.g., `zip-build build dist --override`.
affects: >=1.0.0
gotchaThe default `buildDir` is `build` and `zipDir` is `dist`. If your project uses different directory names, `zip-build` will not find them or place the archive correctly.
fix
Always explicitly specify your source and destination directories, e.g., `zip-build output archives`. Alternatively, ensure your build output goes into a `build` directory and you want the archive in a `dist` directory.
affects: >=1.0.0
gotchaThe `--name` option, which allows asking for a custom output archive filename, requires the `--interactive` flag to also be enabled. Using `--name` without `--interactive` will have no effect.
fix
To use the `--name` option, combine it with `--interactive`: `zip-build --interactive --name`.
affects: >=1.0.0
gotchaThis package is designed as a Command-Line Interface (CLI) tool. It does not expose a stable or documented programmatic API for direct `import` or `require` into JavaScript/TypeScript modules. Attempts to use it this way are unsupported.
fix
Integrate `zip-build` into your project via npm `scripts` in `package.json`, or by invoking the CLI command directly using `child_process` functions (like `spawn` or `exec`) if programmatic execution within Node.js is necessary.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Command failed with exit code 1: zip-build
The `zip-build` command was invoked, but either the source `buildDir` did not exist, or the destination `zipDir` was invalid, or an existing archive prevented creation without the `--override` flag.
fix
Ensure the `buildDir` exists before running the command. Check that `zipDir` is a valid path. If an archive already exists at the target, add the `--override` flag (e.g., `zip-build my-build my-dist --override`).
zip-build: command not found
The `zip-build` package is not installed globally, or it's a local `devDependency` and the command is not being run from an npm script or via `npx`.
fix
Install it as a devDependency (`npm install --save-dev zip-build`) and then run it via an npm script (e.g., `"build": "zip-build"` in `package.json` then `npm run build`), or use `npx zip-build` to execute it directly.
Error: EEXIST: file already exists, 'my-project_1.0.0_TIMESTAMP.zip'
An archive with the generated filename already exists in the target `zipDir`, and the `--override` flag was not used to permit overwriting.
fix
To allow overwriting existing archives, add the `--override` flag to your `zip-build` command (e.g., `zip-build --override`). Alternatively, modify the `--template` option to ensure unique filenames.
Upgrade
Version history
1.8.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
18
Resources