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

yargs-command-env

v0.0.0

Published

Yargs command for managing environment files

Downloads

7

Readme

yargs-command-env

Richard Wen
[email protected]

Yargs command for managing environment files

npm version Build Status Coverage Status npm GitHub license Donate Twitter

Install

  1. Install Node.js
  2. Install yargs-command-env via npm
npm install --save yargs-command-env

For the latest developer version, see Developer Install.

Usage

Create a file named bin.js with the following contents:

var yargs = require('yargs');

// (env) Load command with path to env file
// Replace './path/to/.env' with your .env file
var env = require('yargs-command-env')({file: './path/to/.env'});

// (yargs) Add command to manage env file
var argv = yargs.command(env).argv;

Display help options for bin.js using node:

node bin.js env help

The following will be displayed:

bin env <task> [key] [value] [--env]

manage default env

<task> is one of:

* set
* delete
* view
* clear
* reset

Set variable to value
> set [key] [value]

Remove default variable
> delete [key]

View default variable
> view

Clear default variable
> clear

Reset default variable
> reset

Manage other env file
> set [key] [value] --env other.env
> delete [key] --env other.env
> view --env other.env
> clear --env other.env
> reset --env other.env

Default env files are managed with the commands below:

node bin.js env view
node bin.js env clear
node bin.js env reset
node bin.js env set key value
node bin.js env delete key

Other env files are managed by passing a path in the option --env:

node bin.js env view --env .env
node bin.js env clear --env .env
node bin.js env reset --env .env
node bin.js env set key value --env .env
node bin.js env delete key --env .env

See Documentation for more details.

Contributions

Report Contributions

Reports for issues and suggestions can be made using the issue submission interface.

When possible, ensure that your submission is:

  • Descriptive: has informative title, explanations, and screenshots
  • Specific: has details of environment (such as operating system and hardware) and software used
  • Reproducible: has steps, code, and examples to reproduce the issue

Code Contributions

Code contributions are submitted via pull requests:

  1. Ensure that you pass the Tests
  2. Create a new pull request
  3. Provide an explanation of the changes

A template of the code contribution explanation is provided below:

## Purpose

The purpose can mention goals that include fixes to bugs, addition of features, and other improvements, etc.

## Description

The description is a short summary of the changes made such as improved speeds or features, and implementation details.

## Changes

The changes are a list of general edits made to the files and their respective components.
* `file_path1`:
	* `function_module_etc`: changed loop to map
	* `function_module_etc`: changed variable value
* `file_path2`:
	* `function_module_etc`: changed loop to map
	* `function_module_etc`: changed variable value

## Notes

The notes provide any additional text that do not fit into the above sections.

For more information, see Developer Install and Implementation.

Developer Notes

Developer Install

Install the latest developer version with npm from github:

npm install git+https://github.com/rrwen/yargs-command-env

Install from git cloned source:

  1. Ensure git is installed
  2. Clone into current path
  3. Install via npm
git clone https://github.com/rrwen/yargs-command-env
cd yargs-command-env
npm install

Tests

  1. Clone into current path git clone https://github.com/rrwen/yargs-command-env
  2. Enter into folder cd yargs-command-env
  3. Ensure devDependencies are installed and available
  4. Run tests
  5. Results are saved to tests/log with each file corresponding to a version tested
npm install
npm test

Documentation

Use documentationjs to generate html documentation in the docs folder:

npm run docs

See JSDoc style for formatting syntax.

Upload to Github

  1. Ensure git is installed
  2. Inside the yargs-command-env folder, add all files and commit changes
  3. Push to github
git add .
git commit -a -m "Generic update"
git push

Upload to npm

  1. Update the version in package.json
  2. Run tests and check for OK status
  3. Generate documentation
  4. Login to npm
  5. Publish to npm
npm test
npm run docs
npm login
npm publish

Implementation

The module yargs-command-env uses the following npm packages for its implementation:

npm | Purpose --- | --- yargs| Manage command line arguments and options envfile | Parse and stringify .env files and objects fs | Read and write .env files

  yargs   <-- CLI arguments
    |
 envfile  <-- Parse and stringify .env files
    |
   fs     <-- Read and write .env files