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

@rosesoft/dev-env-manager

v0.1.20

Published

Handle environment settings for local development.

Downloads

10

Readme

dev-env-manager

npm version License: MIT

dev-env-manager simplifies the setup of development environments by downloading and uploading .env files from systems you're already using for development, making it easy to share them with other developers.


If you're frustrated by the process of checking out a repository and then having to figure out which developer has the correct environment settings on their machine, only to wait until they’re available to send the files via chat or email - I get it, that’s annoying.

The goal of this tool is simple: clone a repository, run a single command, and you're ready to go.

This is a very simple solution that is easy to set up and a better alternative to sending .env files via email. If you're looking for a more robust, enterprise-grade solution, consider using:

Demo

dev-env-manager Demo

Currently supported stores:

  • Kubernetes (K8s) Secrets

Security Note: Kubernetes Secrets are not the most secure storage for sensitive information. Only individuals who need access to these secrets should have access to the cluster. Proper role-based access control (RBAC) and encryption should be employed to secure the secrets.

Planned features:

  • AWS Secrets Manager
  • Show the diff between local and remote files

Contributions are welcome!


Installation

Install the tool with Yarn or NPM:

yarn add @rosesoft/dev-env-manager
# or
npm install @rosesoft/dev-env-manager

Setup

Create a file called environment.config.json in the root of your repository.

Example:

environment.config.json
{
  "environmentSettings": {
    "kubeConfigPath": ".kube/config",
    "context": "colima",
    "namespace": "dev-namespace",
    "secrets": [
      {
        "name": "dev-service-a",
        "localPath": "sample-project/service-a/local.env"
      },
      {
        "name": "dev-service-a-container",
        "localPath": "sample-project/service-a/docker/container.env"
      },
      {
        "name": "dev-service-b",
        "localPath": "sample-project/service-b/.env"
      }
    ]
  }
}

Add the following scripts to your package.json:

"scripts": {
  "upload-env-files": "dev-env-manager --upload",
  "download-env-files": "dev-env-manager --download",
}

Please note that for the sample project, I am using the following scripts:

"scripts": {
  "download-env-files": "bin/start.sh --download",
  "upload-env-files": "bin/start.sh --upload"
}

This is because I cannot use my NPM module within itself. For typical usage in other projects, you should be able to use the dev-env-manager command via NPM.

Usage

You can now run the following commands:

npm run upload-env-files
npm run download-env-files
# or
yarn upload-env-files
yarn download-env-files

Sample Project

You can check the sample project in the ./sample-project directory.

The environment.config.json file must be in the root of the repository. You need a running Kubernetes cluster.

If you don't have one, you can use Colima:

brew install docker docker-buildx kubectl colima

colima start
colima kubernetes start

kubectl create namespace dev-namespace

Upload .env files:

Create some .env files:

  • sample-project/service-a/local.env
  • sample-project/service-a/docker/container.env
  • sample-project/service-b/.env

Run the following command:

npm run upload-env-files
# or
yarn upload-env-files

You will see output like this:

$ yarn upload-env-files
yarn run v1.22.22
$ ./bin/start.sh --upload
Config loaded.
Current context set to: colima, Namespace set to: dev-namespace
------------------------------------------------------
-          Uploading Environment Settings            -
------------------------------------------------------
? Select the files you want to upload to k8s: (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
❯◯ sample-project/service-a/local.env
 ◯ sample-project/service-a/docker/container.env
 ◯ sample-project/service-b/.env

Select the files you want to upload and press Enter.

Delete the local .env files:

rm sample-project/service-a/local.env
rm sample-project/service-a/docker/container.env
rm sample-project/service-b/.env

Download the .env files:

Run the following command:

npm run download-env-files
# or
yarn download-env-files

You will see output like this:

$ yarn download-env-files
yarn run v1.22.22
$ ./bin/start.sh --download
Config loaded.
Current context set to: colima, Namespace set to: dev-namespace
------------------------------------------------------
-          Downloading Environment Settings          -
------------------------------------------------------
Downloading secret:
- dev-service-a
- to store content to file: sample-project/service-a/local.env
Downloaded secret dev-service-a to sample-project/service-a/local.env
Downloading secret:
- dev-service-a-container
- to store content to file: sample-project/service-a/docker/container.env
Downloaded secret dev-service-a-container to sample-project/service-a/docker/container.env
Downloading secret:
- dev-service-b
- to store content to file: sample-project/service-b/.env
Downloaded secret dev-service-b to sample-project/service-b/.env
✨  Done in 0.92s.