All Projects β†’ inexio β†’ angular-build-info

inexio / angular-build-info

Licence: MIT license
πŸ›  A CLI to generate an easily importable `build.ts` file containing various details about the application build

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to angular-build-info

Please
High-performance extensible build system for reproducible multi-language builds.
Stars: ✭ 1,856 (+7324%)
Mutual labels:  build, build-tool
Zeus
An Electrifying Build System
Stars: ✭ 176 (+604%)
Mutual labels:  build, build-tool
Nginx Builder
A tool to build deb or rpm package of required Nginx version from the source code, with the ability to connect third-party modules. Nginx parameters are set in the yaml configuration file.
Stars: ✭ 123 (+392%)
Mutual labels:  build, build-tool
Postinstall Build
Helper for conditionally building your npm package on postinstall
Stars: ✭ 87 (+248%)
Mutual labels:  build, build-tool
Build Harness
πŸ€–Collection of Makefiles to facilitate building Golang projects, Dockerfiles, Helm charts, and more
Stars: ✭ 236 (+844%)
Mutual labels:  build, build-tool
Pybuilder
Software build automation tool for Python.
Stars: ✭ 1,290 (+5060%)
Mutual labels:  build, build-tool
Baumeister
πŸ‘· The aim of this project is to help you to build your things. From Bootstrap themes over static websites to single page applications.
Stars: ✭ 171 (+584%)
Mutual labels:  build, build-tool
Cargo Make
Rust task runner and build tool.
Stars: ✭ 895 (+3480%)
Mutual labels:  build, build-tool
Earthly
Repeatable builds
Stars: ✭ 5,805 (+23120%)
Mutual labels:  build, build-tool
Mbt
The most flexible build tool for monorepo
Stars: ✭ 184 (+636%)
Mutual labels:  build, build-tool
Projectbuilder
A tool for easy automating and customizing build process for Unity.
Stars: ✭ 80 (+220%)
Mutual labels:  build, build-tool
aseprite-macos-buildsh
Automated script to create latest release app (either beta, or release whichever is newer) of Aseprite for macOS
Stars: ✭ 143 (+472%)
Mutual labels:  build, build-tool
Dawn
πŸŒ… Dawn is a lightweight task management and build tool for front-end and nodejs.
Stars: ✭ 1,057 (+4128%)
Mutual labels:  build, build-tool
Aria2 Build Msys2
aria2 build scripts on msys2 with custom patches.
Stars: ✭ 112 (+348%)
Mutual labels:  build, build-tool
Hopp
Crazy rapid build system.
Stars: ✭ 24 (-4%)
Mutual labels:  build, build-tool
Arduino Cmake Ng
CMake-Based framework for Arduino platforms
Stars: ✭ 123 (+392%)
Mutual labels:  build, build-tool
Flubucore
A cross platform build and deployment automation system for building projects and executing deployment scripts using C# code.
Stars: ✭ 695 (+2680%)
Mutual labels:  build, build-tool
Gogradle
A Gradle Plugin Providing Full Support for Go
Stars: ✭ 712 (+2748%)
Mutual labels:  build, build-tool
Build
B2 makes it easy to build C++ projects, everywhere.
Stars: ✭ 182 (+628%)
Mutual labels:  build, build-tool
buildozer
🚜 Build tool which simplify your buildprocess. Built with Gulp.js πŸ₯€
Stars: ✭ 22 (-12%)
Mutual labels:  build, build-tool

Description

angular-build-info is a command line interface to collect information about your current build. It compiles information such as the timestamp when the application was built, the current git user, the hash of the latest commit and the current version from inside your projects package.json file.

Example output of the CLI looks as follows:

// Angular build information, automatically generated by `4dams/angular-build-info`

export const buildInfo = {
    user: "Juri Adams",
    hash: "1e872b5",
    version: "1.1.4",
    timestamp: "November 15, 2019 16:37:35",
};

Installation and Usage

Installation is pretty easy:

npm i -g angular-build-info

Running the script with the --init flag (angular-build-info --init) then produces a build.ts file inside your Angular projects src/ folder. You can then proceed to import this file inside your Angular application. An example making use of this information can be found below.

Another important thing to use this tool effectively is to update your package.json scripts. Below is an example of what your build or deploy script might look like.

{
    "scripts": {
        "build": "angular-build-info && ng build",
        "deploy": "angular-build-info && ng build --prod && ./deploy"
    }
}

If you now run any of these commands, information about the current build will be saved inside the previously mentioned build.ts file.

Implementing in Angular

Below is an example of what your app.component.ts might look like after implementing the information from inside the build.ts file.

import { Component } from "@angular/core";
import { buildInfo } from "../build";
import { environment } from "../environments/environment";

@Component({
    selector: "app-root",
    templateUrl: "./app.component.html",
    styleUrls: ["./app.component.css"],
})
export class AppComponent {
    constructor() {
        console.log(
            `\n%cBuild Info:\n\n` +
                `%c ❯ Environment: %c${environment.production ? "production 🏭" : "development 🚧"}\n` +
                `%c ❯ Build Version: ${buildInfo.version}\n` +
                ` ❯ Build Timestamp: ${buildInfo.timestamp}\n` +
                ` ❯ Build Message: %c${buildInfo.message || "<no message>"}\n`,
            "font-size: 14px; color: #7c7c7b;",
            "font-size: 12px; color: #7c7c7b",
            environment.production ? "font-size: 12px; color: #95c230;" : "font-size: 12px; color: #e26565;",
            "font-size: 12px; color: #7c7c7b",
            "font-size: 12px; color: #bdc6cf",
        );
    }
}

This is what the previous code will output in the browser console once you open the app:

Authors

  • Juri Adams - Initial Work - @4dams

License

This project is underlying the MIT-License. For more information, take a look at this projects LICENSE.md file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].