# venv

> Use build-time environment variables in your application

Latest version **1.0.1** (published 2017-08-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install venv
pnpm add venv
yarn add venv
bun add venv
```

Provides the command `venv`.

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-08-22 |
| First published | 2017-08-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=6.0.0 |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Maintainers | garyb432 |
| Keywords | environment, variables, angular, cli |

## Links

- npm: https://www.npmjs.com/package/venv
- Repository: https://github.com/GaryB432/venv
- Homepage: https://github.com/GaryB432/venv#readme
- Issues: https://github.com/GaryB432/venv/issues
- npm.io page: https://npm.io/package/venv

## Dependencies (3)

- [ejs](https://npm.io/package/ejs.md) ^2.5.7
- [yargs](https://npm.io/package/yargs.md) ^8.0.2
- [fs-extra](https://npm.io/package/fs-extra.md) ^4.0.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.1 (latest) — 2017-08-22
- 1.0.0 — 2017-08-22
- 0.4.1 — 2017-08-16
- 0.4.0 — 2017-08-15
- 0.3.0 — 2017-08-13
- 0.2.0 — 2017-08-13
- 0.1.0 — 2017-08-13

## README

# venv

[![Build Status](https://travis-ci.org/GaryB432/venv.svg?branch=master)](https://travis-ci.org/GaryB432/venv)
[![npm version](https://badge.fury.io/js/venv.svg)](https://badge.fury.io/js/venv)

Make build-time environment variables available to your application.

Venv uses [EJS](https://ejs.co) to transform a template file using Node's `process.env` map.

## CLI Usage

Usage: `venv <cmd> [options]`

Your build or deploy pipeline could include

```
npm install venv -g
venv process -t src\environments\environment.prod.ts
```

### Commands:

### process

 - appends `.template` to the filename passed as argument `t`
 - transforms that file using `process.env` as the context
 - saves the result to the original name supplied on the command line

### Options:

```
-t, --templatePath    the path to the template file
-h, --help            show help
-v, --version         current version
```

#### Example

> venv process --templatePath assets\env.js

__assets\env.js.template__:
```javascript
(function (window) {
  window.__env = window.__env || {};
  window.__env.BUILD_BUILDNUMBER = '<%= env.BUILD_BUILDNUMBER %>';
}(this));
```

```html
<html>

<head>
  <meta charset="utf-8">
  <script src="assets/env.js"></script>
</head>

<body>
  <script>
    console.log(__env.BUILD_BUILDNUMBER);
  </script>
</body>

</html>
```

## Exit Codes

The CLI process may exit with the following codes:

- `0`: Transform succeeded without errors
- `1`: An invalid command line argument or combination thereof was used
- `2`: Transform failed

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