@nu-art/build-and-install 0.204.29 → 0.204.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/phases/phases.js +43 -5
- package/screen/ProjectScreen.js +1 -1
- package/screen/RunningProcessLogs.js +9 -0
package/package.json
CHANGED
package/phases/phases.js
CHANGED
|
@@ -618,22 +618,59 @@ exports.Phase_Launch = {
|
|
|
618
618
|
.setUID(pkg.name).debug()
|
|
619
619
|
.append(`array=($(lsof -ti:${allPorts.join(',')}))`)
|
|
620
620
|
.append(`((\${#array[@]} > 0)) && kill -9 "\${array[@]}"`)
|
|
621
|
-
|
|
621
|
+
.append('echo ')
|
|
622
622
|
.execute();
|
|
623
|
+
const KILL_CONFIRM_LOG = `KILL PROCESS`;
|
|
624
|
+
const PROXY_PID_PROCESS = 'PROXY_PID_PROCESS';
|
|
625
|
+
let proxyPid;
|
|
626
|
+
const proxyPidProcessor = (stdout) => {
|
|
627
|
+
var _a;
|
|
628
|
+
if (stdout.includes(KILL_CONFIRM_LOG))
|
|
629
|
+
return proxyCommando.close();
|
|
630
|
+
const pid = (_a = stdout.match(new RegExp(`${PROXY_PID_PROCESS}=(\\d+)`))) === null || _a === void 0 ? void 0 : _a[1];
|
|
631
|
+
if (!(0, ts_common_1.exists)(pid))
|
|
632
|
+
return;
|
|
633
|
+
proxyPid = +pid;
|
|
634
|
+
// proxyCommando.removeStdoutProcessor(proxyPidProcessor);
|
|
635
|
+
};
|
|
623
636
|
const proxyCommando = nvm_1.NVM.createInteractiveCommando(basic_1.Cli_Basic)
|
|
624
637
|
.setUID(pkg.name)
|
|
625
638
|
.cd(pkg.path)
|
|
626
|
-
.
|
|
639
|
+
.addStdoutProcessor(proxyPidProcessor)
|
|
640
|
+
.append('echo ZE ZEVEL1')
|
|
641
|
+
.append('ts-node src/main/proxy.ts &')
|
|
642
|
+
.append('pid=$!')
|
|
643
|
+
.append(`echo "${PROXY_PID_PROCESS}=\${pid}"`)
|
|
644
|
+
.append(`wait \$pid`)
|
|
645
|
+
.append(`echo "${KILL_CONFIRM_LOG} \${pid}"`);
|
|
646
|
+
const EMULATOR_PID_PROCESS = 'EMULATOR_PID_PROCESS';
|
|
647
|
+
let emulatorPid;
|
|
648
|
+
const emulatorPidProcessor = (stdout) => {
|
|
649
|
+
var _a;
|
|
650
|
+
if (stdout.includes(KILL_CONFIRM_LOG))
|
|
651
|
+
return emulatorCommando.close();
|
|
652
|
+
const pid = (_a = stdout.match(new RegExp(`${EMULATOR_PID_PROCESS}=(\\d+)`))) === null || _a === void 0 ? void 0 : _a[1];
|
|
653
|
+
if (!(0, ts_common_1.exists)(pid))
|
|
654
|
+
return;
|
|
655
|
+
emulatorPid = +pid;
|
|
656
|
+
};
|
|
627
657
|
const emulatorCommando = nvm_1.NVM.createInteractiveCommando(basic_1.Cli_Basic)
|
|
628
658
|
.setUID(pkg.name)
|
|
629
659
|
.cd(pkg.path)
|
|
630
|
-
.
|
|
660
|
+
.addStdoutProcessor(emulatorPidProcessor)
|
|
661
|
+
.append('echo ZE ZEVEL2')
|
|
662
|
+
.append(`firebase emulators:start --export-on-exit --import=.trash/data ${runInDebug ? `--inspect-functions ${pkg.envConfig.ssl}` : ''} &`)
|
|
663
|
+
.append('pid=$!')
|
|
664
|
+
.append(`echo "${EMULATOR_PID_PROCESS}=\${pid}"`)
|
|
665
|
+
.append(`wait \$pid`)
|
|
666
|
+
.append(`echo "${KILL_CONFIRM_LOG} \${pid}"`);
|
|
631
667
|
await proxyCommando.execute();
|
|
632
668
|
await emulatorCommando.execute();
|
|
633
669
|
runningAppsLogs.addOnTerminateCallback(async () => {
|
|
634
670
|
console.log('HERE');
|
|
635
|
-
await
|
|
636
|
-
await
|
|
671
|
+
await emulatorCommando.gracefullyKill(emulatorPid);
|
|
672
|
+
await proxyCommando.gracefullyKill(proxyPid);
|
|
673
|
+
runningAppsLogs.unregisterApp(pkg.name);
|
|
637
674
|
});
|
|
638
675
|
return;
|
|
639
676
|
}
|
|
@@ -644,6 +681,7 @@ exports.Phase_Launch = {
|
|
|
644
681
|
return nvm_1.NVM.createInteractiveCommando(basic_1.Cli_Basic)
|
|
645
682
|
.setUID(pkg.name).debug()
|
|
646
683
|
.cd(pkg.path)
|
|
684
|
+
.append('echo ZE ZEVEL3')
|
|
647
685
|
.append(`array=($(lsof -ti:${[pkg.envConfig.hostingPort].join(',')}))`)
|
|
648
686
|
.append(`((\${#array[@]} > 0)) && kill -9 "\${array[@]}"`)
|
|
649
687
|
.append(`nvm use`)
|
package/screen/ProjectScreen.js
CHANGED
|
@@ -5,6 +5,7 @@ const ts_common_1 = require("@nu-art/ts-common");
|
|
|
5
5
|
const ConsoleScreen_1 = require("@nu-art/commando/console/ConsoleScreen");
|
|
6
6
|
class RunningProcessLogs extends ConsoleScreen_1.ConsoleScreen {
|
|
7
7
|
constructor() {
|
|
8
|
+
let killed = false;
|
|
8
9
|
super({
|
|
9
10
|
smartCSR: true,
|
|
10
11
|
title: 'Runtime-Logs',
|
|
@@ -12,6 +13,14 @@ class RunningProcessLogs extends ConsoleScreen_1.ConsoleScreen {
|
|
|
12
13
|
{
|
|
13
14
|
keys: ['C-c'],
|
|
14
15
|
callback: async () => {
|
|
16
|
+
if (killed)
|
|
17
|
+
return;
|
|
18
|
+
killed = true;
|
|
19
|
+
// this.dispose();
|
|
20
|
+
console.log('exiting1');
|
|
21
|
+
await (0, ts_common_1.sleep)(2000);
|
|
22
|
+
console.log('exiting2');
|
|
23
|
+
await (0, ts_common_1.sleep)(2000);
|
|
15
24
|
await Promise.all(this.onTerminateCallbacks.map(callback => callback()));
|
|
16
25
|
process.exit(0);
|
|
17
26
|
}
|