npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@e11community/envtemplate

v1.1.0

Published

Render a file from a template, substituting `${VAR}` references with values from the environment (or a `.env`-style file). Ships as both a CLI binary and a GitHub Action.

Downloads

131

Readme

envtemplate

Render a file from a template, substituting ${VAR} references with values from the environment (or a .env-style file). Ships as both a CLI binary and a GitHub Action.

Common uses: producing .npmrc, pip.conf, .env, or any other config file that needs to embed secrets at deploy time without committing them.

Install

npm install -g @e11community/envtemplate

After install, the envtemplate command is on your PATH.

CLI

envtemplate --template <path> --output <path> [options]

| Flag | Required | Description | | ----------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | -t, --template <path> | Yes | Template path. Repeatable; rightmost-existing wins, falling back leftward. Pass - to read from stdin. | | -o, --output <path> | Yes | Output path. Pass - to write to stdout. | | -e, --env <path> | No | Path to a .env-style file (parsed by dotenv). When set, replaces process.env as the var source. | | --output-mode <oct> | No | File mode for the output file, chmod-style octal (e.g. 600, 644). Ignored when --output is -. Default: 600. | | --on-missing <mode> | No | Behavior when a ${VAR} has no value: error, empty, or keep. Default: empty. | | -h, --help | No | Show help and exit. |

Substitution rules

  • Only ${NAME} is substituted. Bare $VAR and other shell-style forms are left untouched.
  • Variable names match [A-Za-z_][A-Za-z0-9_]*. Invalid names (leading digit, dashes) are not substituted.
  • An empty-string env value (FOO=) counts as present — it substitutes to the empty string and does not trip --on-missing error.

Examples

Render a file with substitution from your shell environment:

TOKEN=abc envtemplate --template app.tmpl --output app.conf

Use stdin and stdout as a pipe:

echo 'auth=${TOKEN}' | TOKEN=abc envtemplate --template - --output -
# → auth=abc

Source vars from a .env file instead of the shell:

envtemplate --template app.tmpl --output app.conf --env ./secrets.env

Multiple templates with fallback — useful in monorepos where a service may override a workspace-wide template:

envtemplate \
  --template workspace.tmpl \
  --template services/foo/override.tmpl \
  --output services/foo/.npmrc

If services/foo/override.tmpl exists, it is used; otherwise the workspace template is used. If neither exists, the command exits with an error and lists what it tried.

Use a non-default file mode:

envtemplate --template app.tmpl --output app.conf --output-mode 644

Treat missing variables as fatal:

envtemplate --template app.tmpl --output app.conf --on-missing error

GitHub Action

- uses: e11community/envtemplate@v1
  with:
    templates: |
      path/to/template.tmpl
    output: path/to/output
    env: |
      TOKEN=${{ secrets.MY_TOKEN }}

| Input | Required | Description | | ------------- | -------- | ----------------------------------------------------------------------------------------------------------------- | | templates | Yes | Newline-separated list of template candidate paths. Rightmost existing wins, falling back leftward. | | output | Yes | Path to the output file. | | output-mode | No | File mode for the output file, chmod-style octal (e.g. "600", "644"). Default: "600". | | env | No | Dotenv-format KEY=VALUE lines used as the substitution env. Overrides keys provided by env-file on collision. | | env-file | No | Path to a .env-style file (parsed by dotenv). Combined with env (env wins on key collisions). |

env and env-file are merged, with env keys taking precedence. If neither is provided, the action falls back to the workflow's process environment.

Worked example

A more complete usage — including a matrix over microservices, fallback between a workspace-wide template and per-service overrides — lives at impl/.github/workflows/action.yml. That file is not picked up by GitHub Actions (it's outside the repo's top-level .github/workflows/); it's there purely as a documented reference.

Why a 0o600 default?

The original motivation for this tool was rendering files like .npmrc and .env that contain bearer tokens. Defaulting to 0o600 (owner read/write only) means a misconfigured CI job won't leave a world-readable secret on disk. Override with --output-mode / output-mode: when you need something more permissive.