fix(core): update

This commit is contained in:
Philipp Kunz 2019-05-28 09:31:10 +02:00
parent 96c5967a35
commit d0a5587a14
5 changed files with 129 additions and 24 deletions

124
package-lock.json generated
View File

@ -199,8 +199,16 @@
"@pushrocks/smartlog-interfaces": {
"version": "2.0.5",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog-interfaces/-/smartlog-interfaces-2.0.5.tgz",
"integrity": "sha512-eLNlRpDwy3E+6v/B6fo/NiAo+UxBO3SxKgIIsgUGbWfVpsyUi0PG2xfVCdhJlhL1AsRRvKglfHSOB8qKE+XCLw==",
"dev": true
"integrity": "sha512-eLNlRpDwy3E+6v/B6fo/NiAo+UxBO3SxKgIIsgUGbWfVpsyUi0PG2xfVCdhJlhL1AsRRvKglfHSOB8qKE+XCLw=="
},
"@pushrocks/smartlog-source-ora": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/@pushrocks/smartlog-source-ora/-/smartlog-source-ora-1.0.7.tgz",
"integrity": "sha512-lgpZ2rBLt9UGIdMb43cB9rxwtbu4RaNmdQnAYfNGxizGPuNtXw3WAzdHyS5tEJFZAbvMOiwNguQ6Bk1i2gaedw==",
"requires": {
"@pushrocks/smartlog-interfaces": "^2.0.5",
"ora": "^3.4.0"
}
},
"@pushrocks/smartparam": {
"version": "1.0.4",
@ -406,7 +414,6 @@
"version": "3.2.1",
"resolved": "https://verdaccio.lossless.one/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"requires": {
"color-convert": "^1.9.0"
}
@ -512,7 +519,6 @@
"version": "2.4.2",
"resolved": "https://verdaccio.lossless.one/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"dev": true,
"requires": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
@ -525,6 +531,19 @@
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
"dev": true
},
"cli-cursor": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",
"integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=",
"requires": {
"restore-cursor": "^2.0.0"
}
},
"cli-spinners": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.1.0.tgz",
"integrity": "sha512-8B00fJOEh1HPrx4fo5eW16XmE1PcL1tGpGrxy63CXGP9nHdPBN63X75hA1zhvQuhVztJWLqV58Roj2qlNM7cAA=="
},
"cliui": {
"version": "4.1.0",
"resolved": "https://verdaccio.lossless.one/cliui/-/cliui-4.1.0.tgz",
@ -575,7 +594,6 @@
"version": "1.9.3",
"resolved": "https://verdaccio.lossless.one/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"dev": true,
"requires": {
"color-name": "1.1.3"
}
@ -583,8 +601,7 @@
"color-name": {
"version": "1.1.3",
"resolved": "https://verdaccio.lossless.one/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
"dev": true
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
},
"combined-stream": {
"version": "1.0.8",
@ -648,6 +665,21 @@
"type-detect": "^4.0.0"
}
},
"defaults": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz",
"integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=",
"requires": {
"clone": "^1.0.2"
},
"dependencies": {
"clone": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",
"integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4="
}
}
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://verdaccio.lossless.one/delayed-stream/-/delayed-stream-1.0.0.tgz",
@ -678,8 +710,7 @@
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://verdaccio.lossless.one/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
},
"esprima": {
"version": "4.0.1",
@ -813,8 +844,7 @@
"has-flag": {
"version": "3.0.0",
"resolved": "https://verdaccio.lossless.one/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
},
"inflight": {
"version": "1.0.6",
@ -937,6 +967,14 @@
"path-exists": "^3.0.0"
}
},
"log-symbols": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz",
"integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==",
"requires": {
"chalk": "^2.0.1"
}
},
"luxon": {
"version": "1.13.2",
"resolved": "https://verdaccio.lossless.one/luxon/-/luxon-1.13.2.tgz",
@ -1069,6 +1107,49 @@
"wrappy": "1"
}
},
"onetime": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",
"integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=",
"requires": {
"mimic-fn": "^1.0.0"
},
"dependencies": {
"mimic-fn": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",
"integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ=="
}
}
},
"ora": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/ora/-/ora-3.4.0.tgz",
"integrity": "sha512-eNwHudNbO1folBP3JsZ19v9azXWtQZjICdr3Q0TDPIaeBQ3mXLrh54wM+er0+hSp+dWKf+Z8KM58CYzEyIYxYg==",
"requires": {
"chalk": "^2.4.2",
"cli-cursor": "^2.1.0",
"cli-spinners": "^2.0.0",
"log-symbols": "^2.2.0",
"strip-ansi": "^5.2.0",
"wcwidth": "^1.0.1"
},
"dependencies": {
"ansi-regex": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg=="
},
"strip-ansi": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
"requires": {
"ansi-regex": "^4.1.0"
}
}
}
},
"os-locale": {
"version": "3.1.0",
"resolved": "https://verdaccio.lossless.one/os-locale/-/os-locale-3.1.0.tgz",
@ -1228,6 +1309,15 @@
"path-parse": "^1.0.6"
}
},
"restore-cursor": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",
"integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=",
"requires": {
"onetime": "^2.0.0",
"signal-exit": "^3.0.2"
}
},
"rxjs": {
"version": "6.5.2",
"resolved": "https://verdaccio.lossless.one/rxjs/-/rxjs-6.5.2.tgz",
@ -1272,8 +1362,7 @@
"signal-exit": {
"version": "3.0.2",
"resolved": "https://verdaccio.lossless.one/signal-exit/-/signal-exit-3.0.2.tgz",
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
"dev": true
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0="
},
"smartchai": {
"version": "2.0.1",
@ -1377,7 +1466,6 @@
"version": "5.5.0",
"resolved": "https://verdaccio.lossless.one/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
}
@ -1492,6 +1580,14 @@
"vinyl": "^2.0.1"
}
},
"wcwidth": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz",
"integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=",
"requires": {
"defaults": "^1.0.3"
}
},
"which": {
"version": "1.3.1",
"resolved": "https://verdaccio.lossless.one/which/-/which-1.3.1.tgz",

View File

@ -22,6 +22,7 @@
},
"dependencies": {
"@pushrocks/lik": "^3.0.5",
"@pushrocks/smartdelay": "^2.0.3"
"@pushrocks/smartdelay": "^2.0.3",
"@pushrocks/smartlog-source-ora": "^1.0.7"
}
}

