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

@henrycunh/ev

v1.0.0

Published

<div align="center">

Downloads

2

Readme

ev

a tool for versioning, securing and easily sharing environment variables

Features

  • Version control - allows for storing environment variables securely in git
  • 🔑 Secure - uses a single secret to secure your variables
  • 🧑‍💻 Easy sharing - sharing the secret means sharing your variables
  • 🛠 Great DX - tools for easily managing variables

Getting started

Initializing

Install Node >= 14 and run:

npx ev

It will prompt you for a new secret key and create two new files:

  • .ev/vars - where your environment variables are encrypted and safely stored,
  • .ev/secret - your secret key, whose must not be version controlled

And add .ev/secret to .gitignore

You can install ev globally (so you wont have to prepend npx) by running,

npm install -g @henrycunh/ev

Commands

ev MY_KEY=VALUE OTHER_KEY=OTHER_VALUE

This will add the MY_KEY and OTHER_KEY variables, if the variables already exists, their value will be overrided

ev | source
# you can alternatively use
eval $(ev)

This will export every variable into the environment

You can test it by running

ev TEST=123 && ev | source && echo $TEST

This should print Added 1 variables. followed by 123.

ev rm MY_KEY OTHER_KEY

This will remove the MY_KEY and OTHER_KEY variables

ev ls

This will list all variables

ev ls MY_KEY

This will list the MY_KEY variable

ev change-secret

This will prompt for the old key and the new one, if the old key is correct, it will re-encrypt the variables with the new one

In case you mistype your secret, you can just run this to type the secret again

ev set-secret

This will prompt for the secret

You can append the option --env (or -e) on any command to specify a different environment

ev -e staging MY_KEY=VALUE_IN_STAGING

The variables for each environment is stored in a different file

ev load .env

All the variables on .env will be loaded into the default environment

ev change-secret -e production

Changes the default secret on the production environment

Using in your project

After initializing and setting a secret, you can just load from your previous .env file with the command ev load .env and run either ev | source or eval $(ev) to export the variables into the environment.

Passing a secret through a environment variable

In a CI environment, you want your secret to be passed through an environment variable set by your CI system. You can do this by setting the EV_SECRET variable

EV_SECRET=my-secret eval $(npx ev)

Javascript projects

You can add a pre script to your package.json file to load the variables into the environment before your development script runs. Here's an example:

{
  "scripts": {
    "predev": "eval $(ev)",
    "dev": "..."
  }
}

You can even create different scripts for different environments

{
  "scripts": {
    "predev:staging": "eval $(ev -e staging)",
    "dev:staging": "..."
  }
}