1.0.1 • Published 7 years ago

venv v1.0.1

Weekly downloads
16
License
MIT
Repository
github
Last release
7 years ago

venv

Build Status npm version

Make build-time environment variables available to your application.

Venv uses EJS 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:

(function (window) {
  window.__env = window.__env || {};
  window.__env.BUILD_BUILDNUMBER = '<%= env.BUILD_BUILDNUMBER %>';
}(this));
<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
1.0.1

7 years ago

1.0.0

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago