# auto-update-env

> Update your .env file automatically

Latest version **1.0.1** (published 2020-04-15) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install auto-update-env
pnpm add auto-update-env
yarn add auto-update-env
bun add auto-update-env
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-04-15 |
| First published | 2018-11-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 5.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jonathan Christianto |
| Maintainers | jochristianto |
| Keywords | auto, update, env |

## Links

- npm: https://www.npmjs.com/package/auto-update-env
- Repository: https://github.com/jochristianto/auto-update-env
- Homepage: https://github.com/jochristianto/auto-update-env#readme
- Issues: https://github.com/jochristianto/auto-update-env/issues
- npm.io page: https://npm.io/package/auto-update-env

## Dependencies (3)

- [fs](https://npm.io/package/fs.md) ^0.0.1-security
- [dotenv](https://npm.io/package/dotenv.md) ^6.1.0
- [consola](https://npm.io/package/consola.md) ^2.11.3

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2020-04-15
- 1.0.0 — 2020-03-11
- 0.0.5 — 2018-11-29
- 0.0.4 — 2018-11-28
- 0.0.3 — 2018-11-27
- 0.0.2 — 2018-11-27
- 0.0.1 — 2018-11-27

## README

# auto-update-env
![License](https://img.shields.io/npm/l/auto-update-env?color=blue&label=License)
[![NPM](https://img.shields.io/npm/v/auto-update-env?color=blue&label=NPM%20Package)](https://www.npmjs.com/package/auto-update-env)
![Downloads](https://img.shields.io/npm/dw/auto-update-env?color=blue&label=Downloads)


## Installation

``` bash
# If you are using Yarn
$ yarn add auto-update-env --dev

# If you are using NPM
$ npm install auto-update-env --save-dev
``` 

## Usage

> To make sure that this module run properly, make sure you add the required files beforehand.

1. Create a file `envcheck.js` in your root directory.

    ``` bash
    # Load the package
    const aue = require('auto-update-env');

    # (Optional) Check whether the command include auto-add command
    const flag =  process.argv.includes('-f') || process.argv.includes('--fix');

    # In this case, .env.sample is the source file and
    # .env is the target file. Please update it accordingly.
    aue.compare(flag, '.env.sample', '.env');
    ```

2. Update your scripts in your `package.json` file to meet your requirement, for example:
    ``` bash
    "scripts": {
      "envcheck": "node envcheck.js",
    },
    ```

    Once added, you can simply call it using `yarn envcheck` or `npm run envcheck`.

## Options

| Flag     | Description | Usage Example |
| -------- | ----------- | ------------- |
| `--fix` | Automatically add the missing variable to your current .env | `yarn envcheck --fix` |
| `-f` | Shortcode for `--fix` | `yarn envcheck -f` |

## Version History
| Version   | Description |
| --------- | ----------- |
| 1.0.0     | Includes update to the code implementation. Now you can leave the default filenames empty. The label on the added keys are now changed from `[auto-update-env]` to `[aue]` followed by local time. |
| 0.0.5     | Added the UTC+0700 time to the label of the newly added keys. |

---
_Source: https://npm.io/package/auto-update-env · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
