{"id":13391,"library":"js-build-info-generator","title":"JS Build Info Generator","description":"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.","status":"maintenance","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/spenceclark/js-build-info-generator","tags":["javascript","build","npm","yarn","ci","cd"],"install":[{"cmd":"npm install js-build-info-generator","lang":"bash","label":"npm"},{"cmd":"yarn add js-build-info-generator","lang":"bash","label":"yarn"},{"cmd":"pnpm add js-build-info-generator","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[],"quickstart":{"code":"npx generate-build-info \\\n  --file ./public/build-info.json \\\n  --sha \"$CI_COMMIT_SHORT_SHA\" \\\n  --build \"$CI_COMMIT_TAG\" \\\n  --comment \"Release to Test Environment\" \\\n  --author \"build-system\"\n\n# Example output to ./public/build-info.json\n/*\n{\n    \"sha\": \"a3cb219c\",\n    \"build\": \"v1.2.32.0\",\n    \"buildTime\": \"2019-10-25T11:26:09.593Z\",\n    \"comment\": \"Release to Test Environment\",\n    \"author\": \"build-system\"\n}\n*/","lang":"javascript","description":"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."},"warnings":[{"fix":"Use `npx generate-build-info ...` or `npm install -g js-build-info-generator`.","message":"When 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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 ...`.","message":"The `--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.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider adding a check for file existence before running the command, or ensure the output directory is ephemeral in CI/CD pipelines.","message":"The 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.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Run `npm install -g js-build-info-generator` to install globally, or `npx generate-build-info ...` to execute it from `node_modules`.","cause":"The `generate-build-info` executable is not in the system's PATH or not installed globally.","error":"generate-build-info: command not found"},{"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 ...`","cause":"The directory specified in the `--file` argument does not exist.","error":"Error: ENOENT: no such file or directory, open './non/existent/dir/build-info.json'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"js-build-info-generator","cli_version":null}