npm package: @jugalp6103/envor
Description: Universal environment variable manager for js projects
Author: Jugal Patel
Latest version: 1.0.4

# Envor

<div align="center">

**Universal environment variable manager for any project**

[![npm version](https://img.shields.io/npm/v/@jugalp6103/envor.svg)](https://www.npmjs.com/package/@jugalp6103/envor)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Node.js Version](https://img.shields.io/badge/node-%3E%3D16.0.0-brightgreen)](https://nodejs.org/)

</div>

---

## 🚀 Features

- **Simple CLI** - Manage environment variables with simple commands
- **Multiple .env files** - Support for `.env`, `.env.local`, `.env.production`, etc.
- **Interactive Setup** - Beautiful interactive initialization
- **Smart Defaults** - Set and switch between different environment files
- **Validation** - Validate your environment files before deployment
- **Example Generation** - Automatically generate `.env.example` files
- **Zero Config** - Works with any project (Node.js, Python, PHP, etc.)

## 📦 Installation

```bash
npm install -g envor
```

Or install it locally in your project:

```bash
npm install envor --save-dev
```

## 🎯 Quick Start

### 1. Initialize Envor in Your Project

```bash
envor init
```

This will help you set up your environment files with an interactive prompt.

### 2. Set Environment Variables

```bash
# Set a variable
envor .env SET API_KEY abc123

# Or use the short form with equals sign
envor .env SET DATABASE_URL="postgresql://localhost/mydb"

# Set multiple variables at once
envor .env SET KEY1=value1 KEY2=value2

# Using default file (shortcut: 'd')
envor d SET PORT 3000
```

### 3. List Variables

```bash
# List all variables in a file
envor .env LIST

# List from default file
envor d LIST
```

### 4. Delete Variables

```bash
envor .env RM API_KEY
```

### 5. Copy Variables Between Files

```bash
# Copy from dev.env to prod.env
envor prod.env COPY dev.env
```

### 6. Generate .env.example

```bash
envor .env GENERATE-EXAMPLE
```

### 7. Validate Environment File

```bash
envor .env VALIDATE
```

## 📚 Command Reference

### Basic Commands

| Command | Description |
|---------|-------------|
| `envor init` | Initialize envor in your project |
| `envor files` | List all .env files in the project |
| `envor default show` | Show current default environment file |
| `envor default set <file>` | Set default environment file |
| `envor default create <file>` | Create and set new environment file as default |

### Environment File Operations

| Action | Description | Example |
|--------|-------------|---------|
| `SET` | Set or update a variable | `envor .env SET KEY VALUE` |
| `LIST` | List all variables | `envor .env LIST` |
| `RM` | Delete a variable | `envor .env RM KEY` |
| `COPY` | Copy variables from another file | `envor dest.env COPY src.env` |
| `GENERATE-EXAMPLE` | Create `.env.example` file | `envor .env GENERATE-EXAMPLE` |
| `VALIDATE` | Validate environment file | `envor .env VALIDATE` |

## 🎨 Examples

### Initializing Multiple Environments

```bash
# Initialize envor
envor init

# Create development environment
envor default create .env.development

# Create production environment
envor default create .env.production

# Set development variables
envor .env.development SET DEBUG true
envor .env.development SET API_URL http://localhost:3000

# Set production variables
envor .env.production SET DEBUG false
envor .env.production SET API_URL https://api.example.com

# Switch between environments
envor default set .env.development  # For local development
envor default set .env.production   # For production
```

### Managing Variables

```bash
# Add a new variable
envor .env SET NODE_ENV production

# Add a variable with spaces (properly quoted)
envor .env SET APP_NAME "My Awesome App"

# Update an existing variable
envor .env SET NODE_ENV development

# View all variables
envor .env LIST

# Remove a variable
envor .env RM NODE_ENV
```

### Working with Default File

```bash
# Set a default file
envor default set .env.local

# Use shorthand 'd' to reference default
envor d SET API_KEY secret123
envor d LIST
envor d RM API_KEY

# Show current default
envor default show
```

## 🔧 Configuration

Envor stores its configuration in `.vor.json` in your project root:

```json
{
  "defaultEnvFile": ".env"
}
```

This file is automatically created and managed by envor. You can edit it manually if needed. Please delete the file or add it into .gitignore.

## 🛠️ Development

```bash
# Clone the repository
git clone https://github.com/DankJugal/envor.git
cd envor

# Install dependencies
npm install

# Build the project
npm run build

# Development mode (watch)
npm run dev
```

## 📝 Requirements

- Node.js >= 16.0.0

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## 👨‍💻 Author

**Jugal Patel**

- Project Link: [https://github.com/DankJugal/envor](https://github.com/DankJugal/envor)
- This library is my side-project. Please feel free to guide me or suggesting me what can be done further.
- NPM Package: [https://www.npmjs.com//@jugalp6103/envor](https://www.npmjs.com/package/@jugalp6103/envor)

## 🙏 Acknowledgments

- Built with [Commander.js](https://github.com/tj/commander.js) for CLI parsing
- Colors powered by [Chalk](https://github.com/chalk/chalk)
- Interactive prompts by [Inquirer](https://github.com/SBoudrias/Inquirer.js)