1.0.0 • Published 4 months ago

next-exec v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

next-exec

About

Get environment variables similar to Next.js from .env file, etc. and execute commands

Usage

Usage: next-exec [-c <environment>] -- [command]
  -c [environment]    development , production , test , etc…
                      default: process.env.NODE_ENV ?? development
                      https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables
  command             Commands to execute

Example

next-exec any-command

next-exec -c production -- any-command

Operation details

Load environment variables according to the contents of the VercelDocument.

const getEnvFiles = (node_env: string) => {
  return [
    `.env.${node_env}.local`,
    node_env !== "test" ? ".env.local" : [],
    `.env.${node_env}`,
    ".env",
  ].flat();
};

To use from within the program code

import { loadNextEnv } from "next-exec";

loadNextEnv(); // Set environment variables
import { loadNextEnv } from "next-exec";

loadNextEnv("production"); // Set the "production" environment variable
1.0.0

4 months ago

0.0.5

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago