# next-env-cmd

> Load .env files using @next/env module

Latest version **0.3.0** (published 2022-12-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install next-env-cmd
pnpm add next-env-cmd
yarn add next-env-cmd
bun add next-env-cmd
```

Provides the commands `nexenv`, `next-env-cmd`.

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2022-12-03 |
| First published | 2022-10-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 8.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | RhaldKhein |
| Maintainers | rhaldkhein |
| Keywords | env, next, cmd, cli, file |

## Links

- npm: https://www.npmjs.com/package/next-env-cmd
- Repository: https://rhaldkhein@github.com/rhaldkhein/next-env-cmd
- Homepage: https://github.com/rhaldkhein/next-env-cmd#readme
- Issues: https://github.com/rhaldkhein/next-env-cmd/issues
- npm.io page: https://npm.io/package/next-env-cmd

## Dependencies (3)

- [@next/env](https://npm.io/package/@next/env.md) ^13.0.6
- [commander](https://npm.io/package/commander.md) ^9.4.1
- [cross-spawn](https://npm.io/package/cross-spawn.md) ^7.0.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

- 0.3.0 (latest) — 2022-12-03
- 0.2.2 — 2022-12-02
- 0.2.1 — 2022-10-22
- 0.2.0 — 2022-10-22
- 0.1.1 — 2022-10-15
- 0.1.0 — 2022-10-15

## README

# next-env-cmd

CLI command for loading .env files using [`@next/env`](https://nextjs.org/docs/basic-features/environment-variables) and spawn process using [`cross-spawn`](https://github.com/moxystudio/node-cross-spawn) modules.

**Note:** This is a standalone command and can be used without installing Next.js framework.

### Install

```sh
$ npm install next-env-cmd
```

### Usage

Use [Next.js Environment Variables](https://nextjs.org/docs/basic-features/environment-variables) filename format.

```txt
/.env
/.env.development
/.env.development.local
/.env.test
/.env.test.local
```

And then in `package.json`.
```js
{
  "script": {
    // defaults to load development env vars
    "dev": "next-env-cmd node start.js",
    // load production env vars in home directory
    "start": "NODE_ENV=production next-env-cmd -d ~/ node start.js",
    // load test env vars for testing (using alias "nexenv")
    "test": "NODE_ENV=test nexenv jest"
  }
}
```

Additional command options.

```txt
Usage: next-env-cmd [options] <command> [...args]

Examples:
  $ next-env-cmd node start.js          # load .env files in CWD
  $ next-env-cmd -d ~/ node start.js    # load .env files in ~/
  $ nexenv -p ../ node start.js         # alias shorthand command

Options:
  -v, --version        output the version number
  -d, --dir [path]     Custom env directory path (default: "./")
  -p, --parent [path]  Parent env directory path to be merged as defaults
  -h, --help           display help for command
```

### License

MIT

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