Comparing version 7.0.0 to 8.0.0
# 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 |
@@ -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, |
{ | ||
"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" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
135150
11
3307
1
+ Addedcross-spawn@6.0.5(transitive)
+ Addednice-try@1.0.5(transitive)
+ Addedpath-key@2.0.1(transitive)
+ Addedsemver@5.7.2(transitive)
- Removedcross-spawn@5.1.0(transitive)
- Removedlru-cache@4.1.5(transitive)
- Removedpseudomap@1.0.2(transitive)
- Removedyallist@2.1.2(transitive)
Updatedcross-spawn@^6.0.5