@nu-art/build-and-install 0.204.18 → 0.204.19
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
CHANGED
package/phases/phases.js
CHANGED
|
@@ -585,6 +585,7 @@ exports.Phase_CompileWatch = {
|
|
|
585
585
|
});
|
|
586
586
|
}
|
|
587
587
|
};
|
|
588
|
+
// const runningAppsLogs = new RunningProcessLogs();
|
|
588
589
|
let counter = 0;
|
|
589
590
|
exports.Phase_Launch = {
|
|
590
591
|
type: 'package',
|
|
@@ -594,21 +595,38 @@ exports.Phase_Launch = {
|
|
|
594
595
|
filter: async (pkg) => { var _a; return !!((_a = pkg.name.match(new RegExp(params_1.RuntimeParams.launch))) === null || _a === void 0 ? void 0 : _a[0]) && (pkg.type === 'firebase-functions-app' || pkg.type === 'firebase-hosting-app'); },
|
|
595
596
|
action: async (pkg) => {
|
|
596
597
|
const projectScreen = ProjectScreen_1.MemKey_ProjectScreen.get();
|
|
598
|
+
// if (projectScreen.isEnabled()) {
|
|
599
|
+
// projectScreen.disable();
|
|
600
|
+
// runningAppsLogs.enable();
|
|
601
|
+
// }
|
|
602
|
+
const logClient = new ts_common_1.LogClient_MemBuffer(pkg.name);
|
|
603
|
+
logClient.setForTerminal();
|
|
604
|
+
logClient.setComposer((tag, level) => {
|
|
605
|
+
ts_common_1._logger_finalDate.setTime(Date.now() - ts_common_1._logger_timezoneOffset);
|
|
606
|
+
const date = ts_common_1._logger_finalDate.toISOString().replace(/T/, '_').replace(/Z/, '').substring(0, 23).split('_')[1];
|
|
607
|
+
return `${date} ${(0, ts_common_1._logger_getPrefix)(level)}: `;
|
|
608
|
+
});
|
|
609
|
+
logClient.setFilter((level, tag) => {
|
|
610
|
+
return tag === pkg.name;
|
|
611
|
+
});
|
|
597
612
|
projectScreen.updateOrCreatePackage(pkg.name, 'Launching...');
|
|
598
613
|
if (pkg.type === 'firebase-functions-app') {
|
|
599
614
|
await (0, ts_common_1.sleep)(1000 * counter++);
|
|
600
615
|
const allPorts = Array.from({ length: 10 }, (_, i) => `${pkg.envConfig.basePort + i}`);
|
|
601
616
|
const command = nvm_1.NVM.createInteractiveCommando(basic_1.Cli_Basic)
|
|
617
|
+
.setUID(pkg.name)
|
|
602
618
|
.cd(pkg.path)
|
|
603
619
|
.append(`nvm use`)
|
|
604
620
|
.append(`array=($(lsof -ti:${allPorts.join(',')}))`)
|
|
605
621
|
.append(`((\${#array[@]} > 0)) && kill -9 "\${array[@]}"`);
|
|
606
622
|
command.append(`firebase emulators:start --export-on-exit --import=.trash/data ${runInDebug ? `--inspect-functions ${pkg.envConfig.ssl}` : ''}`);
|
|
623
|
+
// runningAppsLogs.registerApp(pkg.name, logClient);
|
|
607
624
|
return command
|
|
608
625
|
.execute();
|
|
609
626
|
}
|
|
610
627
|
if (pkg.type === 'firebase-hosting-app')
|
|
611
628
|
return nvm_1.NVM.createInteractiveCommando(basic_1.Cli_Basic)
|
|
629
|
+
.setUID(pkg.name)
|
|
612
630
|
.cd(pkg.path)
|
|
613
631
|
.append(`array=($(lsof -ti:${[pkg.envConfig.basePort - 1].join(',')}))`)
|
|
614
632
|
.append(`((\${#array[@]} > 0)) && kill -9 "\${array[@]}"`)
|
package/screen/ProjectScreen.js
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.MemKey_ProjectScreen = exports.ProjectScreen = void 0;
|
|
4
27
|
// @ts-ignore
|
|
5
|
-
const
|
|
28
|
+
const blessed = __importStar(require("neo-blessed"));
|
|
6
29
|
const MemStorage_1 = require("@nu-art/ts-common/mem-storage/MemStorage");
|
|
7
30
|
const ts_common_1 = require("@nu-art/ts-common");
|
|
8
31
|
class ProjectScreen {
|
|
@@ -64,7 +87,7 @@ class ProjectScreen {
|
|
|
64
87
|
}
|
|
65
88
|
enable() {
|
|
66
89
|
this.enabled = true;
|
|
67
|
-
this.screen =
|
|
90
|
+
this.screen = blessed.screen({
|
|
68
91
|
smartCSR: true,
|
|
69
92
|
title: 'Build and install',
|
|
70
93
|
});
|
|
@@ -72,7 +95,7 @@ class ProjectScreen {
|
|
|
72
95
|
return process.exit(1); // Quit on q, esc, or ctrl-c
|
|
73
96
|
});
|
|
74
97
|
// Create the UI components
|
|
75
|
-
this.phaseBox =
|
|
98
|
+
this.phaseBox = blessed.text({
|
|
76
99
|
parent: this.screen,
|
|
77
100
|
top: 0,
|
|
78
101
|
left: 0,
|
|
@@ -87,7 +110,7 @@ class ProjectScreen {
|
|
|
87
110
|
},
|
|
88
111
|
align: 'center'
|
|
89
112
|
});
|
|
90
|
-
this.packageTable =
|
|
113
|
+
this.packageTable = blessed.listtable({
|
|
91
114
|
parent: this.screen,
|
|
92
115
|
top: 3,
|
|
93
116
|
left: 0,
|
|
@@ -111,7 +134,7 @@ class ProjectScreen {
|
|
|
111
134
|
},
|
|
112
135
|
}
|
|
113
136
|
});
|
|
114
|
-
this.titleElement =
|
|
137
|
+
this.titleElement = blessed.text({
|
|
115
138
|
parent: this.screen,
|
|
116
139
|
top: 0,
|
|
117
140
|
right: 0,
|
|
@@ -126,7 +149,7 @@ class ProjectScreen {
|
|
|
126
149
|
},
|
|
127
150
|
align: 'center'
|
|
128
151
|
});
|
|
129
|
-
this.logger =
|
|
152
|
+
this.logger = blessed.log({
|
|
130
153
|
parent: this.screen,
|
|
131
154
|
top: 3,
|
|
132
155
|
right: 0,
|
|
@@ -144,6 +167,9 @@ class ProjectScreen {
|
|
|
144
167
|
align: 'left'
|
|
145
168
|
});
|
|
146
169
|
}
|
|
170
|
+
isEnabled() {
|
|
171
|
+
return this.enabled;
|
|
172
|
+
}
|
|
147
173
|
disable() {
|
|
148
174
|
this.enabled = false;
|
|
149
175
|
if (!this.screen)
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { LogClient_MemBuffer } from '@nu-art/ts-common';
|
|
2
2
|
import { ConsoleScreen } from '@nu-art/commando/console/ConsoleScreen';
|
|
3
|
-
export type PackageStatus = {
|
|
4
|
-
packageName: string;
|
|
5
|
-
status: string;
|
|
6
|
-
error?: string;
|
|
7
|
-
};
|
|
8
3
|
export declare class RunningProcessLogs extends ConsoleScreen<{
|
|
9
4
|
logs: {
|
|
10
5
|
key: string;
|
|
@@ -5,7 +5,17 @@ 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
|
-
super(
|
|
8
|
+
super({
|
|
9
|
+
smartCSR: true,
|
|
10
|
+
title: 'Runtime-Logs',
|
|
11
|
+
keyBinding: [
|
|
12
|
+
{
|
|
13
|
+
keys: ['C-c'],
|
|
14
|
+
callback: () => process.exit(0)
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
this.state = { logs: [] };
|
|
9
19
|
}
|
|
10
20
|
registerApp(appKey, logClient) {
|
|
11
21
|
const logs = this.state.logs;
|
|
@@ -14,6 +24,10 @@ class RunningProcessLogs extends ConsoleScreen_1.ConsoleScreen {
|
|
|
14
24
|
throw new ts_common_1.BadImplementationException(`already have log for appkey: ${appKey}`);
|
|
15
25
|
logs.push({ key: appKey, logClient });
|
|
16
26
|
this.recalculateWidgets(logs);
|
|
27
|
+
logClient.setLogAppendedListener(() => {
|
|
28
|
+
this.render();
|
|
29
|
+
// might have a leak.. need to remove the listener at some point
|
|
30
|
+
});
|
|
17
31
|
this.setState({ logs });
|
|
18
32
|
}
|
|
19
33
|
unregisterApp(appKey) {
|
|
@@ -26,7 +40,7 @@ class RunningProcessLogs extends ConsoleScreen_1.ConsoleScreen {
|
|
|
26
40
|
this.setState({ logs });
|
|
27
41
|
}
|
|
28
42
|
recalculateWidgets(logs) {
|
|
29
|
-
this.clearScreen(
|
|
43
|
+
this.clearScreen(false);
|
|
30
44
|
const totalApps = logs.length;
|
|
31
45
|
const fraction = 100 / totalApps;
|
|
32
46
|
logs.forEach((log, index) => {
|