🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

@hitorisensei/per-env

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hitorisensei/per-env

Clean up your package.json with per-env npm scripts

latest
Source
npmnpm
Version
2.1.2
Version published
Maintainers
1
Created
Source

per-env

Clean up your package.json with per-NODE_ENV npm scripts.

travis build version downloads MIT License

Features

  • Call npm stages based on NODE_ENV (defaults to development)

Changes from 1.x

  • BREAKING Dropped support for per-env environment variables in package.json.
    This change was made to simplify the implementation and to avoid potential conflicts with other packages that set environment variables (dot-env, etc.).
  • Added support for different script runners (bun, yarn, etc).
    Previously all scripts were run with npm, regardless of the runner used to run per-env.
  • Added tests.

Example

{
  "scripts": {
    // If NODE_ENV is missing, defaults to "development".
    "build": "per-env",

    "build:development": "webpack -d --watch",
    "build:staging": "webpack -p",
    "build:production": "webpack -p",

    // Deployment won't work unless NODE_ENV=production is explicitly set.
    "deploy": "per-env",

    "predeploy:production": "docker build -t ${DOCKER_USER}/${DOCKER_PROJECT} .",
    "deploy:production": "docker push ${DOCKER_USER}/${DOCKER_PROJECT}",

    // "npm start" is _the_ command to start the server across all environments.
    "start": "per-env",

    "start:development": "npm run build:development",

    "prestart:production": "npm run build",
    "start:production": "start-cluster build/server/server.js",

    "prestart:staging": "npm run build",
    "start:staging": "start-cluster build/server/server.js",
  }
}

Installation

$ npm install --save per-env

License

MIT License 2016 © Eric Clemmons

Keywords

npm

FAQs

Package last updated on 20 Feb 2024

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