Registry / devops / js-build-info-generator

js-build-info-generator

JSON →
library1.0.3jsnpmunverified

The `js-build-info-generator` package provides a straightforward command-line interface (CLI) tool designed to generate a JSON file containing essential build-time information. This utility is primarily intended for integration into CI/CD pipelines, allowing developers to automatically capture metadata such as the commit SHA, build version/tag, the exact build timestamp (ISO 8601 format), a custom comment, and the author who triggered the build. The current stable version is 1.0.3, last updated several years ago, indicating a mature and stable, albeit minimally maintained, codebase that fulfills its specific purpose without requiring frequent updates. Its core differentiation lies in its simplicity; it operates purely via command-line arguments, requiring no configuration files, making it easy to integrate into various build environments like Dockerfiles or GitLab CI stages. The output is a simple, predictable JSON object, making it easily consumable by other applications for displaying build provenance or debugging.

npm install js-build-info-generator
INSTALL
IMPORT
SIG · JS-BUILD-INFO-GENE
J
js-build-info-generator
devopsjavascriptv1.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Demonstrates how to generate a build info JSON file with various parameters specifying commit SHA, build version, comment, and author, outputting to a specified file path, typically used in CI/CD.

npx generate-build-info \ --file ./public/build-info.json \ --sha "$CI_COMMIT_SHORT_SHA" \ --build "$CI_COMMIT_TAG" \ --comment "Release to Test Environment" \ --author "build-system" # Example output to ./public/build-info.json /* { "sha": "a3cb219c", "build": "v1.2.32.0", "buildTime": "2019-10-25T11:26:09.593Z", "comment": "Release to Test Environment", "author": "build-system" } */
js-build-info-generator --version
Debug
Known issues
gotchaWhen using `generate-build-info` directly without a global installation, it's recommended to prefix the command with `npx` (e.g., `npx generate-build-info`) to ensure the correct version from `node_modules` is executed without polluting the global environment.
fix
Use `npx generate-build-info ...` or `npm install -g js-build-info-generator`.
affects: >=1.0.0
gotchaThe `--file` parameter specifies the output path. If the directory specified in the path does not exist, the command will fail. The tool does not automatically create parent directories.
fix
Ensure the target directory for the output file exists before running the command, e.g., `mkdir -p ./public && npx generate-build-info --file ./public/build-info.json ...`.
affects: >=1.0.0
gotchaThe tool will overwrite an existing file at the specified `--file` path without any warning or confirmation. Exercise caution if the output path might contain valuable data that should not be replaced.
fix
Consider adding a check for file existence before running the command, or ensure the output directory is ephemeral in CI/CD pipelines.
affects: >=1.0.0
Errors
Common errors & fixes
generate-build-info: command not found
The `generate-build-info` executable is not in the system's PATH or not installed globally.
fix
Run `npm install -g js-build-info-generator` to install globally, or `npx generate-build-info ...` to execute it from `node_modules`.
Error: ENOENT: no such file or directory, open './non/existent/dir/build-info.json'
The directory specified in the `--file` argument does not exist.
fix
Create the target directory before running the command: `mkdir -p ./non/existent/dir && npx generate-build-info --file ./non/existent/dir/build-info.json ...`
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
js-build-info-generator — npm install js-build-info-generator · libregistry