mirror of
https://github.com/toddbluhm/env-cmd.git
synced 2025-12-08 18:23:33 +00:00
chore(package): update devDependencies
- fix new lint errors - fix missing code coverage - update ignore files
This commit is contained in:
parent
f92f8b51ff
commit
a253a62232
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,6 +10,7 @@ package-lock.json
|
||||
|
||||
# Code Editor directory
|
||||
.vscode
|
||||
.idea
|
||||
|
||||
# Ignore compiled dist/tests
|
||||
dist/test
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
.DS_Store
|
||||
.nyc_output
|
||||
.vscode
|
||||
.idea
|
||||
coverage/
|
||||
node_modules/
|
||||
src/
|
||||
|
||||
12
dist/get-env-vars.js
vendored
12
dist/get-env-vars.js
vendored
@ -51,7 +51,7 @@ async function getEnvFile({ filePath, fallback, verbose }) {
|
||||
}
|
||||
catch (e) { }
|
||||
}
|
||||
const error = `Failed to find .env file at default paths: ${ENV_FILE_DEFAULT_LOCATIONS}`;
|
||||
const error = `Failed to find .env file at default paths: [${ENV_FILE_DEFAULT_LOCATIONS.join(',')}]`;
|
||||
if (verbose === true) {
|
||||
console.info(error);
|
||||
}
|
||||
@ -64,7 +64,7 @@ async function getRCFile({ environments, filePath, verbose }) {
|
||||
try {
|
||||
const env = await parse_rc_file_1.getRCFileVars({ environments, filePath });
|
||||
if (verbose === true) {
|
||||
console.info(`Found environments: ${environments} for .rc file at path: ${filePath}`);
|
||||
console.info(`Found environments: [${environments.join(',')}] for .rc file at path: ${filePath}`);
|
||||
}
|
||||
return env;
|
||||
}
|
||||
@ -76,7 +76,7 @@ async function getRCFile({ environments, filePath, verbose }) {
|
||||
}
|
||||
if (e.name === 'EnvironmentError') {
|
||||
if (verbose === true) {
|
||||
console.info(`Failed to find environments: ${environments} for .rc file at path: ${filePath}`);
|
||||
console.info(`Failed to find environments: [${environments.join(',')}] for .rc file at path: ${filePath}`);
|
||||
}
|
||||
}
|
||||
throw e;
|
||||
@ -87,13 +87,13 @@ async function getRCFile({ environments, filePath, verbose }) {
|
||||
try {
|
||||
const env = await parse_rc_file_1.getRCFileVars({ environments, filePath: path });
|
||||
if (verbose === true) {
|
||||
console.info(`Found environments: ${environments} for default .rc file at path: ${path}`);
|
||||
console.info(`Found environments: [${environments.join(',')}] for default .rc file at path: ${path}`);
|
||||
}
|
||||
return env;
|
||||
}
|
||||
catch (e) {
|
||||
if (e.name === 'EnvironmentError') {
|
||||
const errorText = `Failed to find environments: ${environments} for .rc file at path: ${path}`;
|
||||
const errorText = `Failed to find environments: [${environments.join(',')}] for .rc file at path: ${path}`;
|
||||
if (verbose === true) {
|
||||
console.info(errorText);
|
||||
}
|
||||
@ -101,7 +101,7 @@ async function getRCFile({ environments, filePath, verbose }) {
|
||||
}
|
||||
}
|
||||
}
|
||||
const errorText = `Failed to find .rc file at default paths: ${RC_FILE_DEFAULT_LOCATIONS}`;
|
||||
const errorText = `Failed to find .rc file at default paths: [${RC_FILE_DEFAULT_LOCATIONS.join(',')}]`;
|
||||
if (verbose === true) {
|
||||
console.info(errorText);
|
||||
}
|
||||
|
||||
2
dist/parse-rc-file.js
vendored
2
dist/parse-rc-file.js
vendored
@ -48,7 +48,7 @@ async function getRCFileVars({ environments, filePath }) {
|
||||
}
|
||||
});
|
||||
if (!environmentFound) {
|
||||
const environmentError = new Error(`Failed to find environments ${environments} at .rc file location: ${absolutePath}`);
|
||||
const environmentError = new Error(`Failed to find environments [${environments.join(',')}] at .rc file location: ${absolutePath}`);
|
||||
environmentError.name = 'EnvironmentError';
|
||||
throw environmentError;
|
||||
}
|
||||
|
||||
9
dist/signal-termination.js
vendored
9
dist/signal-termination.js
vendored
@ -18,7 +18,9 @@ class TermSignals {
|
||||
this._removeProcessListeners();
|
||||
if (!this._exitCalled) {
|
||||
if (this.verbose) {
|
||||
console.info(`Parent process exited with signal: ${signal}. Terminating child process...`);
|
||||
console.info('Parent process exited with signal: ' +
|
||||
signal.toString() +
|
||||
'. Terminating child process...');
|
||||
}
|
||||
// Mark shared state so we do not run into a signal/exit loop
|
||||
this._exitCalled = true;
|
||||
@ -47,8 +49,9 @@ class TermSignals {
|
||||
this._removeProcessListeners();
|
||||
if (!this._exitCalled) {
|
||||
if (this.verbose) {
|
||||
console.info(`Child process exited with code: ${code} and signal: ${signal}. ` +
|
||||
'Terminating parent process...');
|
||||
console.info(`Child process exited with code: ${((code !== null && code !== void 0 ? code : '')).toString()} and signal:` +
|
||||
((signal !== null && signal !== void 0 ? signal : '')).toString() +
|
||||
'. Terminating parent process...');
|
||||
}
|
||||
// Mark shared state so we do not run into a signal/exit loop
|
||||
this._exitCalled = true;
|
||||
|
||||
11
package.json
11
package.json
@ -53,16 +53,16 @@
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.0.0",
|
||||
"@types/cross-spawn": "^6.0.0",
|
||||
"@types/mocha": "^5.0.0",
|
||||
"@types/mocha": "^7.0.0",
|
||||
"@types/node": "^12.0.0",
|
||||
"@types/sinon": "^7.0.0",
|
||||
"chai": "^4.0.0",
|
||||
"coveralls": "^3.0.0",
|
||||
"mocha": "^6.0.0",
|
||||
"mocha": "^7.0.0",
|
||||
"nyc": "^15.0.0",
|
||||
"sinon": "^8.0.0",
|
||||
"ts-node": "^8.0.0",
|
||||
"ts-standard": "^3.0.0",
|
||||
"ts-standard": "^4.0.0",
|
||||
"typescript": "^3.7.0"
|
||||
},
|
||||
"nyc": {
|
||||
@ -87,5 +87,10 @@
|
||||
"ignore": [
|
||||
"dist"
|
||||
]
|
||||
},
|
||||
"greenkeeper": {
|
||||
"ignore": [
|
||||
"@types/node"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ export async function getEnvFile (
|
||||
} catch (e) { }
|
||||
}
|
||||
|
||||
const error = `Failed to find .env file at default paths: ${ENV_FILE_DEFAULT_LOCATIONS}`
|
||||
const error = `Failed to find .env file at default paths: [${ENV_FILE_DEFAULT_LOCATIONS.join(',')}]`
|
||||
if (verbose === true) {
|
||||
console.info(error)
|
||||
}
|
||||
@ -69,7 +69,7 @@ export async function getRCFile (
|
||||
try {
|
||||
const env = await getRCFileVars({ environments, filePath })
|
||||
if (verbose === true) {
|
||||
console.info(`Found environments: ${environments} for .rc file at path: ${filePath}`)
|
||||
console.info(`Found environments: [${environments.join(',')}] for .rc file at path: ${filePath}`)
|
||||
}
|
||||
return env
|
||||
} catch (e) {
|
||||
@ -80,7 +80,7 @@ export async function getRCFile (
|
||||
}
|
||||
if (e.name === 'EnvironmentError') {
|
||||
if (verbose === true) {
|
||||
console.info(`Failed to find environments: ${environments} for .rc file at path: ${filePath}`)
|
||||
console.info(`Failed to find environments: [${environments.join(',')}] for .rc file at path: ${filePath}`)
|
||||
}
|
||||
}
|
||||
throw e
|
||||
@ -92,12 +92,12 @@ export async function getRCFile (
|
||||
try {
|
||||
const env = await getRCFileVars({ environments, filePath: path })
|
||||
if (verbose === true) {
|
||||
console.info(`Found environments: ${environments} for default .rc file at path: ${path}`)
|
||||
console.info(`Found environments: [${environments.join(',')}] for default .rc file at path: ${path}`)
|
||||
}
|
||||
return env
|
||||
} catch (e) {
|
||||
if (e.name === 'EnvironmentError') {
|
||||
const errorText = `Failed to find environments: ${environments} for .rc file at path: ${path}`
|
||||
const errorText = `Failed to find environments: [${environments.join(',')}] for .rc file at path: ${path}`
|
||||
if (verbose === true) {
|
||||
console.info(errorText)
|
||||
}
|
||||
@ -106,7 +106,7 @@ export async function getRCFile (
|
||||
}
|
||||
}
|
||||
|
||||
const errorText = `Failed to find .rc file at default paths: ${RC_FILE_DEFAULT_LOCATIONS}`
|
||||
const errorText = `Failed to find .rc file at default paths: [${RC_FILE_DEFAULT_LOCATIONS.join(',')}]`
|
||||
if (verbose === true) {
|
||||
console.info(errorText)
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ export async function getRCFileVars (
|
||||
|
||||
if (!environmentFound) {
|
||||
const environmentError = new Error(
|
||||
`Failed to find environments ${environments} at .rc file location: ${absolutePath}`
|
||||
`Failed to find environments [${environments.join(',')}] at .rc file location: ${absolutePath}`
|
||||
)
|
||||
environmentError.name = 'EnvironmentError'
|
||||
throw environmentError
|
||||
|
||||
@ -21,7 +21,10 @@ export class TermSignals {
|
||||
this._removeProcessListeners()
|
||||
if (!this._exitCalled) {
|
||||
if (this.verbose) {
|
||||
console.info(`Parent process exited with signal: ${signal}. Terminating child process...`)
|
||||
console.info(
|
||||
'Parent process exited with signal: ' +
|
||||
signal.toString() +
|
||||
'. Terminating child process...')
|
||||
}
|
||||
// Mark shared state so we do not run into a signal/exit loop
|
||||
this._exitCalled = true
|
||||
@ -51,8 +54,9 @@ export class TermSignals {
|
||||
if (!this._exitCalled) {
|
||||
if (this.verbose) {
|
||||
console.info(
|
||||
`Child process exited with code: ${code} and signal: ${signal}. ` +
|
||||
'Terminating parent process...'
|
||||
`Child process exited with code: ${(code ?? '').toString()} and signal:` +
|
||||
(signal ?? '').toString() +
|
||||
'. Terminating parent process...'
|
||||
)
|
||||
}
|
||||
// Mark shared state so we do not run into a signal/exit loop
|
||||
|
||||
@ -244,6 +244,20 @@ describe('signal-termination', (): void => {
|
||||
assert.equal(logInfoStub.callCount, 1)
|
||||
})
|
||||
|
||||
it(
|
||||
'should print parent process terminated to info for verbose when ' +
|
||||
'code and signal are undefined',
|
||||
(): void => {
|
||||
sandbox.restore()
|
||||
setup(true)
|
||||
logInfoStub = sandbox.stub(console, 'info')
|
||||
assert.notOk(term._exitCalled)
|
||||
term.handleTermSignals(proc)
|
||||
procOnStub.args[0][1](undefined, null)
|
||||
assert.equal(logInfoStub.callCount, 1)
|
||||
}
|
||||
)
|
||||
|
||||
it('should not terminate parent process if parent process already terminating', (): void => {
|
||||
assert.notOk(term._exitCalled)
|
||||
term.handleTermSignals(proc)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user