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

dotenv-to-yaml

v0.1.1

Published

Convert your dotenv files to their YAML equivalent.

Downloads

2,078

Readme

dotenv-to-yaml

Convert your dotenv files to their YAML equivalent.

Motivations

I initially developed this package to easily deploy Google Cloud Functions because the gcloud CLI does not understand dotenv files.

Extracted from the gcloud functions deploy docs:

--env-vars-file=FILE_PATH

Path to a local YAML file with definitions for all environment variables. All existing environment variables will be removed before the new environment variables are added.

Installation

Install locally (inside a project where a package.json is defined):

npm install dotenv-to-yaml

Note: you may want to use the --dev flag if you are only interested in the CLI feature.

Usage

Command Line Interface

Global usage:

dotenv-to-yaml [source] [destination]

Transform a dotenv file to YAML one

Positionals:
  source       The source dotenv file or `-` if the file content is piped to
               STDIN.                                 [string] [default: ".env"]
  destination  The destination YAML file or `-` to pipe the conversion result to
               STDOUT.                           [string] [default: ".env.yaml"]

Piping from STDIN

dotenv-to-yaml supports piping the dotenv content through STDIN; the converted output will be sent to STDOUT.

Example:

dotenv-to-yaml < samples/bedrock.env

will print:

AUTH_KEY: qVQ9646_?j*46vlO^j$;cGY/|;4i7z%&&bk/O#rex[.72@*R8_{9h8#D$|8@7_Wj
SECURE_AUTH_KEY: SoHEtm!HO3M2r#Z$3l]PX}aSc-hyLq95m_w7oY=a]fOM4b[/Q^=L`MB^lb`qAU-y
LOGGED_IN_KEY: dt{MU>/B9YO.V)M#3Ho=QmJc4s:/WC58r%CZTrQkx7jpgRvrO@iDYo[COU8X*=C|
NONCE_KEY: '*#XT#t,y2ucBk87C;88;0(Cwq+zA1()WIwsR!P4TIzJQZPA2P$Saww8xQ(GDx_y]'
AUTH_SALT: .J2bEZQvDKMM%kWwdgXFf/q/&10c7AtSbl%NLH.3j.}.4.|MPdC,Tnp$:|i#sF)y
SECURE_AUTH_SALT: /DdIXg_TI|E`;/C#t24^>i[@WG/1SsnoQU*bfmdf#p9e%Zo(xe?b9CJ(tZD;:^o3
LOGGED_IN_SALT: c5AMtWe?Nut`]sVo5Sdw4:)N,togVS6L{IvRvCxi>;VJyz4xDE$&X#q4)JB<#LUH
NONCE_SALT: Nmfdg*9@x$tdb[TZj.1-p)(<ay]:k=:5u(lmH2bpi8]A|qAMm_AGajQ90ZQQI.f<

Specifying source and destination

dotenv-to-yaml .env .env.yaml

Node.js

const { dotenvToYAML } = require('dotenv-to-yaml');

ESM / TypeScript

import { dotenvToYAML } from 'dotenv-to-yaml';
// OR with default import:
import dotenvToYAML from 'dotenv-to-yaml';