JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 203
  • Score
    100M100P100Q75266F
  • License MIT

Package Exports

  • next-exec
  • next-exec/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (next-exec) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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