# 🔨 Create env.example

A simple npm package to create a .env.example file from a .env file.

## 🎯 Introduction

When working with environment variables, it's common to have a `.env` file that contains sensitive information such as API keys or database credentials. However, when sharing your project with others or committing it to a version control system, you may want to exclude this sensitive information. That's where `.env.example` comes in!

## 🚀 Installation

```bash
# Install globally
npm install -g create-envexample

# Or use with npx
npx create-envexample
```

## 📝 Usage

To create a `.env.example` file from your `.env` file, simply run:

```bash
npx create-envexample
```

## ⚙️ How it works

The package performs these steps:

1. Reads your `.env` file
2. Filters out comment lines (starting with #)
3. Replaces sensitive values with empty placeholders
4. Creates a new `.env.example` file

## 💡 Example

**Your .env file:**

```env
DB_HOST=localhost
DB_USER=myuser
DB_PASSWORD=mypassword
API_KEY=1234567890
```

**Generated .env.example:**

```env
DB_HOST=
DB_USER=
DB_PASSWORD=
API_KEY=
```

## 🎯 Options

The following command-line options are available:

| Option | Alias | Description | Default |
|--------|-------|-------------|---------|
| `--output` | `-o` | Specify output file path | `.env.example` |
| `--sort` | - | Sort variables and comments alphabetically | `false` |
| `--no-comments` | - | Remove all comments from output | `false` |
| `--delimiter` | - | Specify custom delimiter | `=` |
| `--verbose` | - | Enable verbose mode for debugging | `false` |
| `--help` | `-h` | Show help information | - |

## 📚 Examples

**Basic usage:**
```bash
npx create-envexample
```

**Custom output path:**
```bash
npx create-envexample -o ./config/.env.template
```

**Sort variables:**
```bash
npx create-envexample --sort
```

**Remove comments:**
```bash
npx create-envexample --no-comments
```

**Use custom delimiter:**
```bash
npx create-envexample --delimiter :
```

**Combined options:**
```bash
npx create-envexample -o custom.env --sort --no-comments
```

## 🔍 Ignoring Variables

You can create a `.envignore` file to specify which environment variables should be excluded from the `.env.example` file:

```env
# .envignore
GENERATED_KEY
TEMP_TOKEN
```

## 🌟 Features

- Preserves comments from original .env file
- Supports custom output path
- Optional sorting of variables
- Configurable delimiter
- Ability to ignore specific variables
- Timestamp generation in output file

## 🤝 Contributing

Contributions are welcome! Feel free to:

- Fork the repository
- Create your feature branch
- Submit a pull request

## License

create-envexample is licensed under the ISC license
