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 🙏

© 2024 – Pkg Stats / Ryan Hefner

env-prompt

v2.0.3

Published

A dependency-free utility that prompts you for your project's environment variables.

Downloads

561

Readme

env-prompt

Env-prompt is a Node.js utility that enables teams to seamlessly keep their environment variables in sync.

You simply provide two .env files:

  • a distributed file (default: .env.dist) committed to version control
  • a git ignored local file (default: .env)

As new variables are added to the distributed file, your team is prompted for their values.

Getting started

  1. Install env-prompt:
npm install -D env-prompt
  1. Add the env-prompt command to a script in your package.json file:
{
  "name": "test",
  "main": "index.js",
+ "scripts": {
+   "postinstall": "env-prompt"
+ },
  "devDependencies": {
    "env-prompt": "^2.0.0"
  }
}
  1. Create a .env.dist file in the same directory as your package.json file:
API_HOSTNAME=https://example.com
API_USER=api_user
API_PASS=myP4$$w0rd

Env-prompt is now set up to diff your .env and .env.dist files, and will be triggered when you run npm install.

Command-line interface

Synopsis

[CI=<true|false>] npx env-prompt
    [-d|--distFile <path>]
    [-l|--localFile <path>]
    [-p|--prompts <true|false>]
    [-a|--allowDuplicates]
    [-n|--newlineType <unix|windows>]

Arguments

-d <path>

--distFile <path>

Default: .env.dist
This is the .env file that env-prompt will scan for new environment variables. It is recommended that you commit this file to version control.

-l <path>

--localFile <path>

Default: .env
This is the .env file for your local environment. When prompted for new variables, the input values will be written here. It is recommended that you add this file to the .gitignore of your project.

-p <true|false>

--prompts <true|false>

Default: true
When setting --prompts false, env-prompt will run headlessly and will not prompt the user when new variables are detected. The default value from the distributed file will be written for new variables.

-a

--allowDuplicates

By default, an error is raised when duplicate variable declarations are found. The presence of this flag supresses this error.

-n <unix|windows>

--newlineType <unix|windows>

Default (on non-windows systems): unix
Default (on windows): windows
Determines how newlines will be written to disk. For unix, \n will be used. For windows, \r\n will be used. This argument only impacts how newlines are written to disk. Regardless of this value, \n, \r\n, and \r are all read from disk as newlines.

Variables

CI=<true|false>

Default: false
Indicates whether or not env-prompt is being run by continous integration. Setting CI=true is equivalent to --prompts false.