View File

@ -1,5 +1,7 @@
import * as plugins from './smartexit.plugins';
import { ora } from './smartexit.logging';
export class SmartExit {
public processesToEnd = new plugins.lik.Objectmap<plugins.childProcess.ChildProcess>();
@ -19,13 +21,13 @@ export class SmartExit {
}
public async killAll() {
console.log('SMARTEXIT: Checking for remaining child processes before exit...');
ora.text('Checking for remaining child processes before exit...');
if (this.processesToEnd.getArray().length > 0) {
console.log('found remaining child processes');
ora.text('found remaining child processes');
let counter = 1;
this.processesToEnd.forEach(async childProcessArg => {
const pid = childProcessArg.pid;
console.log(`SMARTEXIT: killing process #${counter} with pid ${pid}`);
ora.text(`killing process #${counter} with pid ${pid}`);
plugins.smartdelay.delayFor(10000).then(() => {
if (childProcessArg.killed) {
return;
@ -37,7 +39,7 @@ export class SmartExit {
counter++;
});
} else {
console.log(`SMARTEXIT: Everything looks clean. Ready to exit!`);
ora.text(`Everything looks clean. Ready to exit!`);
}
}
@ -45,23 +47,25 @@ export class SmartExit {
// do app specific cleaning before exiting
process.on('exit', async (code) => {
if (code === 0) {
console.log('SMARTEXIT: Process wants to exit');
ora.text('Process wants to exit');
await this.killAll();
}
ora.finishSuccess('Exited ok!');
});
// catch ctrl+c event and exit normally
process.on('SIGINT', async () => {
console.log('SMARTEXIT: Ctrl-C... or SIGINT signal received!');
ora.text('Ctrl-C... or SIGINT signal received!');
await this.killAll();
ora.finishSuccess('Exited ok!');
});
//catch uncaught exceptions, trace, then exit normally
process.on('uncaughtException', async err => {
console.log('SMARTEXIT: uncaught exception...');
ora.text('SMARTEXIT: uncaught exception...');
console.log(err);
await this.killAll();
process.exit(1);
ora.finishSuccess('Exited ok!');
});
}
}

3
ts/smartexit.logging.ts Normal file
View File

@ -0,0 +1,3 @@
import * as plugins from './smartexit.plugins';
export const ora = new plugins.smartlogSourceOra.SmartlogSourceOra();

View File

@ -6,5 +6,6 @@ export { childProcess };
// pushrocks scope
import * as lik from '@pushrocks/lik';
import * as smartdelay from '@pushrocks/smartdelay';
import * as smartlogSourceOra from '@pushrocks/smartlog-source-ora';
export { lik, smartdelay };
export { lik, smartdelay, smartlogSourceOra};