Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

next-env-cmd

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-env-cmd

Load .env files using @next/env module

latest
Source
npmnpm
Version
0.3.0
Version published
Weekly downloads
51
168.42%
Maintainers
1
Weekly downloads
 
Created
Source

next-env-cmd

CLI command for loading .env files using @next/env and spawn process using cross-spawn modules.

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

Install

$ npm install next-env-cmd

Usage

Use Next.js Environment Variables filename format.

/.env
/.env.development
/.env.development.local
/.env.test
/.env.test.local

And then in package.json.

{
  "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.

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

Keywords

env

FAQs

Package last updated on 03 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts