angular-build-info is a Command Line Interface (CLI) tool designed to automate the collection of crucial build-related metadata for Angular applications. Upon execution, it generates a `build.ts` file, typically placed in the project's `src/` directory, containing details such as the application's version (from `package.json`), the current Git commit hash, the Git user, and a precise build timestamp. This generated file can then be directly imported and utilized within Angular components or services to display build information, useful for debugging, support, or informational purposes. The package is currently stable at version 2.0.1, having undergone a significant rewrite in version 2.0.0. Releases appear to follow an as-needed cadence, focusing on bug fixes and enhancements. Its primary differentiator is its simplicity and direct integration into existing Angular CLI build workflows via `package.json` scripts, providing an easily consumable TypeScript module.
npm install angular-build-infoVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to install `angular-build-info`, initialize the `build.ts` file, configure your Angular project's `package.json` to automatically update build information, and then import and display this data within an Angular component's browser console.
Review the official `angular-build-info` GitHub repository for detailed migration guides and updated usage instructions when upgrading to v2.x.
Ensure Git is installed and accessible in your system's PATH, and that your Angular project is initialized as a Git repository (`git init`).
Always prepend `angular-build-info &&` to your `ng build` command in `package.json` scripts. Example: `"build": "angular-build-info && ng build --prod"`.
Initialize your project as a Git repository using `git init` in your project's root directory.
Ensure `angular-build-info --init` has been run at least once to create the file, and that `angular-build-info` is executed before `ng build` in your `package.json` scripts (e.g., `"build": "angular-build-info && ng build"`). Verify `src/build.ts` exists.
Double-check your `package.json` build scripts to ensure `angular-build-info` runs correctly before `ng build`. You might also need to clear build caches or force a clean build, e.g., by deleting `dist/` and `node_modules/.angular/cache/`.
No dependency data recorded yet.