The `build-number` package offers a focused utility for programmatically detecting the current build or run number within various Continuous Integration (CI) environments. It simplifies the process of retrieving this critical metadata by abstracting away the platform-specific environment variables used by systems such as GitHub Actions, GitLab CI, Travis CI, Jenkins, and others. The current stable version is 1.0.0, suggesting a foundational and robust release. Given its specific utility, the package likely follows a maintenance-oriented release cadence, with updates primarily driven by changes in CI platform environment variables or the introduction of new CI systems. Its key differentiator is its singular focus on providing a consistent API for build number retrieval, aiming to reduce boilerplate and ensure portability across different CI/CD pipelines without requiring developers to manually parse or conditionally check numerous environment variables.
npm install build-numberVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and use the `getBuildNumber` function, logging the detected build number or a warning if none is found.
Always check for a non-null/non-undefined return value before using the build number, especially in local development or non-CI contexts.
Consult the `build-number` source code or documentation (if available) to understand which environment variables are checked for your specific CI provider. Ensure your CI configuration sets these variables correctly.
For ESM, always use `import getBuildNumber from 'build-number';`. For CommonJS, use `const getBuildNumber = require('build-number');`.For CommonJS: `const getBuildNumber = require('build-number');`. For ESM: `import getBuildNumber from 'build-number';`.Either convert your project to ESM (add `"type": "module"` to `package.json` or use `.mjs` files) or use the CommonJS `require` syntax: `const getBuildNumber = require('build-number');`.Verify that your CI platform is supported by `build-number`. Check your CI environment variables to ensure they match what the package expects (e.g., `GITHUB_RUN_NUMBER`, `CI_COMMIT_PIPELINE_ID`). If running locally, ensure relevant environment variables are set before execution.
No dependency data recorded yet.