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
|
# Code Editor directory
|
||||||
.vscode
|
.vscode
|
||||||
|
.idea
|
||||||
|
|
||||||
# Ignore compiled dist/tests
|
# Ignore compiled dist/tests
|
||||||
dist/test
|
dist/test
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
.nyc_output
|
.nyc_output
|
||||||
.vscode
|
.vscode
|
||||||
|
.idea
|
||||||
coverage/
|
coverage/
|
||||||
node_modules/
|
node_modules/
|
||||||
src/
|
src/
|
||||||
test/
|
test/
|
||||||
*.yml
|
*.yml
|
||||||
tsconfig.json
|
tsconfig.json
|
||||||
tsconfig.eslint.json
|
tsconfig.eslint.json
|
||||||
|
|||||||
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) { }
|
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) {
|
if (verbose === true) {
|
||||||
console.info(error);
|
console.info(error);
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ async function getRCFile({ environments, filePath, verbose }) {
|
|||||||
try {
|
try {
|
||||||
const env = await parse_rc_file_1.getRCFileVars({ environments, filePath });
|
const env = await parse_rc_file_1.getRCFileVars({ environments, filePath });
|
||||||
if (verbose === true) {
|
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;
|
return env;
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ async function getRCFile({ environments, filePath, verbose }) {
|
|||||||
}
|
}
|
||||||
if (e.name === 'EnvironmentError') {
|
if (e.name === 'EnvironmentError') {
|
||||||
if (verbose === true) {
|
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;
|
throw e;
|
||||||
@ -87,13 +87,13 @@ async function getRCFile({ environments, filePath, verbose }) {
|
|||||||
try {
|
try {
|
||||||
const env = await parse_rc_file_1.getRCFileVars({ environments, filePath: path });
|
const env = await parse_rc_file_1.getRCFileVars({ environments, filePath: path });
|
||||||
if (verbose === true) {
|
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;
|
return env;
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
if (e.name === 'EnvironmentError') {
|
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) {
|
if (verbose === true) {
|
||||||
console.info(errorText);
|
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) {
|
if (verbose === true) {
|
||||||
console.info(errorText);
|
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) {
|
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';
|
environmentError.name = 'EnvironmentError';
|
||||||
throw environmentError;
|
throw environmentError;
|
||||||
}
|
}
|
||||||
|
|||||||
9
dist/signal-termination.js
vendored
9
dist/signal-termination.js
vendored
@ -18,7 +18,9 @@ class TermSignals {
|
|||||||
this._removeProcessListeners();
|
this._removeProcessListeners();
|
||||||
if (!this._exitCalled) {
|
if (!this._exitCalled) {
|
||||||
if (this.verbose) {
|
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
|
// Mark shared state so we do not run into a signal/exit loop
|
||||||
this._exitCalled = true;
|
this._exitCalled = true;
|
||||||
@ -47,8 +49,9 @@ class TermSignals {
|
|||||||
this._removeProcessListeners();
|
this._removeProcessListeners();
|
||||||
if (!this._exitCalled) {
|
if (!this._exitCalled) {
|
||||||
if (this.verbose) {
|
if (this.verbose) {
|
||||||
console.info(`Child process exited with code: ${code} and signal: ${signal}. ` +
|
console.info(`Child process exited with code: ${((code !== null && code !== void 0 ? code : '')).toString()} and signal:` +
|
||||||
'Terminating parent process...');
|
((signal !== null && signal !== void 0 ? signal : '')).toString() +
|
||||||
|
'. Terminating parent process...');
|
||||||
}
|
}
|
||||||
// Mark shared state so we do not run into a signal/exit loop
|
// Mark shared state so we do not run into a signal/exit loop
|
||||||
this._exitCalled = true;
|
this._exitCalled = true;
|
||||||
|
|||||||
11
package.json
11
package.json
@ -53,16 +53,16 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chai": "^4.0.0",
|
"@types/chai": "^4.0.0",
|
||||||
"@types/cross-spawn": "^6.0.0",
|
"@types/cross-spawn": "^6.0.0",
|
||||||
"@types/mocha": "^5.0.0",
|
"@types/mocha": "^7.0.0",
|
||||||
"@types/node": "^12.0.0",
|
"@types/node": "^12.0.0",
|
||||||
"@types/sinon": "^7.0.0",
|
"@types/sinon": "^7.0.0",
|
||||||
"chai": "^4.0.0",
|
"chai": "^4.0.0",
|
||||||
"coveralls": "^3.0.0",
|
"coveralls": "^3.0.0",
|
||||||
"mocha": "^6.0.0",
|
"mocha": "^7.0.0",
|
||||||
"nyc": "^15.0.0",
|
"nyc": "^15.0.0",
|
||||||
"sinon": "^8.0.0",
|
"sinon": "^8.0.0",
|
||||||
"ts-node": "^8.0.0",
|
"ts-node": "^8.0.0",
|
||||||
"ts-standard": "^3.0.0",
|
"ts-standard": "^4.0.0",
|
||||||
"typescript": "^3.7.0"
|
"typescript": "^3.7.0"
|
||||||
},
|
},
|
||||||
"nyc": {
|
"nyc": {
|
||||||
@ -87,5 +87,10 @@
|
|||||||
"ignore": [
|
"ignore": [
|
||||||
"dist"
|
"dist"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"greenkeeper": {
|
||||||
|
"ignore": [
|
||||||
|
"@types/node"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@ export async function getEnvFile (
|
|||||||
} catch (e) { }
|
} 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) {
|
if (verbose === true) {
|
||||||
console.info(error)
|
console.info(error)
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ export async function getRCFile (
|
|||||||
try {
|
try {
|
||||||
const env = await getRCFileVars({ environments, filePath })
|
const env = await getRCFileVars({ environments, filePath })
|
||||||
if (verbose === true) {
|
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
|
return env
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -80,7 +80,7 @@ export async function getRCFile (
|
|||||||
}
|
}
|
||||||
if (e.name === 'EnvironmentError') {
|
if (e.name === 'EnvironmentError') {
|
||||||
if (verbose === true) {
|
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
|
throw e
|
||||||
@ -92,12 +92,12 @@ export async function getRCFile (
|
|||||||
try {
|
try {
|
||||||
const env = await getRCFileVars({ environments, filePath: path })
|
const env = await getRCFileVars({ environments, filePath: path })
|
||||||
if (verbose === true) {
|
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
|
return env
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.name === 'EnvironmentError') {
|
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) {
|
if (verbose === true) {
|
||||||
console.info(errorText)
|
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) {
|
if (verbose === true) {
|
||||||
console.info(errorText)
|
console.info(errorText)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,7 +55,7 @@ export async function getRCFileVars (
|
|||||||
|
|
||||||
if (!environmentFound) {
|
if (!environmentFound) {
|
||||||
const environmentError = new Error(
|
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'
|
environmentError.name = 'EnvironmentError'
|
||||||
throw environmentError
|
throw environmentError
|
||||||
|
|||||||
@ -21,7 +21,10 @@ export class TermSignals {
|
|||||||
this._removeProcessListeners()
|
this._removeProcessListeners()
|
||||||
if (!this._exitCalled) {
|
if (!this._exitCalled) {
|
||||||
if (this.verbose) {
|
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
|
// Mark shared state so we do not run into a signal/exit loop
|
||||||
this._exitCalled = true
|
this._exitCalled = true
|
||||||
@ -51,8 +54,9 @@ export class TermSignals {
|
|||||||
if (!this._exitCalled) {
|
if (!this._exitCalled) {
|
||||||
if (this.verbose) {
|
if (this.verbose) {
|
||||||
console.info(
|
console.info(
|
||||||
`Child process exited with code: ${code} and signal: ${signal}. ` +
|
`Child process exited with code: ${(code ?? '').toString()} and signal:` +
|
||||||
'Terminating parent process...'
|
(signal ?? '').toString() +
|
||||||
|
'. Terminating parent process...'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// Mark shared state so we do not run into a signal/exit loop
|
// 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)
|
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 => {
|
it('should not terminate parent process if parent process already terminating', (): void => {
|
||||||
assert.notOk(term._exitCalled)
|
assert.notOk(term._exitCalled)
|
||||||
term.handleTermSignals(proc)
|
term.handleTermSignals(proc)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user