@nu-art/build-and-install 0.204.29 → 0.204.30
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 +34 -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,51 @@ 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
|
-
// .append(`echo ZE ZEVEL`)
|
|
622
621
|
.execute();
|
|
622
|
+
const PROXY_PID_PROCESS = 'PROXY_PID_PROCESS';
|
|
623
|
+
let proxyPid;
|
|
624
|
+
const proxyPidProcessor = (stdout) => {
|
|
625
|
+
var _a;
|
|
626
|
+
const pid = (_a = stdout.match(new RegExp(`${PROXY_PID_PROCESS}=(\\d+)`))) === null || _a === void 0 ? void 0 : _a[1];
|
|
627
|
+
if (!(0, ts_common_1.exists)(pid))
|
|
628
|
+
return;
|
|
629
|
+
proxyPid = +pid;
|
|
630
|
+
proxyCommando.removeStdoutProcessor(proxyPidProcessor);
|
|
631
|
+
};
|
|
623
632
|
const proxyCommando = nvm_1.NVM.createInteractiveCommando(basic_1.Cli_Basic)
|
|
624
633
|
.setUID(pkg.name)
|
|
625
634
|
.cd(pkg.path)
|
|
626
|
-
.
|
|
635
|
+
.addStdoutProcessor(proxyPidProcessor)
|
|
636
|
+
.addStderrProcessor(proxyPidProcessor)
|
|
637
|
+
.append('ts-node src/main/proxy.ts &')
|
|
638
|
+
.append('pid=$!')
|
|
639
|
+
.append(`echo "${PROXY_PID_PROCESS}=\${pid}"`)
|
|
640
|
+
.append(`wait \$pid`);
|
|
641
|
+
const EMULATOR_PID_PROCESS = 'EMULATOR_PID_PROCESS';
|
|
642
|
+
let emulatorPid;
|
|
643
|
+
const emulatorPidProcessor = (stdout) => {
|
|
644
|
+
var _a;
|
|
645
|
+
const pid = (_a = stdout.match(new RegExp(`${EMULATOR_PID_PROCESS}=(\\d+)`))) === null || _a === void 0 ? void 0 : _a[1];
|
|
646
|
+
if (!(0, ts_common_1.exists)(pid))
|
|
647
|
+
return;
|
|
648
|
+
emulatorPid = +pid;
|
|
649
|
+
emulatorCommando.removeStdoutProcessor(emulatorPidProcessor);
|
|
650
|
+
};
|
|
627
651
|
const emulatorCommando = nvm_1.NVM.createInteractiveCommando(basic_1.Cli_Basic)
|
|
628
652
|
.setUID(pkg.name)
|
|
629
653
|
.cd(pkg.path)
|
|
630
|
-
.
|
|
654
|
+
.addStdoutProcessor(emulatorPidProcessor)
|
|
655
|
+
.addStderrProcessor(emulatorPidProcessor)
|
|
656
|
+
.append(`firebase emulators:start --export-on-exit --import=.trash/data ${runInDebug ? `--inspect-functions ${pkg.envConfig.ssl}` : ''} &`)
|
|
657
|
+
.append('pid=$!')
|
|
658
|
+
.append(`echo "${EMULATOR_PID_PROCESS}=\${pid}"`)
|
|
659
|
+
.append(`wait \$pid`);
|
|
631
660
|
await proxyCommando.execute();
|
|
632
661
|
await emulatorCommando.execute();
|
|
633
662
|
runningAppsLogs.addOnTerminateCallback(async () => {
|
|
634
663
|
console.log('HERE');
|
|
635
|
-
await
|
|
636
|
-
await
|
|
664
|
+
await emulatorCommando.gracefullyKill(emulatorPid);
|
|
665
|
+
await proxyCommando.gracefullyKill(proxyPid);
|
|
637
666
|
});
|
|
638
667
|
return;
|
|
639
668
|
}
|
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
|
}
|