@nu-art/build-and-install 0.204.33 → 0.204.35
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 +18 -30
- package/screen/ProjectScreen.js +3 -3
- package/screen/RunningProcessLogs.js +0 -4
package/package.json
CHANGED
package/phases/phases.js
CHANGED
|
@@ -611,9 +611,11 @@ exports.Phase_Launch = {
|
|
|
611
611
|
ts_common_1.BeLogged.addClient(logClient);
|
|
612
612
|
projectScreen.updateOrCreatePackage(pkg.name, 'Launching...');
|
|
613
613
|
if (pkg.type === 'firebase-functions-app') {
|
|
614
|
+
//Stagger app initialization
|
|
614
615
|
await (0, ts_common_1.sleep)(1000 * counter++);
|
|
615
|
-
const allPorts = Array.from({ length: 10 }, (_, i) => `${pkg.envConfig.basePort + i}`);
|
|
616
616
|
runningAppsLogs.registerApp(pkg.name, logClient);
|
|
617
|
+
//Make sure app ports are released
|
|
618
|
+
const allPorts = Array.from({ length: 10 }, (_, i) => `${pkg.envConfig.basePort + i}`);
|
|
617
619
|
await nvm_1.NVM.createCommando(basic_1.Cli_Basic)
|
|
618
620
|
.setUID(pkg.name).debug()
|
|
619
621
|
.append(`array=($(lsof -ti:${allPorts.join(',')}))`)
|
|
@@ -622,42 +624,27 @@ exports.Phase_Launch = {
|
|
|
622
624
|
.execute();
|
|
623
625
|
const KILL_CONFIRM_LOG = `KILL PROCESS`;
|
|
624
626
|
const PROXY_PID_PROCESS = 'PROXY_PID_PROCESS';
|
|
625
|
-
|
|
626
|
-
const
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
if (!(0, ts_common_1.exists)(pid))
|
|
632
|
-
return;
|
|
633
|
-
proxyPid = +pid;
|
|
634
|
-
// proxyCommando.removeStdoutProcessor(proxyPidProcessor);
|
|
635
|
-
};
|
|
636
|
-
const proxyCommando = nvm_1.NVM.createInteractiveCommando(basic_1.Cli_Basic)
|
|
627
|
+
const EMULATOR_PID_PROCESS = 'EMULATOR_PID_PROCESS';
|
|
628
|
+
const proxyCommando = nvm_1.NVM.createInteractiveCommando(basic_1.Cli_Basic);
|
|
629
|
+
//Listen on proxy kill command & proxy pid
|
|
630
|
+
const proxyPIDListener = new cli_1.CommandoCLIKeyValueListener(new RegExp(`${PROXY_PID_PROCESS}=(\\d+)`));
|
|
631
|
+
new cli_1.CommandoCLIListener(() => proxyCommando.close(), KILL_CONFIRM_LOG).listen(proxyCommando);
|
|
632
|
+
proxyPIDListener.listen(proxyCommando)
|
|
637
633
|
.setUID(pkg.name)
|
|
638
634
|
.cd(pkg.path)
|
|
639
|
-
.addStdoutProcessor(proxyPidProcessor)
|
|
640
635
|
.append('echo ZE ZEVEL1')
|
|
641
636
|
.append('ts-node src/main/proxy.ts &')
|
|
642
637
|
.append('pid=$!')
|
|
643
638
|
.append(`echo "${PROXY_PID_PROCESS}=\${pid}"`)
|
|
644
639
|
.append(`wait \$pid`)
|
|
645
640
|
.append(`echo "${KILL_CONFIRM_LOG} \${pid}"`);
|
|
646
|
-
const
|
|
647
|
-
|
|
648
|
-
const
|
|
649
|
-
|
|
650
|
-
|
|
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
|
-
};
|
|
657
|
-
const emulatorCommando = nvm_1.NVM.createInteractiveCommando(basic_1.Cli_Basic)
|
|
641
|
+
const emulatorCommando = nvm_1.NVM.createInteractiveCommando(basic_1.Cli_Basic);
|
|
642
|
+
//Listen on emulator kill command & emulator pid
|
|
643
|
+
const emulatorPIDListener = new cli_1.CommandoCLIKeyValueListener(new RegExp(`${EMULATOR_PID_PROCESS}=(\\d+)`));
|
|
644
|
+
new cli_1.CommandoCLIListener(() => emulatorCommando.close(), KILL_CONFIRM_LOG).listen(emulatorCommando);
|
|
645
|
+
emulatorPIDListener.listen(emulatorCommando)
|
|
658
646
|
.setUID(pkg.name)
|
|
659
647
|
.cd(pkg.path)
|
|
660
|
-
.addStdoutProcessor(emulatorPidProcessor)
|
|
661
648
|
.append('echo ZE ZEVEL2')
|
|
662
649
|
.append(`firebase emulators:start --export-on-exit --import=.trash/data ${runInDebug ? `--inspect-functions ${pkg.envConfig.ssl}` : ''} &`)
|
|
663
650
|
.append('pid=$!')
|
|
@@ -667,9 +654,10 @@ exports.Phase_Launch = {
|
|
|
667
654
|
await proxyCommando.execute();
|
|
668
655
|
await emulatorCommando.execute();
|
|
669
656
|
runningAppsLogs.addOnTerminateCallback(async () => {
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
await
|
|
657
|
+
const emulatorPid = Number(emulatorPIDListener.getValue());
|
|
658
|
+
const proxyPid = Number(proxyPIDListener.getValue());
|
|
659
|
+
await emulatorCommando.gracefullyKill(isNaN(emulatorPid) ? undefined : emulatorPid);
|
|
660
|
+
await proxyCommando.gracefullyKill(isNaN(proxyPid) ? undefined : proxyPid);
|
|
673
661
|
runningAppsLogs.unregisterApp(pkg.name);
|
|
674
662
|
});
|
|
675
663
|
return;
|
package/screen/ProjectScreen.js
CHANGED
|
@@ -76,7 +76,7 @@ class ProjectScreen extends ConsoleScreen_1.ConsoleScreen {
|
|
|
76
76
|
tags: true,
|
|
77
77
|
style: {
|
|
78
78
|
border: { fg: 'green' },
|
|
79
|
-
fg: '
|
|
79
|
+
fg: 'green',
|
|
80
80
|
},
|
|
81
81
|
align: 'center'
|
|
82
82
|
});
|
|
@@ -114,9 +114,9 @@ class ProjectScreen extends ConsoleScreen_1.ConsoleScreen {
|
|
|
114
114
|
tags: true,
|
|
115
115
|
style: {
|
|
116
116
|
border: { fg: 'green' },
|
|
117
|
-
fg: '
|
|
117
|
+
fg: 'green',
|
|
118
118
|
},
|
|
119
|
-
align: 'center'
|
|
119
|
+
align: 'center',
|
|
120
120
|
});
|
|
121
121
|
this.logger = this.createWidget('log', {
|
|
122
122
|
top: 3,
|
|
@@ -17,10 +17,6 @@ class RunningProcessLogs extends ConsoleScreen_1.ConsoleScreen {
|
|
|
17
17
|
return;
|
|
18
18
|
killed = true;
|
|
19
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);
|
|
24
20
|
await Promise.all(this.onTerminateCallbacks.map(callback => callback()));
|
|
25
21
|
process.exit(0);
|
|
26
22
|
}
|