1.0.0 • Published 1 year ago

next-exec v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year 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

1 year ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago