Socket
Socket
Sign inDemoInstall

env-cmd

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

env-cmd - npm Package Compare versions

Comparing version 7.0.0 to 8.0.0

.npmignore

5

CHANGELOG.md
# Changelog
## 8.0.0
- ***BREAKING***: Stripe out spaces around the `key` and `value` in an env file. In order to include a beginning/ending space in an env var value, you need to surround the value in double or single quotes. `ENV = " Value"`
- **Bug**: Fixed some bugs around how the parent process and spawn processes are killed
- **Change**: Updated a number of core libraries: `cross-spawn`, `coveralls`, `istanbul -> nyc`, `mocha`, `proxyquire`, `sinon`, `standard`
## 7.0.0

@@ -4,0 +9,0 @@ - ***BREAKING***: The `.env` file path resolving has been changed to allow for absolute pathing, relative pathing, and `~` home directory pathing. Please

44

lib/index.js

@@ -9,2 +9,5 @@ 'use strict'

const envFilePathDefault = path.join(process.cwd(), '.env')
let sharedState = {
exitCalled: false
}

@@ -44,4 +47,10 @@ /**

})
process.on('SIGTERM', proc.kill.bind(proc, 'SIGTERM'))
proc.on('exit', process.exit)
// Handle a few special signals and then the general node exit event
// on both parent and spawned process
process.once('SIGINT', TerminateSpawnedProc.bind(sharedState, proc))
process.once('SIGTERM', TerminateSpawnedProc.bind(sharedState, proc))
process.once('exit', TerminateSpawnedProc.bind(sharedState, proc))
proc.on('exit', TerminateParentProcess)
return proc

@@ -134,3 +143,9 @@ }

// Note: match[1] is the full env=var line
matches[match[2]] = match[3]
const key = match[2].trim()
let value = match[3].trim() || ''
// remove any surrounding quotes
value = value.replace(/(^['"]|['"]$)/g, '')
matches[key] = value
}

@@ -293,2 +308,23 @@ return matches

/**
* Helper for terminating the spawned process
* @param {ProccessHandler} proc The spawned process handler
*/
function TerminateSpawnedProc (proc) {
if (!this.exitCalled) {
this.exitCalled = true
proc.kill('SIGTERM')
}
}
/**
* Helper for terminating the parent process
*/
function TerminateParentProcess () {
if (!this.exitCalled) {
this.exitCalled = true
process.exit(1)
}
}
process.on('uncaughtException', HandleUncaughtExceptions)

@@ -302,2 +338,4 @@

HandleUncaughtExceptions,
TerminateSpawnedProc,
TerminateParentProcess,
StripComments,

@@ -304,0 +342,0 @@ StripEmptyLines,

22

package.json
{
"name": "env-cmd",
"version": "7.0.0",
"version": "8.0.0",
"description": "Executes a command using the envs in the provided env file",
"main": "lib/index.js",
"engines" : {
"node" : ">=4.0.0"
"engines": {
"node": ">=4.0.0"
},

@@ -14,3 +14,3 @@ "bin": {

"test": "mocha",
"test-cover": "istanbul cover node_modules/.bin/_mocha -- -R spec",
"test-cover": "nyc --reporter=lcov --reporter=text npm test",
"test-lint": "standard",

@@ -45,13 +45,13 @@ "coveralls": "coveralls < coverage/lcov.info",

"dependencies": {
"cross-spawn": "^5.0.1"
"cross-spawn": "^6.0.5"
},
"devDependencies": {
"better-assert": "^1.0.2",
"coveralls": "^2.11.12",
"istanbul": "^0.4.4",
"mocha": "^3.0.2",
"proxyquire": "^1.7.10",
"sinon": "^3.3.0",
"standard": "^10.0.0"
"coveralls": "^3.0.0",
"mocha": "^5.0.4",
"nyc": "^11.6.0",
"proxyquire": "^2.0.1",
"sinon": "^4.4.6",
"standard": "^11.0.1"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc