# ng-builder-apply-version

> Angular CLI Builder for applying version into environment files

Latest version **1.0.0** (published 2022-01-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install ng-builder-apply-version
pnpm add ng-builder-apply-version
yarn add ng-builder-apply-version
bun add ng-builder-apply-version
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-01-05 |
| First published | 2022-01-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 19.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Anthony |
| Maintainers | thonythony |
| Keywords | angular, cli, builder, package, version, environment |

## Links

- npm: https://www.npmjs.com/package/ng-builder-apply-version
- Repository: https://github.com/thonythony/ng-builder-apply-version
- Homepage: https://github.com/thonythony/ng-builder-apply-version#readme
- Issues: https://github.com/thonythony/ng-builder-apply-version/issues
- npm.io page: https://npm.io/package/ng-builder-apply-version

## Dependencies (4)

- [ts-morph](https://npm.io/package/ts-morph.md) ^13.0.2
- [typescript](https://npm.io/package/typescript.md) ~4.4.3
- [@angular-devkit/core](https://npm.io/package/@angular-devkit/core.md) ^13.1.2
- [@angular-devkit/architect](https://npm.io/package/@angular-devkit/architect.md) ^0.1301.1

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2022-01-05

## README

# ng-builder-apply-version

Angular CLI Builder that apply version into relevant `environment.ts` file(s) from various sources :

- [x] `package.json` version attribute
- [ ] system variable environment
- [ ] `.env` file

## Prerequisites

- An angular project with `@angular/cli` in version 13.x

- Install library in `devDependencies` :

```bash
npm i -D ng-builder-apply-version
```

## Usage

- Update `angular.json` under `architect` :

```json
"set-packagejson-version": {
    "builder": "ng-builder-apply-version:from-packagejson",
    "options": {
        "environmentFilePaths": [
            "src/environments/environment.ts",
            "src/environments/environment.staging.ts",
            "src/environments/environment.preprod.ts",
            "src/environments/environment.prod.ts"
       ]
    }
},
```

Note: `environmentFilePaths` option is optional. By default builder will use `environment.ts` and `environment.prod.ts` files.

- Execute command :

```bash
ng run set-packagejson-version
```

Pro-tips: add command to your package.json scripts as `"prebuild": "ng run set-packagejson-version",`, `prebuild` script will be automatically called before you call `npm run build`.

---
_Source: https://npm.io/package/ng-builder-apply-version · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
